Java Reference
In-Depth Information
2
6
8
4
rank:3
rank:null
1
5
rank:2
rank:0
7
3
rank:2
rank:-1
rank:3
rank:null
2
7
1
8
3
4
6
5
rank:3
rank:3
rank:2
rank:2
rank:null
rank:0
rank:null
rank:-1
Figure 4.11 OSGi service ordering (by highest service.ranking and then lowest service.id )
for multiple services using getServiceReferences , the ordering of the returned array
is undefined.
You've seen how to find services based on the interfaces they provide, but what if
you want to discover services with certain properties? For example, in figure 4.12, if
you ask for any stock listing service, you get back the first one ( NYSE ); but what if you
want a UK -based listing? The bundle context provides another query method that
accepts a standard LDAP filter string, described in RFC 1960, 4 and returns all services
matching the filter.
A quick guide to using LDAP queries
Perform attribute matching:
(name=John Smith)
(age>=20)
(age<=65)
Perform fuzzy matching:
(name~=johnsmith)
Perform wildcard matching:
(name=Jo*n*Smith*)
Determine if an attribute exists:
(name=*)
Match all the contained clauses:
(&(name=John Smith)(occupation=doctor))
Match at least one of the contained clauses:
(|(name~=John Smith)(name~=Smith John))
Negate the contained clause:
(!(name=John Smith))
4
T. Howes, “A String Representation of LDAP Search Filters,” www.ietf.org/rfc/rfc1960.txt .
Search WWH ::




Custom Search