JBoss EJB client 2.0.0.Beta4

org.jboss.ejb.client.remoting
Class ConfigBasedEJBClientContextSelector

java.lang.Object
  extended by org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector
All Implemented Interfaces:
ContextSelector<EJBClientContext>, IdentityEJBClientContextSelector

public class ConfigBasedEJBClientContextSelector
extends Object
implements IdentityEJBClientContextSelector

An EJB client context selector which uses EJBClientConfiguration to create RemotingConnectionEJBReceivers.

Author:
Jaikiran Pai

Field Summary
protected  EJBClientConfiguration ejbClientConfiguration
           
protected  EJBClientContext ejbClientContext
           
 
Constructor Summary
ConfigBasedEJBClientContextSelector(EJBClientConfiguration ejbClientConfiguration)
          Creates a ConfigBasedEJBClientContextSelector using the passed ejbClientConfiguration.
ConfigBasedEJBClientContextSelector(EJBClientConfiguration ejbClientConfiguration, ClassLoader classLoader)
          Creates a ConfigBasedEJBClientContextSelector using the passed ejbClientConfiguration.
 
Method Summary
 EJBClientContext getContext(EJBClientContextIdentifier identifier)
          Returns a context for the passed identifier.
 EJBClientContext getCurrent()
          Get the current instance, returning null if none are valid in the current context.
 void registerContext(EJBClientContextIdentifier identifier, EJBClientContext context)
          Associates the passed EJBClientContext to the identifier

It's up to the individual implementations to decide whether to throw an exception if there's already an EJBClientContext registered for the passed identifier

 EJBClientContext unRegisterContext(EJBClientContextIdentifier identifier)
          Unregisters and returns a previously registered EJBClientContext, for the passed identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ejbClientConfiguration

protected final EJBClientConfiguration ejbClientConfiguration

ejbClientContext

protected final EJBClientContext ejbClientContext
Constructor Detail

ConfigBasedEJBClientContextSelector

public ConfigBasedEJBClientContextSelector(EJBClientConfiguration ejbClientConfiguration)
Creates a ConfigBasedEJBClientContextSelector using the passed ejbClientConfiguration.

This constructor creates a EJBClientContext and uses the passed ejbClientConfiguration to create and associated EJB receivers to that context. If the passed ejbClientConfiguration is null, then this selector will create a EJBClientContext without any associated EJB receivers.

Parameters:
ejbClientConfiguration - The EJB client configuration to use

ConfigBasedEJBClientContextSelector

public ConfigBasedEJBClientContextSelector(EJBClientConfiguration ejbClientConfiguration,
                                           ClassLoader classLoader)
Creates a ConfigBasedEJBClientContextSelector using the passed ejbClientConfiguration.

This constructor creates a EJBClientContext and uses the passed ejbClientConfiguration to create and associated EJB receivers to that context. If the passed ejbClientConfiguration is null, then this selector will create a EJBClientContext without any associated EJB receivers.

Parameters:
ejbClientConfiguration - The EJB client configuration to use
classLoader - The classloader that will be used to create the EJBClientContext
Method Detail

getCurrent

public EJBClientContext getCurrent()
Description copied from interface: ContextSelector
Get the current instance, returning null if none are valid in the current context.

Specified by:
getCurrent in interface ContextSelector<EJBClientContext>
Returns:
the instance, or null if there is none

registerContext

public void registerContext(EJBClientContextIdentifier identifier,
                            EJBClientContext context)
Description copied from interface: IdentityEJBClientContextSelector
Associates the passed EJBClientContext to the identifier

It's up to the individual implementations to decide whether to throw an exception if there's already an EJBClientContext registered for the passed identifier

Specified by:
registerContext in interface IdentityEJBClientContextSelector
Parameters:
identifier - The EJB client context identifier
context - The EJB client context

unRegisterContext

public EJBClientContext unRegisterContext(EJBClientContextIdentifier identifier)
Description copied from interface: IdentityEJBClientContextSelector
Unregisters and returns a previously registered EJBClientContext, for the passed identifier. If no EJBClientContext was registered for the passed identifier, then this method returns null.

Specified by:
unRegisterContext in interface IdentityEJBClientContextSelector
Parameters:
identifier - The EJB client context identifier
Returns:
Returns the previously registered EJBClientContext if any. Else returns null.

getContext

public EJBClientContext getContext(EJBClientContextIdentifier identifier)
Description copied from interface: IdentityEJBClientContextSelector
Returns a context for the passed identifier. If there's no such context, then null is returned.

Specified by:
getContext in interface IdentityEJBClientContextSelector
Parameters:
identifier - Identity of the context. Cannot be null
Returns:
The context or null if no such context exists

JBoss EJB client 2.0.0.Beta4

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.