org.openejb.alt.assembler.classic
Class AssemblerTool

java.lang.Object
  extended by org.openejb.alt.assembler.classic.AssemblerTool
Direct Known Subclasses:
Assembler

public class AssemblerTool
extends java.lang.Object

This class provides a set of utility methods for constructing various artifacts in the container system from org.openejb.alt.assembler.classic 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.alt.assembler.classic.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).

Author:
David Blevins, Richard Monson-Haefel
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 java.util.HashMap codebases
           
static java.lang.Class CONNECTION_MANAGER
           
static java.lang.Class CONNECTOR
           
protected static Messages messages
          A mutable static field could be changed by malicious code or by accident from another package.
protected  java.util.Properties props
           
static java.lang.Class PROXY_FACTORY
           
static java.lang.Class SECURITY_SERVICE
           
protected static SafeToolkit toolkit
           
static java.lang.Class TRANSACTION_SERVICE
           
 
Constructor Summary
AssemblerTool()
           
 
Method Summary
 void applyMethodPermissions(DeploymentInfo 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(DeploymentInfo 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(java.lang.Object target, java.util.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(DeploymentInfo 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(DeploymentInfo 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.
 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.
 javax.resource.spi.ManagedConnectionFactory assembleManagedConnectionFactory(ManagedConnectionFactoryInfo mngedConFactInfo)
          This method will assemble a ManagedConnectionFactory instance from a ManagedConnecitonFactoryInfo configuration object.
 javax.naming.InitialContext assembleRemoteJndiContext(JndiContextInfo context)
           
 SecurityService assembleSecurityService(SecurityServiceInfo securityInfo)
          This method assembles the SecurityService from the SecuirtyServiceInfo configuration object.
 javax.transaction.TransactionManager assembleTransactionManager(TransactionServiceInfo txInfo)
          This method assembles the TransactionManager from the TransactionServiceInfo configuration object.
protected  void checkImplementation(java.lang.Class intrfce, java.lang.Class factory, java.lang.String serviceType, java.lang.String serviceName)
           
 void handleException(java.lang.String errorCode)
           
 void handleException(java.lang.String errorCode, java.lang.Object arg0)
           
 void handleException(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1)
           
 void handleException(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
           
 void handleException(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
 void logWarning(java.lang.String errorCode)
           
 void logWarning(java.lang.String errorCode, java.lang.Object arg0)
           
 void logWarning(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1)
           
 void logWarning(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
           
 void logWarning(java.lang.String errorCode, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
protected  java.lang.reflect.Method[] resolveMethodInfo(MethodInfo methodInfo, DeploymentInfo di)
          Returns all the Method objects specified by a MethodInfo object for a specific bean deployment.
protected static void resolveMethods(java.util.Vector methods, java.lang.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 java.lang.Class PROXY_FACTORY

SECURITY_SERVICE

public static final java.lang.Class SECURITY_SERVICE

TRANSACTION_SERVICE

public static final java.lang.Class TRANSACTION_SERVICE

CONNECTION_MANAGER

public static final java.lang.Class CONNECTION_MANAGER

CONNECTOR

public static final java.lang.Class CONNECTOR

messages

protected static final Messages messages
A mutable static field could be changed by malicious code or by accident from another package. The field could be made final to avoid this vulnerability.


toolkit

protected static final SafeToolkit toolkit

codebases

protected static final java.util.HashMap codebases

props

protected java.util.Properties props
Constructor Detail

AssemblerTool

public AssemblerTool()
Method Detail

assembleContainers

public void assembleContainers(ContainerSystem containerSystem,
                               ContainerSystemInfo containerSystemInfo)
                        throws java.lang.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.

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

assembleRemoteJndiContext

public javax.naming.InitialContext assembleRemoteJndiContext(JndiContextInfo context)
                                                      throws OpenEJBException
Throws:
OpenEJBException

assembleConnectionManager

public javax.resource.spi.ConnectionManager assembleConnectionManager(ConnectionManagerInfo cmInfo)
                                                               throws OpenEJBException,
                                                                      java.lang.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
java.lang.Exception
See Also:
ConnectionManagerInfo

assembleManagedConnectionFactory

public javax.resource.spi.ManagedConnectionFactory assembleManagedConnectionFactory(ManagedConnectionFactoryInfo mngedConFactInfo)
                                                                             throws OpenEJBException,
                                                                                    java.lang.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
java.lang.Exception
See Also:
ManagedConnectionFactoryInfo

assembleSecurityService

public SecurityService assembleSecurityService(SecurityServiceInfo securityInfo)
                                        throws OpenEJBException,
                                               java.lang.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
java.lang.Exception
See Also:
SecurityServiceInfo

assembleTransactionManager

public javax.transaction.TransactionManager assembleTransactionManager(TransactionServiceInfo txInfo)
                                                                throws OpenEJBException,
                                                                       java.lang.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
java.lang.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(java.lang.Object target,
                            java.util.Properties props)
                     throws java.lang.reflect.InvocationTargetException,
                            java.lang.IllegalAccessException,
                            java.lang.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:
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.NoSuchMethodException

applyTransactionAttributes

public void applyTransactionAttributes(DeploymentInfo 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
mtis - describes the transaction attributes for the enterprise bean(s)
See Also:
MethodTransactionInfo

applySecurityRoleReference

public void applySecurityRoleReference(DeploymentInfo 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, DeploymentInfo.addSecurityRoleReference(String, String[])

applyMethodPermissions

public void applyMethodPermissions(DeploymentInfo 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, DeploymentInfo.appendMethodPermissions(java.lang.reflect.Method, String[])

applyMethodPermissions

public void applyMethodPermissions(DeploymentInfo 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, DeploymentInfo.appendMethodPermissions(java.lang.reflect.Method, String[])

applyRoleMappings

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

resolveMethodInfo

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

See Also:
DeploymentInfo, MethodInfo

resolveMethods

protected static void resolveMethods(java.util.Vector methods,
                                     java.lang.Class intrface,
                                     MethodInfo mi)
                              throws java.lang.SecurityException
Throws:
java.lang.SecurityException
See Also:
DeploymentInfo, MethodInfo

checkImplementation

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

handleException

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

handleException

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

handleException

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

handleException

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

handleException

public void handleException(java.lang.String errorCode)
                     throws OpenEJBException
Throws:
OpenEJBException

logWarning

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

logWarning

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

logWarning

public void logWarning(java.lang.String errorCode,
                       java.lang.Object arg0,
                       java.lang.Object arg1)

logWarning

public void logWarning(java.lang.String errorCode,
                       java.lang.Object arg0)

logWarning

public void logWarning(java.lang.String errorCode)


Copyright © 1999-2011 OpenEJB. All Rights Reserved.