Overview

A Space Filter is a special hook point inside the engine that enables integration with external systems, or implementation of user defined logic. There are two ways to implement such a filter and integrate it with the space, both of which are covered in this page.

For a full SpaceFilter implementation and usage demo, visit the Space Filter Demo section.

Integrating the Space Filter with a Space

A space filter is integrated into a space upon creation of that space.

Each space filter that integrates with a space, needs a SpaceFilterConfig instance that defines it.

A SpaceFilterConfig can be created in two ways, depending on the implementation of the filter itself.

Implementing the ISpaceFilter Interface

If the filter implements the ISpaceFilter Interface, then a SpaceFilterConfig needs to be created for it, and each operation that needs to be filtered should be added to the FilterOperations list, as in the following code:

SpaceFilterConfig mySpaceFilterConfig = new SpaceFilterConfig();
mySpaceFilterConfig.FilterOperations = new List<FilterOperation>(new FilterOperation[]{ FilterOperation.BeforeWrite });
mySpaceFilterConfig.Filter = new MySpaceFilter();

Implementing a Space Filter using SpaceFilterOperationDelegate

If the filter is based on the SpaceFilterOperationDelegate, then a SpaceFilterConfig needs to be created. This is done with the appropriate SpaceFilterConfigFactory, either AttributeSpaceFilterConfigFactory, or MethodNameSpaceFilterConfigFactory, using the CreateSpaceFilterConfig() method.

Once a SpaceFilterConfig is created, it needs to be used when starting the space.

spaceConfig.SpaceFiltersConfig = new List<SpaceFilterConfig>();
spaceConfig.Add(mySpaceFilterConfig);

ISpaceProxy embeddedSpace = GigaSpacesFactory.FindSpace("/./mySpace", spaceConfig);

A space can have multiple space filters integrated in it. Simply create a SpaceFilterConfig instance per filter, and add it to the SpaceFiltersConfig list.

GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence