Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime.binding
Interface ServiceProvider

All Known Implementing Classes:
AbstractServiceProvider, BeanServiceProvider, RuntimeServiceProvider, SimpleServiceProvider

public interface ServiceProvider

A service provider is responsible to lookup services.

Author:
Bogdan Stefanescu

Method Summary
 void destroy()
          The provider is no more needed.
 ServiceManager getManager()
          Gets the service manager on which this provider is attached, or null if none.
 java.lang.Object getService(java.lang.Class<?> serviceClass, java.lang.String bindingKey)
          Gets the service instance given its interface class.
 void setManager(ServiceManager manager)
          Attaches the provider to a service manager.
 

Method Detail

setManager

void setManager(ServiceManager manager)
Attaches the provider to a service manager.

Parameters:
manager -
Throws:
java.lang.IllegalStateException - if the provider is already attached to a manager

getManager

ServiceManager getManager()
Gets the service manager on which this provider is attached, or null if none.

Returns:
the service manager or null if none

destroy

void destroy()
The provider is no more needed. It should immediately release any system resources.


getService

java.lang.Object getService(java.lang.Class<?> serviceClass,
                            java.lang.String bindingKey)
Gets the service instance given its interface class. Returns null if no service is found

If the lookup succeeds and the provider is attached to a service manager it may use the binding key to register a service binding on the manager so that the next time the same service is requested it will be picked up from the manager cache.

Note that the binding key should be used to lookup the service. Usually this key is the service class name but can be different when querying a named service (in this case it will be serviceClass + '@' + serviceName).

If implementors doesn't support named services then they can use the serviceClass to perform the lookup.

Parameters:
serviceClass - the interface of the service
bindingKey - the binding key to use when caching bindings
Returns:
the service instance if any was found or null otherwise

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.