The string representation of an LDAP search filter is defined by the following grammar. It uses a prefix format.
<filter> ::= '(' <filtercomp> ')' <filtercomp> ::= <and> | <or> | <not> | <item> <and> ::= '&' <filterlist> <or> ::= '|' <filterlist> <not> ::= '!' <filter> <filterlist> ::= <filter> | <filter> <filterlist> <item> ::= <simple> | <present> | <substring> <simple> ::= <attr> <filtertype> <value> <filtertype> ::= <equal> | <approx> | <greater> | <less> <equal> ::= '=' <approx> ::= '~=' <greater> ::= '>=' <less> ::= '<=' <present> ::= <attr> '=*' <substring> ::= <attr> '=' <initial> <any> <final> <initial> ::= NULL | <value> <any> ::= '*' <starval> <starval> ::= NULL | <value> '*' <starval> <final> ::= NULL | <value>
<attr>
is a string representing an attribute, or key, in the properties objects of the registered services. Attribute names are not case sensitive; that is cn and CN both refer to the same attribute. <value>
is a string representing the value, or part of one, of a key in the properties objects of the registered services. If a <value>
must contain one of the characters ' *
' or '(
' or ')
', these characters should be escaped by preceding them with the backslash ' \
' character. Note that although both the <substring>
and <present>
productions can produce the 'attr=*'
construct, this construct is used only to denote a presence filter. Examples of LDAP filters are:
"(cn=Babs Jensen)" "(!(cn=Tim Howes))" "(&(" + ServiceScope.SERVICE_TYPE + "=service:acs)(|(group=A)(group=B*)))" "(load<0.5)"@param listener - the ServiceListener to add. @param query - the String representation of the LDAP query (can be null) @throws InvalidSyntaxException - if the supplied query contains invalid syntax.
_http._tcp.local.
.
@param type full qualified service type, such as _http._tcp.local.
.
@param listener listener for service updates
If the context module's list of listeners already contains a listener {@code l} such that {@code (l==listener)}, then this method replaces that listener's filter (which may be {@code null}) with the specified one (which may be {@code null}).
The listener is called if the filter criteria is met. To filter based upon the class of the service, the filter should reference the {@link org.jboss.gravia.Constants#OBJECTCLASS} property. If {@code filter} is {@code null}, all services are considered to match the filter.
When using a {@code filter}, it is possible that the {@code ServiceEvent}s for the complete lifecycle of a service will not be delivered to the listener. For example, if the {@code filter} only matches when theproperty {@code x} has the value {@code 1}, the listener will not be called if the service is registered with the property {@code x} not setto the value {@code 1}. Subsequently, when the service is modified setting property {@code x} to the value {@code 1}, the filter will match and the listener will be called with a {@code ServiceEvent} of type{@code MODIFIED}. Thus, the listener will not be called with a {@code ServiceEvent} of type {@code REGISTERED}. @param listener The {@code ServiceListener} object to be added. @param filter The filter criteria. @throws IllegalArgumentException If {@code filter} contains an invalidfilter string that cannot be parsed. @throws IllegalStateException If this ModuleContext is no longer valid. @see ServiceEvent @see ServiceListener
If the context bundle's list of listeners already contains a listener {@code l} such that {@code (l==listener)}, then this method replaces that listener's filter (which may be {@code null}) with the specified one (which may be {@code null}).
The listener is called if the filter criteria is met. To filter based upon the class of the service, the filter should reference the {@link Constants#OBJECTCLASS} property. If {@code filter} is {@code null}, all services are considered to match the filter.
When using a {@code filter}, it is possible that the {@code ServiceEvent}s for the complete lifecycle of a service will not be delivered to the listener. For example, if the {@code filter} only matches when theproperty {@code x} has the value {@code 1}, the listener will not be called if the service is registered with the property {@code x} not setto the value {@code 1}. Subsequently, when the service is modified setting property {@code x} to the value {@code 1}, the filter will match and the listener will be called with a {@code ServiceEvent} of type{@code MODIFIED}. Thus, the listener will not be called with a {@code ServiceEvent} of type {@code REGISTERED}.
If the Java Runtime Environment supports permissions, the {@code ServiceListener} object will be notified of a service event onlyif the bundle that is registering it has the {@code ServicePermission} toget the service using at least one of the named classes the service was registered under. @param listener The {@code ServiceListener} object to be added. @param filter The filter criteria. @throws InvalidSyntaxException If {@code filter} contains an invalidfilter string that cannot be parsed. @throws IllegalStateException If this BundleContext is no longer valid. @see ServiceEvent @see ServiceListener @see ServicePermission
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|