The Filter Namespace provides the ability to declare Coherence Filters with in a Cache Configuration. It is typically used with other Namespaces that require Filters to be specified. In particular, the Filter Namespace is designed to allow declarative specification of the Coherence filters as documented in the API.
The implementation is provided by the com.oracle.coherence.environment.extensible.namespaces.FilterNamespaceContentHandler
class.
The common prefix used for this namespace in Cache Configurations is filter
,
however as with all XML namespace declarations this can be defined arbitrarily
when declaring the namespace.
To use the namespace you should declare it as follows:
<cache-config xmlns:filter="class://com.oracle.coherence.environment.extensible.namespaces.FilterNamespaceContentHandler">
...
</cache-config>
The following section outlines the elements defined by this Namespace.
These are: all, always, and, any, custom, never, not, or, present, where and xor.
The filter:all
element defines an com.tangosol.util.filter.AllFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.AllFilter
.
Child Elements:
This element requires zero or more child elements that each resolve to an
instance of a com.tangosol.util.filter.Filter
. Child elements are typically
from this namespace and may be nested.
Examples:
An empty all
filter:
<filter:all/>
A simple all
filter:
<filter:all>
<filter:and>
...
</filter:and>
<filter:or>
...
</filter:or>
</filter:all>
The filter:always
element defines an com.tangosol.util.filter.AlwaysFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.AlwaysFilter
.
Example:
An always
filter:
<filter:always/>
The filter:and
element defines an com.tangosol.util.filter.AndFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.AndFilter
.
Child Elements:
This element requires precisely two child elements that each resolve to an
instance of a com.tangosol.util.filter.Filter
. Child elements are typically
from this namespace and may be nested.
Examples:
A simple and
filter:
<filter:and>
<filter:custom>...</filter:custom>
<filter:all>...</filter:all>
</filter:and>
The filter:any
element defines an com.tangosol.util.filter.AnyFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.AnyFilter
.
Child Elements:
This element requires zero or more child elements that each resolve to an
instance of a com.tangosol.util.filter.Filter
. Child elements are typically
from this namespace and may be nested.
Examples:
An empty any
filter:
<filter:any/>
A simple any
filter:
<filter:any>
<filter:and>
...
</filter:and>
<filter:or>
...
</filter:or>
</filter:any>
The filter:custom
element defines a com.tangosol.util.filter.Filter
based
on a ParameterizedBuilder<Filter>
.
Resolved Element Type:
When processed this element will be resolved to produce a com.tangosol.util.filter.Filter
.
Child Elements:
The child element of a filter:custom
element must produce a
ParameterizedBuilder<Filter>
.
Examples:
A simple custom
filter:
<filter:custom>
<instance>
<class-name>MyCustomFilter</class-name>
</instance>
</filter:custom>
The filter:never
element defines an com.tangosol.util.filter.NeverFilter
.
Resolved Element Type:
When processed this element will be resolved to produce a com.tangosol.util.filter.NeverFilter
.
Child Elements:
(none)
Example:
A 'never' filter:
<filter:never/>
The filter:not
element defines a com.tangosol.util.filter.NotFilter
.
Resolved Element Type:
When processed this element will be resolved to produce a com.tangosol.util.filter.NotFilter
.
Child Elements:
This element requires precisely one child element, that of which resolves to an
instance of a com.tangosol.util.filter.Filter
. The child element is typically
from this namespace and may be nested.
Examples:
A simple not
filter:
<filter:not>
<filter:and>
...
</filter:and>
</filter:not>
The filter:or
element defines an com.tangosol.util.filter.OrFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.OrFilter
.
Child Elements:
This element requires precisely two child elements that each resolve to an
instance of a com.tangosol.util.filter.Filter
. Child elements are typically
from this namespace and may be nested.
Examples:
A simple or
filter:
<filter:or>
<filter:custom>...</filter:custom>
<filter:all>...</filter:all>
</filter:or>
The filter:present
element defines a com.tangosol.util.filter.PresentFilter
.
Resolved Element Type:
When processed this element will be resolved to produce a com.tangosol.util.filter.PresentFilter
.
Child Elements:
(none)
Example:
A 'present' filter:
<filter:present/>
The filter:where
element defines a com.tangosol.util.filter.Filter
based on
a user-defined CohQL Where Clause.
Resolved Element Type:
When processed this element will be resolved to produce a com.tangosol.util.filter.Filter
.
Child Elements:
(none)
Example:
A 'where' filter:
<filter:where>value() like "%Gudday World%"</filter:where>
The filter:xor
element defines an com.tangosol.util.filter.XorFilter
.
Resolved Element Type:
When processed this element will be resolved to produce an com.tangosol.util.filter.XorFilter
.
Child Elements:
This element requires precisely two child elements that each resolve to an
instance of a com.tangosol.util.filter.Filter
. Child elements are typically
from this namespace and may be nested.
Examples:
A simple xor
filter:
<filter:xor>
<filter:custom>...</filter:custom>
<filter:all>...</filter:all>
</filter:xor>