For anyone to use a service a warrant is needed. This is created via
the getWarrant() method of the IManagerSupport plugin
provided with the Manager--see Section ![[*]](crossref.png) .
.
Here is how we can return a warrant for a service labelled admin:
IManagerSupport ms = (IManagerSupport) pluginManager().lookup(IManagerSupport.class)[0];
Warrant w = ms.getWarrant("admin",null);
Or if this code is in a subclass of AbstractPlugin:
IManagerSupport ms = managerSupport();
Warrant w = ms.getWarrant("admin",null);
The null argument can in fact be any Property (Section ![[*]](crossref.png) )
and it gets written into the warrant. Whenever the consumer later
uses the warrant to bind the service, that Property is passed
back to the createFacetCollection() method of the IServiceProvider
or ISimpleServiceProvider.
)
and it gets written into the warrant. Whenever the consumer later
uses the warrant to bind the service, that Property is passed
back to the createFacetCollection() method of the IServiceProvider
or ISimpleServiceProvider.
As a caveat to the above, remember that a service provider is really only used by the ServiceManager implementation of IServiceManager. Strictly speaking, the Property is passed to the ServiceManager which passes it to the service provider. If we are using another implementation of IServiceManager then it can deal with the Property as it wishes; it may not use IServiceProvider or ISimpleServiceProvider.
Nik Silver 2002-03-09