Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime.binding
Class BeanServiceProvider

java.lang.Object
  extended by org.nuxeo.runtime.binding.AbstractServiceProvider
      extended by org.nuxeo.runtime.binding.BeanServiceProvider
All Implemented Interfaces:
ServiceProvider

public class BeanServiceProvider
extends AbstractServiceProvider

Author:
Bogdan Stefanescu

Field Summary
static java.lang.String LOCAL_SUFFIX
           
static java.lang.String PREFIX
           
static java.lang.String REMOTE_SUFFIX
           
 
Constructor Summary
BeanServiceProvider()
          This constructor should be used on server nodes.
BeanServiceProvider(javax.naming.InitialContext ctx)
          This constructor should be used on clients.
BeanServiceProvider(javax.naming.InitialContext ctx, boolean tryLocalFirst)
          This constructor should e used on clients that are using auto configuration.
 
Method Summary
 void destroy()
          The provider is no more needed.
 java.lang.Object getService(java.lang.Class<?> serviceClass, java.lang.String bindingKey)
          Gets the service instance given its interface class.
 
Methods inherited from class org.nuxeo.runtime.binding.AbstractServiceProvider
getManager, setManager
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

public static final java.lang.String PREFIX
See Also:
Constant Field Values

REMOTE_SUFFIX

public static final java.lang.String REMOTE_SUFFIX
See Also:
Constant Field Values

LOCAL_SUFFIX

public static final java.lang.String LOCAL_SUFFIX
See Also:
Constant Field Values
Constructor Detail

BeanServiceProvider

public BeanServiceProvider()
                    throws javax.naming.NamingException
This constructor should be used on server nodes. It will initialize the provider by using the default initial context. (as configured by the server application)

Throws:
javax.naming.NamingException

BeanServiceProvider

public BeanServiceProvider(javax.naming.InitialContext ctx)
                    throws javax.naming.NamingException
This constructor should be used on clients.

Parameters:
ctx - the initial naming context
Throws:
javax.naming.NamingException

BeanServiceProvider

public BeanServiceProvider(javax.naming.InitialContext ctx,
                           boolean tryLocalFirst)
                    throws javax.naming.NamingException
This constructor should e used on clients that are using auto configuration. The JNDI environment should be passed by the client.

Parameters:
ctx - the initial naming context
Throws:
javax.naming.NamingException
Method Detail

destroy

public void destroy()
Description copied from interface: ServiceProvider
The provider is no more needed. It should immediately release any system resources.


getService

public java.lang.Object getService(java.lang.Class<?> serviceClass,
                                   java.lang.String bindingKey)
Description copied from interface: ServiceProvider
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.