|
|
|
Sponsored Link •
|
|
Advertisement
|
The ServiceTemplate class, which allows you to express
search criteria for Jini lookups,
consists solely of these three public fields:
public Entry[] attributeSetTemplates; public ServiceID serviceID; public Class[] serviceTypes;
ServiceTemplate has no methods and its instances merely serve
as
struct-like
containers for lookup
service queries. Matches are performed as described by the following excerpt
from
ServiceTemplate's javadoc page:
Items in the lookup service are matched using an instance of [ServiceTemplate]. A service item (item) matches a service template (tmpl) if:
item.serviceIDequalstmpl.serviceID(or iftmpl.serviceIDisnull)item.service[the service object] is an instance of every type intmpl.serviceTypesitem.attributeSetscontains at least one matching entry for each entry template intmpl.attributeSetTemplatesAn entry matches an entry template if the class of the template is the same as, or a superclass of, the class of the entry, and every non-null field in the template equals the corresponding field of the entry. Every entry can be used to match more than one template. Note that in a service template, for
serviceTypesandattributeSetTemplates, a null field is equivalent to an empty array; both represent a wildcard.
As described here, the service template can
include a reference to an array of Class objects. These
Class objects indicate to the lookup service the Java type
(or types) of the service object the client desires. The service
template can also include a service ID, which uniquely
identifies a service, and attributes, which must exactly match the
attributes uploaded by the service provider in the service item. The
service template can also contain wildcards for any of these fields. A
wildcard in the service ID field, for example, will match any service
ID.
|
Sponsored Links
|