org.jboss.ejb3.proxy.impl.jndiregistrar
Class JndiSessionRegistrarBase

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

public abstract class JndiSessionRegistrarBase
extends Object

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

Version:
$Revision: $
Author:
ALR

Constructor Summary
JndiSessionRegistrarBase(String sessionProxyObjectFactoryType)
          Creates a JNDI Registrar from the specified configuration properties, none of which may be null.
 
Method Summary
protected  void bind(Context context, JndiReferenceBinding binding, boolean useRebind)
           
protected  void bind(Context context, JndiReferenceBindingSet bindings, boolean useRebind, boolean bindLocals)
           
protected  void bind(Context context, String address, Reference ref)
          Binds the specified Reference into JNDI at the specified address
 void bindEjb(Context context, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, ClassLoader cl, String containerName, String containerGuid, org.jboss.aop.Advisor advisor)
          Binds into JNDI all appropriate objects required by the EJB described by the specified metadata.
protected  JndiReferenceBindingSet createJndiReferenceBindingSet(Context context, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, ClassLoader cl, String containerName, String containerGuid, org.jboss.aop.Advisor advisor)
          Creates all of the Reference objects that should be bound in JNDI for the EJB, and determines the correct JNDI name for each.
protected abstract  ProxyFactory createLocalProxyFactory(String name, String containerName, String containerGuid, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, ClassLoader cl, org.jboss.aop.Advisor advisor)
          Creates and returns a new local proxy factory for this Session Bean
protected abstract  ProxyFactory createRemoteProxyFactory(String name, String containerName, String containerGuid, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, ClassLoader cl, String url, org.jboss.aop.Advisor advisor, String interceptorStackName)
          Creates and returns a new remote proxy factory for this Session Bean
protected  RefAddr createRemotingRefAddr(String clientBindUrl)
          Creates and returns a new RefAddr to flag the proper InvokerLocator URL used by remoting for the EJB represented by the specified metadata
protected  Reference createStandardReference(String referenceName, String proxyFactoryRegistryKey, String containerName, boolean isLocal)
          Creates a new Reference whose classname is the given referenceName and whose classFactory is getSessionProxyObjectFactoryType(), adding the requisite Registry key for the ProxyFactory and the requisite target EJB Container Name as ReferenceAddresses.
protected  void deregisterProxyFactory(String name)
          Deregisters the proxy factory with the specified name from the registry
protected  String getHumanReadableListOfInterfacesInRefAddrs(List<RefAddr> refAddrs)
          Makes a comma-delimited list of interfaces bound for setting the Classname of the Reference.
 String getProxyFactoryRegistryKey(String jndiName, org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd, boolean isLocal)
          Returns the name of the unique key under which a Proxy Factory will be registered.
 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 rebind(Context context, String address, Reference ref)
          Re-binds the specified Reference into JNDI at the specified address
protected  void registerProxyFactory(String name, ProxyFactory factory, org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData smd)
          Registers the specified proxy factory into the registry
 void setSessionProxyObjectFactoryType(String sessionProxyObjectFactoryType)
           
protected  void unbind(Context context, String address)
          Unbinds the specified address from JNDI
 void unbindEjb(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
 

Constructor Detail

JndiSessionRegistrarBase

public JndiSessionRegistrarBase(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(Context context,
                    org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                    ClassLoader cl,
                    String containerName,
                    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 - the Container's metadata
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

createJndiReferenceBindingSet

protected JndiReferenceBindingSet createJndiReferenceBindingSet(Context context,
                                                                org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                                ClassLoader cl,
                                                                String containerName,
                                                                String containerGuid,
                                                                org.jboss.aop.Advisor advisor)
Creates all of the Reference objects that should be bound in JNDI for the EJB, and determines the correct JNDI name for each. Additionally responsible for creation and registration of any all ProxyFactory implementations required by the EJB.

Parameters:
smd - the Container's metadata
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
Returns:
data object encapsulating the references and their JNDI names

unbindEjb

public void unbindEjb(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 ProxyFactory createLocalProxyFactory(String name,
                                                        String containerName,
                                                        String containerGuid,
                                                        org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                        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 ProxyFactory createRemoteProxyFactory(String name,
                                                         String containerName,
                                                         String containerGuid,
                                                         org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                                         ClassLoader cl,
                                                         String url,
                                                         org.jboss.aop.Advisor advisor,
                                                         String interceptorStackName)
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
interceptorStackName - The name of the client-side interceptor stack to use. If null the default will apply.

createStandardReference

protected Reference createStandardReference(String referenceName,
                                            String proxyFactoryRegistryKey,
                                            String containerName,
                                            boolean isLocal)
Creates a new Reference whose classname is the given referenceName and whose classFactory is getSessionProxyObjectFactoryType(), adding the requisite Registry key for the ProxyFactory and the requisite target EJB Container Name as ReferenceAddresses.


bind

protected void bind(Context context,
                    JndiReferenceBindingSet bindings,
                    boolean useRebind,
                    boolean bindLocals)

bind

protected void bind(Context context,
                    JndiReferenceBinding binding,
                    boolean useRebind)

bind

protected void bind(Context context,
                    String address,
                    Reference ref)
Binds the specified Reference into JNDI at the specified address

Parameters:
context - The JNDI Context to use
address - the address
ref - the reference to bind

rebind

protected void rebind(Context context,
                      String address,
                      Reference ref)
Re-binds the specified Reference into JNDI at the specified address

Parameters:
context - The JNDI Context to use
address - the address
object - the object to bind

unbind

protected void unbind(Context context,
                      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 RefAddr createRemotingRefAddr(String clientBindUrl)
Creates and returns a new RefAddr to flag the proper InvokerLocator URL used by remoting for the EJB represented by the specified metadata

Parameters:
clientBindUrl -
Returns:

getProxyFactoryRegistryKey

public String getProxyFactoryRegistryKey(String jndiName,
                                         org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData smd,
                                         boolean isLocal)
Returns the name of the unique key under which a Proxy Factory will be registered. Will follow form: ProxyFactory/{ejbName}/{jndiName}

Parameters:
jndiName -
smd -
isLocal -

getHumanReadableListOfInterfacesInRefAddrs

protected String getHumanReadableListOfInterfacesInRefAddrs(List<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(String name,
                                    ProxyFactory factory,
                                    org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData smd)
                             throws org.jboss.ejb3.common.registrar.spi.DuplicateBindException
Registers the specified proxy factory into the registry

Parameters:
name - The unique name for the ProxyFactory
factory -
smd - Metadata describing the EJB
Throws:
org.jboss.ejb3.common.registrar.spi.DuplicateBindException

deregisterProxyFactory

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

Parameters:
name -

getSessionProxyObjectFactoryType

public String getSessionProxyObjectFactoryType()

setSessionProxyObjectFactoryType

public void setSessionProxyObjectFactoryType(String sessionProxyObjectFactoryType)


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.