org.jboss.ejb3.proxy.jndiregistrar
Class JndiSessionRegistrarBase

java.lang.Object
  extended by org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase
Direct Known Subclasses:
JndiStatefulSessionRegistrar, JndiStatelessSessionRegistrar

public abstract class JndiSessionRegistrarBase
extends java.lang.Object

JndiSessionRegistrarBase Responsible for binding of ObjectFactories and creation/registration of associated ProxyFactories, centralizing operations common to that of all Session EJB Implementations


Field Summary
static java.lang.String DEFAULT_CLIENT_BINDING
          The default URL for InvokerLocator in the case @RemoteBinding does not specify it
 
Constructor Summary
JndiSessionRegistrarBase(java.lang.String sessionProxyObjectFactoryType)
          Creates a JNDI Registrar from the specified configuration properties, none of which may be null.
 
Method Summary
protected  void bind(javax.naming.Context context, javax.naming.Reference ref, java.lang.String address, java.lang.String proxyFactoryRegistryKey, java.lang.String containerName)
          Binds the specified Reference into JNDI at the specified address, adding the requisite key for the ProxyFactory within the Registry and the requisite target EJB Container Name as ReferenceAddresses
 void bindEjb(javax.naming.Context context, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, java.lang.ClassLoader cl, java.lang.String containerName, java.lang.String containerGuid, org.jboss.aop.Advisor advisor)
          Binds into JNDI all appropriate objects required by the EJB described by the specified metadata.
protected abstract  SessionProxyFactory createLocalProxyFactory(java.lang.String name, java.lang.String containerName, java.lang.String containerGuid, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, java.lang.ClassLoader cl, org.jboss.aop.Advisor advisor)
          Creates and returns a new local proxy factory for this Session Bean
protected abstract  SessionProxyFactory createRemoteProxyFactory(java.lang.String name, java.lang.String containerName, java.lang.String containerGuid, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, java.lang.ClassLoader cl, java.lang.String url, org.jboss.aop.Advisor advisor)
          Creates and returns a new remote proxy factory for this Session Bean
protected  javax.naming.RefAddr createRemotingRefAddr(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd)
          Creates and returns a new RefAddr to flag the proper InvokerLocator URL used by remoting for the EJB represented by the specified metadata
protected  void deregisterProxyFactory(java.lang.String name)
          Deregisters the proxy factory with the specified name from the registry
protected  java.lang.String getHumanReadableListOfInterfacesInRefAddrs(java.util.List<javax.naming.RefAddr> refAddrs)
          Makes a comma-delimited list of interfaces bound for setting the Classname of the Reference.
 java.lang.String getProxyFactoryRegistryKey(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData md, boolean isLocal)
          Returns the name of the unique key under which a Proxy Factory will be registered.
 java.lang.String getSessionProxyObjectFactoryType()
           
protected  boolean isHomeAndBusinessBoundTogether(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, boolean isLocal)
          Returns whether the business interfaces and EJB2.x Home should be bound to the same JNDI Name
protected  void registerProxyFactory(java.lang.String name, ProxyFactory factory, org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData smd)
          Registers the specified proxy factory into the registry
 void setSessionProxyObjectFactoryType(java.lang.String sessionProxyObjectFactoryType)
           
protected  void unbind(javax.naming.Context context, java.lang.String address)
          Unbinds the specified address from JNDI
 void unbindEjb(javax.naming.Context context, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd)
          Unbinds from JNDI all appropriate objects registered by the EJB described by the specified metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CLIENT_BINDING

public static final java.lang.String DEFAULT_CLIENT_BINDING
The default URL for InvokerLocator in the case @RemoteBinding does not specify it

See Also:
Constant Field Values
Constructor Detail

JndiSessionRegistrarBase

public JndiSessionRegistrarBase(java.lang.String sessionProxyObjectFactoryType)
Creates a JNDI Registrar from the specified configuration properties, none of which may be null.

Parameters:
sessionProxyObjectFactoryType - String representation of the JNDI Object Factory Class Name (fully-qualified) to use for this Session EJB
Method Detail

bindEjb

public void bindEjb(javax.naming.Context context,
                    org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                    java.lang.ClassLoader cl,
                    java.lang.String containerName,
                    java.lang.String containerGuid,
                    org.jboss.aop.Advisor advisor)
Binds into JNDI all appropriate objects required by the EJB described by the specified metadata. Additionally responsible for creation and registration of any all ProxyFactory implementations required by the EJB

Parameters:
context - The JNDI Context to use for binding
smd -
cl - The CL of the Container
containerName - The name under which the target container is registered
containerGuid - The globally-unique name of the container
advisor - The advisor to use for generated proxies

unbindEjb

public void unbindEjb(javax.naming.Context context,
                      org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd)
Unbinds from JNDI all appropriate objects registered by the EJB described by the specified metadata. Additionally responsible for destruction and deregistration of any all ProxyFactory implementations required by the EJB

Parameters:
context - The JNDI Context to use for unbinding
smd -

createLocalProxyFactory

protected abstract SessionProxyFactory createLocalProxyFactory(java.lang.String name,
                                                               java.lang.String containerName,
                                                               java.lang.String containerGuid,
                                                               org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                               java.lang.ClassLoader cl,
                                                               org.jboss.aop.Advisor advisor)
Creates and returns a new local proxy factory for this Session Bean

Parameters:
name - The unique name for the ProxyFactory
containerName - The name of the Container upon which Proxies from the returned ProxyFactory will invoke
containerGuid - The globally-unique name of the container
smd - The metadata representing this Session EJB
cl - The ClassLoader for this EJB Container
advisor - The Advisor for proxies created by this factory

createRemoteProxyFactory

protected abstract SessionProxyFactory createRemoteProxyFactory(java.lang.String name,
                                                                java.lang.String containerName,
                                                                java.lang.String containerGuid,
                                                                org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                                java.lang.ClassLoader cl,
                                                                java.lang.String url,
                                                                org.jboss.aop.Advisor advisor)
Creates and returns a new remote proxy factory for this Session Bean

Parameters:
name - The unique name for the ProxyFactory
containerName - The name of the Container upon which Proxies from the returned ProxyFactory will invoke
containerGuid - The globally-unique name of the container
smd - The metadata representing this Session EJB
cl - The ClassLoader for this EJB Container
url - The URL to use for Remoting
advisor - The Advisor for proxies created by this factory

bind

protected void bind(javax.naming.Context context,
                    javax.naming.Reference ref,
                    java.lang.String address,
                    java.lang.String proxyFactoryRegistryKey,
                    java.lang.String containerName)
Binds the specified Reference into JNDI at the specified address, adding the requisite key for the ProxyFactory within the Registry and the requisite target EJB Container Name as ReferenceAddresses

Parameters:
context - The JNDI Context to use
ref -
address -
proxyFactoryRegistryKey - The key under which the proxy factory for this reference is stored in the proxy factory registry
containerName - The target container to be used in invocations from Proxies obtained from this address

unbind

protected void unbind(javax.naming.Context context,
                      java.lang.String address)
Unbinds the specified address from JNDI

Parameters:
context - The JNDI Context to use
address -

isHomeAndBusinessBoundTogether

protected boolean isHomeAndBusinessBoundTogether(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                 boolean isLocal)
Returns whether the business interfaces and EJB2.x Home should be bound to the same JNDI Name

Parameters:
smd -
isLocal -
Returns:

createRemotingRefAddr

protected javax.naming.RefAddr createRemotingRefAddr(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd)
Creates and returns a new RefAddr to flag the proper InvokerLocator URL used by remoting for the EJB represented by the specified metadata

Parameters:
smd -
Returns:

getProxyFactoryRegistryKey

public java.lang.String getProxyFactoryRegistryKey(org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData md,
                                                   boolean isLocal)
Returns the name of the unique key under which a Proxy Factory will be registered. Will follow form: (jndiName)/ProxyFactory/ ...depending upon the specified "isLocal" flag

Parameters:
md -
isLocal -

getHumanReadableListOfInterfacesInRefAddrs

protected java.lang.String getHumanReadableListOfInterfacesInRefAddrs(java.util.List<javax.naming.RefAddr> refAddrs)
Makes a comma-delimited list of interfaces bound for setting the Classname of the Reference. This will show up in JNDIView and make it clear to application developers what will be castable from the lookup result

Parameters:
refAddrs -
Returns:

registerProxyFactory

protected void registerProxyFactory(java.lang.String name,
                                    ProxyFactory factory,
                                    org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData smd)
Registers the specified proxy factory into the registry

Parameters:
name - The unique name for the ProxyFactory
factory -
smd - Metadata describing the EJB

deregisterProxyFactory

protected void deregisterProxyFactory(java.lang.String name)
Deregisters the proxy factory with the specified name from the registry

Parameters:
name -

getSessionProxyObjectFactoryType

public java.lang.String getSessionProxyObjectFactoryType()

setSessionProxyObjectFactoryType

public void setSessionProxyObjectFactoryType(java.lang.String sessionProxyObjectFactoryType)