org.openejb.assembler
Class AssemblerTool

java.lang.Object
  extended byorg.openejb.assembler.AssemblerTool
Direct Known Subclasses:
Assembler

public class AssemblerTool
extends Object

This class provides a set of utility methods for constructing various artifacts in the container system from org.openejb.assembler configuration classes. This class is used as an independent tool or is extended to create specialized assemblers as is the case with the org.openejb.assembler.Assembler which bootstraps the core container system extracting the configuration from a single XML file and building the container system from a complete graph of conf objects. The methods in this class are not interdependent and other then a SafeToolKit variable they are stateless (the class has no instance variables).

See Also:
Assembler, Assembler, OpenEjbConfigurationFactory

Nested Class Summary
static class AssemblerTool.RoleMapping
          This class encapsulates a mapping between a collection of logical roles and each of those roles equivalent physical security roles in the target environment.
 
Field Summary
protected static HashMap codebases
           
static Class CONNECTION_MANAGER
           
static Class CONNECTOR
           
static Class CONTAINER
           
protected static Messages messages
           
static Class PROXY_FACTORY
           
static Class SECURITY_SERVICE
           
protected static SafeToolkit toolkit
           
static Class TRANSACTION_SERVICE
           
 
Constructor Summary
AssemblerTool()
           
 
Method Summary
 void applyMethodPermissions(CoreDeploymentInfo deployment, MethodPermissionInfo[] permissions)
          This method applies a set of method permissions to a deploymentInfo object, so that the container can verify that a specific physical security role has access to a specific method.
 void applyMethodPermissions(CoreDeploymentInfo deployment, MethodPermissionInfo[] permissions, AssemblerTool.RoleMapping roleMapping)
          This method applies a set of method permissions and RoleMapping to a deploymentInfo object, so that the container can verify that a specific physical security role has access to a specific method.
 void applyProperties(Object target, Properties props)
          This method will automatically attempt to invoke an init(Properties ) method on the target object, passing in the properties and an argument.
 void applyProxyFactory(IntraVmServerInfo ivmInfo)
          This method constructs a ProxyFactory from teh IntraVmServerInfo conf class and automatically registers that ProxyFactory with the ProxyManager as the default proxy.
 MethodPermissionInfo applyRoleMappings(MethodPermissionInfo methodPermission, AssemblerTool.RoleMapping roleMapping)
           
 void applySecurityRoleReference(CoreDeploymentInfo deployment, EnterpriseBeanInfo beanInfo, AssemblerTool.RoleMapping roleMapping)
          Maps the security role references used by enterprise beans to their associated physical in the target environment.
 void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo, MethodTransactionInfo[] mtis)
          This method applies the transaction attributed described by the collection of MethodTransactionInfo object to the org.openejb.core.DeploymentInfo objects.
 javax.resource.spi.ConnectionManager assembleConnectionManager(ConnectionManagerInfo cmInfo)
          This class will assemble a ConnectionManager instace from a ConnectionManagerInfo configuration object.
 Container assembleContainer(ContainerInfo containerInfo)
          This method can construct a Container of any kind based on information in the ContainerInfo object: StatefulContainer, StatelessContainer, or EntityContainer In addition to constructing the containers, this method also constructs all the deployments declared in the containerInfo object and adds them to the containers It constructs the deployment Info object using the assembleDeploymentInfo method.
 void assembleContainers(ContainerSystem containerSystem, ContainerSystemInfo containerSystemInfo)
          When given a complete ContainerSystemInfo object, this method, will construct all the containers (entity, stateful, stateless) and add those containers to the ContainerSystem.
 CoreDeploymentInfo assembleDeploymentInfo(EnterpriseBeanInfo beanInfo)
          This method assembles a org.openejb.core.DeploymentInfo object from a EnterpriseBeanInfo configuration object of anyone of three types: EntityBeanInfo, StatelessBeanInfo, or StatefulBeanInfo.
 javax.resource.spi.ManagedConnectionFactory assembleManagedConnectionFactory(ManagedConnectionFactoryInfo mngedConFactInfo)
          This method will assemble a ManagedConnectionFactory instance from a ManagedConnecitonFactoryInfo configuration object.
 InitialContext assembleRemoteJndiContext(JndiContextInfo context)
           
 SecurityService assembleSecurityService(SecurityServiceInfo securityInfo)
          This method assembles the SecurityService from the SecuirtyServiceInfo configuration object.
 TransactionManager assembleTransactionManager(TransactionServiceInfo txInfo)
          This method assembles the TransactionManager from the TransactionServiceInfo configuration object.
protected  void bindJndiBeanRefs(EnterpriseBeanInfo bean, IvmContext root)
           
protected  void bindJndiEnvEntries(EnterpriseBeanInfo bean, IvmContext root)
           
protected  void bindJndiResourceRefs(EnterpriseBeanInfo bean, IvmContext root)
           
protected  void checkImplementation(Class intrfce, Class factory, String serviceType, String serviceName)
           
protected  CoreDeploymentInfo createDeploymentInfoObject(Context root, String did, Class homeClass, Class remoteClass, Class beanClass, Class pkClass, byte componentType)
          This method creates the DeploymentInfo class and sets the JNDI context at the same time.
 void handleException(String errorCode)
           
 void handleException(String errorCode, Object arg0)
           
 void handleException(String errorCode, Object arg0, Object arg1)
           
 void handleException(String errorCode, Object arg0, Object arg1, Object arg2)
           
 void handleException(String errorCode, Object arg0, Object arg1, Object arg2, Object arg3)
           
 void logWarning(String errorCode)
           
 void logWarning(String errorCode, Object arg0)
           
 void logWarning(String errorCode, Object arg0, Object arg1)
           
 void logWarning(String errorCode, Object arg0, Object arg1, Object arg2)
           
 void logWarning(String errorCode, Object arg0, Object arg1, Object arg2, Object arg3)
           
protected  String prefixForBinding(String name)
           
protected  Method[] resolveMethodInfo(MethodInfo methodInfo, CoreDeploymentInfo di)
          Returns all the Method objects specified by a MethodInfo object for a specific bean deployment.
protected  void resolveMethods(Vector methods, Class intrface, MethodInfo mi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_FACTORY

public static final Class PROXY_FACTORY

SECURITY_SERVICE

public static final Class SECURITY_SERVICE

TRANSACTION_SERVICE

public static final Class TRANSACTION_SERVICE

CONTAINER

public static final Class CONTAINER

CONNECTION_MANAGER

public static final Class CONNECTION_MANAGER

CONNECTOR

public static final Class CONNECTOR

messages

protected static Messages messages

toolkit

protected static SafeToolkit toolkit

codebases

protected static HashMap codebases
Constructor Detail

AssemblerTool

public AssemblerTool()
Method Detail

assembleContainers

public void assembleContainers(ContainerSystem containerSystem,
                               ContainerSystemInfo containerSystemInfo)
                        throws Exception
When given a complete ContainerSystemInfo object, this method, will construct all the containers (entity, stateful, stateless) and add those containers to the ContainerSystem. The containers are constructed using the assembleContainer() method. Once constructed the container and its deployments are added to the container system. Assembles and returns a for the ContainerSystem using the information from the ContainerManagerInfo object passed in.

Parameters:
containerSystem - the system to which the container should be added.
containerSystemInfo - defines the contain system,its containers, and deployments.
Throws:
Exception - if there was a problem constructing the ContainerManager.
See Also:
ContainerSystem, ContainerManagerInfo

assembleContainer

public Container assembleContainer(ContainerInfo containerInfo)
                            throws OpenEJBException
This method can construct a Container of any kind based on information in the ContainerInfo object: StatefulContainer, StatelessContainer, or EntityContainer In addition to constructing the containers, this method also constructs all the deployments declared in the containerInfo object and adds them to the containers It constructs the deployment Info object using the assembleDeploymentInfo method.

Parameters:
containerInfo - describes a Container and its deployments.
Returns:
the Container that was constructed (StatefulContainer, StatelessContainer, EntityContainer)
Throws:
OpenEJBException
See Also:
ContainerInfo

assembleRemoteJndiContext

public InitialContext assembleRemoteJndiContext(JndiContextInfo context)
                                         throws OpenEJBException
Throws:
OpenEJBException

assembleDeploymentInfo

public CoreDeploymentInfo assembleDeploymentInfo(EnterpriseBeanInfo beanInfo)
                                          throws SystemException,
                                                 OpenEJBException
This method assembles a org.openejb.core.DeploymentInfo object from a EnterpriseBeanInfo configuration object of anyone of three types: EntityBeanInfo, StatelessBeanInfo, or StatefulBeanInfo. The DeploymentInfo object is not complete, its component type and transaction type (bean or container) is set and its JNDI ENC context is established with all its bean references, resource references, and environment entries, BUT its method permissions, security role references and transaction attribute method mapping are not established. These must be done in post processing using the methods applyMethodPermissions(), applySecurityRoleReferences() and applyTransactionAttributes()

Parameters:
beanInfo - describes the enterprise bean deployment to be assembled.
Throws:
SystemException
OpenEJBException

createDeploymentInfoObject

protected CoreDeploymentInfo createDeploymentInfoObject(Context root,
                                                        String did,
                                                        Class homeClass,
                                                        Class remoteClass,
                                                        Class beanClass,
                                                        Class pkClass,
                                                        byte componentType)
                                                 throws SystemException
This method creates the DeploymentInfo class and sets the JNDI context at the same time. This is done to enable the TyrexAssembler to override this method to hook in its own DeploymentInfo subclass without duplicating code.

Throws:
SystemException

assembleConnectionManager

public javax.resource.spi.ConnectionManager assembleConnectionManager(ConnectionManagerInfo cmInfo)
                                                               throws OpenEJBException,
                                                                      Exception
This class will assemble a ConnectionManager instace from a ConnectionManagerInfo configuration object.

Parameters:
cmInfo - describes the ConnectionManager to be assembled.
Returns:
the ConnectionManager instance assembled.
Throws:
OpenEJBException
Exception
See Also:
ConnectionManagerInfo

assembleManagedConnectionFactory

public javax.resource.spi.ManagedConnectionFactory assembleManagedConnectionFactory(ManagedConnectionFactoryInfo mngedConFactInfo)
                                                                             throws OpenEJBException,
                                                                                    Exception
This method will assemble a ManagedConnectionFactory instance from a ManagedConnecitonFactoryInfo configuration object.

Parameters:
mngedConFactInfo - describes the the ManagedConnectionFactory to be created.
Returns:
the ManagedConnecitonFactory assembled.
Throws:
OpenEJBException
Exception
See Also:
ManagedConnectionFactoryInfo

assembleSecurityService

public SecurityService assembleSecurityService(SecurityServiceInfo securityInfo)
                                        throws OpenEJBException,
                                               Exception
This method assembles the SecurityService from the SecuirtyServiceInfo configuration object.

Parameters:
securityInfo - describes the SecurityService to be assembled.
Returns:
the SecurityService object that was assembled.
Throws:
OpenEJBException
Exception
See Also:
SecurityServiceInfo

assembleTransactionManager

public TransactionManager assembleTransactionManager(TransactionServiceInfo txInfo)
                                              throws OpenEJBException,
                                                     Exception
This method assembles the TransactionManager from the TransactionServiceInfo configuration object.

Parameters:
txInfo - describes the TransactionService to be assembled. The Transaction manager is obtained from this service.
Returns:
the TranactionManager instance that was obtained from the assembled TransactionService
Throws:
OpenEJBException
Exception
See Also:
TransactionServiceInfo

applyProxyFactory

public void applyProxyFactory(IntraVmServerInfo ivmInfo)
                       throws OpenEJBException
This method constructs a ProxyFactory from teh IntraVmServerInfo conf class and automatically registers that ProxyFactory with the ProxyManager as the default proxy. Because of interedependices that require a proxy to be in place (specifically the creation of the OpenEJB JNDI global name space in the org.openejb.core.ContainerSystem class, this method should be processed before anything else is done in the deployment process.

Parameters:
ivmInfo - the IntraVmServerInfo configuration object that describes the ProxyFactory
Throws:
OpenEJBException
See Also:
IntraVmServerInfo

applyProperties

public void applyProperties(Object target,
                            Properties props)
                     throws InvocationTargetException,
                            IllegalAccessException,
                            NoSuchMethodException
This method will automatically attempt to invoke an init(Properties ) method on the target object, passing in the properties and an argument.

Parameters:
target - the object that will have its init(Properties) method invoked
props -
Throws:
InvocationTargetException
IllegalAccessException
NoSuchMethodException

applyTransactionAttributes

public void applyTransactionAttributes(CoreDeploymentInfo deploymentInfo,
                                       MethodTransactionInfo[] mtis)
This method applies the transaction attributed described by the collection of MethodTransactionInfo object to the org.openejb.core.DeploymentInfo objects. This method maps every method of the bean's remote and home interfaces (including remove() methods) to their assigned transaction attributes and then applies these mappings to the bean through the DeploymentInfo.setMethodTransationAttribute(). At run time the container will get the transaction attribute associated with a client call from the DeploymentInfo object by invoking its getTransactionAttribute(Method) method. See page 251 EJB 1.1 for an explanation of the method attribute.

Parameters:
deploymentInfo - the deployment to which the transaction attributes are applied
See Also:
MethodTransactionInfo

applySecurityRoleReference

public void applySecurityRoleReference(CoreDeploymentInfo deployment,
                                       EnterpriseBeanInfo beanInfo,
                                       AssemblerTool.RoleMapping roleMapping)
Maps the security role references used by enterprise beans to their associated physical in the target environment. Each security role reference is mapped to a logical role. The logical roles are themselves mapped to their respective physical role equivalents in the AssemblerTool.RoleMapping object.

Parameters:
deployment - the DeploymentInfo object to which the mapping should be applied.
beanInfo - the EnterpiseBeanInfo object which contains the securityRoleReferences
roleMapping - the RoleMapping object which contains the logical to physical security roles.
See Also:
EnterpriseBeanInfo, AssemblerTool.RoleMapping

applyMethodPermissions

public void applyMethodPermissions(CoreDeploymentInfo deployment,
                                   MethodPermissionInfo[] permissions)
This method applies a set of method permissions to a deploymentInfo object, so that the container can verify that a specific physical security role has access to a specific method. The method itself maps each of the physical security roles to a method and add this binding to the org.openejb.core.DeploymentInfo object by invoking its DeploymentInfo.appendMethodPermission() method. The roleNames of the MethodPermissionInfo object are assumed to be the physical names, not the logical names. If this is not the case then the MethodPermissionInfo object should be preprocessed by the applyRoleMapping( ) method, or the overloaded version of this method which takes a RoleMapping object should be used (both these strategies will map logical to physical roles).

Parameters:
deployment - the DeploymentInfo object to which the Method Permissions should be applied.
permissions - the Method Permission to be applied to the deployment.
See Also:
MethodPermissionInfo

applyMethodPermissions

public void applyMethodPermissions(CoreDeploymentInfo deployment,
                                   MethodPermissionInfo[] permissions,
                                   AssemblerTool.RoleMapping roleMapping)
This method applies a set of method permissions and RoleMapping to a deploymentInfo object, so that the container can verify that a specific physical security role has access to a specific method. The method itself maps each of the physical security roles to a method and adds this binding to the org.openejb.core.DeploymentInfo object by invoking its DeploymentInfo.appendMethodPermission() method. The roleNames of the MethodPermissionInfo object are assumed to be the logical names that corrspond to logical mappings in the RoleMappig object. If the MethodPermissionInfo object's roleMappings are actually physical role names then the overloaded version of this method which doesn't require a RoleMapping parameter should be used.

Parameters:
deployment - the DeploymentInfo object to which the Method Permissions should be applied.
permissions - the Method Permission to be applied to the deployment.
roleMapping - the encapsulation of logical roles and their corresponding physical role mappings.
See Also:
MethodPermissionInfo, AssemblerTool.RoleMapping

applyRoleMappings

public MethodPermissionInfo applyRoleMappings(MethodPermissionInfo methodPermission,
                                              AssemblerTool.RoleMapping roleMapping)

resolveMethodInfo

protected Method[] resolveMethodInfo(MethodInfo methodInfo,
                                     CoreDeploymentInfo di)
Returns all the Method objects specified by a MethodInfo object for a specific bean deployment.

See Also:
CoreDeploymentInfo, MethodInfo

resolveMethods

protected void resolveMethods(Vector methods,
                              Class intrface,
                              MethodInfo mi)
                       throws SecurityException
Throws:
SecurityException
See Also:
CoreDeploymentInfo, MethodInfo

bindJndiResourceRefs

protected void bindJndiResourceRefs(EnterpriseBeanInfo bean,
                                    IvmContext root)
                             throws OpenEJBException
Throws:
OpenEJBException

bindJndiBeanRefs

protected void bindJndiBeanRefs(EnterpriseBeanInfo bean,
                                IvmContext root)

bindJndiEnvEntries

protected void bindJndiEnvEntries(EnterpriseBeanInfo bean,
                                  IvmContext root)

prefixForBinding

protected String prefixForBinding(String name)

checkImplementation

protected void checkImplementation(Class intrfce,
                                   Class factory,
                                   String serviceType,
                                   String serviceName)
                            throws OpenEJBException
Throws:
OpenEJBException

handleException

public void handleException(String errorCode,
                            Object arg0,
                            Object arg1,
                            Object arg2,
                            Object arg3)
                     throws OpenEJBException
Throws:
OpenEJBException

handleException

public void handleException(String errorCode,
                            Object arg0,
                            Object arg1,
                            Object arg2)
                     throws OpenEJBException
Throws:
OpenEJBException

handleException

public void handleException(String errorCode,
                            Object arg0,
                            Object arg1)
                     throws OpenEJBException
Throws:
OpenEJBException

handleException

public void handleException(String errorCode,
                            Object arg0)
                     throws OpenEJBException
Throws:
OpenEJBException

handleException

public void handleException(String errorCode)
                     throws OpenEJBException
Throws:
OpenEJBException

logWarning

public void logWarning(String errorCode,
                       Object arg0,
                       Object arg1,
                       Object arg2,
                       Object arg3)

logWarning

public void logWarning(String errorCode,
                       Object arg0,
                       Object arg1,
                       Object arg2)

logWarning

public void logWarning(String errorCode,
                       Object arg0,
                       Object arg1)

logWarning

public void logWarning(String errorCode,
                       Object arg0)

logWarning

public void logWarning(String errorCode)


Copyright © 1999-2005 OpenEJB. All Rights Reserved.