org.objectweb.easybeans.deployer
Class JOnASDeployer

java.lang.Object
  extended by org.objectweb.easybeans.deployer.AbsDeployer
      extended by org.objectweb.easybeans.deployer.JOnASDeployer
All Implemented Interfaces:
EZBDeployer

public class JOnASDeployer
extends AbsDeployer
implements EZBDeployer

Implementation of the Deployer for EasyBeans in JOnAS.
It will deploy EJB3 and EAR. EJB21 of the EAR will go in JOnAS, EJB3 in EasyBeans, War in JOnAS, Rar in JOnAS.

Author:
Florent Benoit

Field Summary
private static java.lang.String CHECK_GENIC_METHODNAME
          checkGenIC method on the EJB 2.1 service.
private  java.lang.reflect.Method checkGenICMethod
          Reference to the checkGenIC method of EJB 2.1 service.
private static java.lang.String CLIENTMANAGERWRAPPER_CLASS
          JOnAS Client Manager Wrapper class.
private static java.lang.String CLIENTMANAGERWRAPPER_SETALTDD_METHODNAME
          JOnAS Client manager setAltDD method.
private  java.lang.reflect.Method clientSetAltDD
          setAltDD method on Client manager.
private  java.lang.reflect.Method deployMethodejb21Service
          Reference to the deploy method of EJB 2.1 service.
private  java.lang.reflect.Method deployMethodRarService
          Reference to the deploy method of rar service.
private  java.lang.reflect.Method deployMethodwarService
          Reference to the deploy method of war service.
private  java.lang.Object ejb21Service
          Reference to the JOnAS EJB 2.1 Service.
private static java.lang.String EJBMANAGERWRAPPER_CLASS
          JOnAS EJB Manager Wrapper class.
private static java.lang.String EJBMANAGERWRAPPER_SETAVAILABLE_METHODNAME
          JOnAS EJB manager setAvailable method.
private static java.lang.String EJBSERVICE_DEPLOY_METHODNAME
          deploy method on the EJB 2.1 service.
private static java.lang.String EJBSERVICE_UNDEPLOY_METHODNAME
          deploy method on the EJB 2.1 service.
private  java.lang.reflect.Method ejbSetAltDD
          setAltDD method on EJB manager.
private static java.lang.String JCLASSLOADER_CLASS
          JOnAS JClassLoader class.
private  java.lang.reflect.Constructor jClassLoaderConstructor
          Classloader used by JOnAS.
private static JLog logger
          Logger.
private  java.lang.Object rarService
          Reference to the JOnAS Resource Service.
private static java.lang.String RARSERVICE_DEPLOY_METHODNAME
          deploy method on the RAR service.
private static java.lang.String RARSERVICE_UNDEPLOY_METHODNAME
          undeploy method on the RAR service.
private static java.lang.String SERVICE_MANAGER_CLASS
          JOnAS service manager class.
private static java.lang.String SERVICE_MANAGER_GETEJBSERVICE_METHODNAME
          JOnAS service manager getEjbService() method name.
private static java.lang.String SERVICE_MANAGER_GETINSTANCE_METHODNAME
          JOnAS service manager getInstance() method name.
private static java.lang.String SERVICE_MANAGER_GETRARSERVICE_METHODNAME
          JOnAS service manager getRarService() method name.
private static java.lang.String SERVICE_MANAGER_GETWEBCONTAINERSERVICE_METHODNAME
          JOnAS service manager getWebContainerService() method name.
private  java.lang.Object serviceManager
          Reference to the JOnAS service manager.
private  java.lang.reflect.Method undeployMethodejb21Service
          Reference to the undeploy method of EJB 2.1 service.
private  java.lang.reflect.Method undeployMethodRarService
          Reference to the undeploy method of rar service.
private  java.lang.reflect.Method undeployMethodwarService
          Reference to the undeploy method of war service.
private  java.lang.Object warService
          Reference to the JOnAS Web Service.
private static java.lang.String WARSERVICE_DEPLOY_METHODNAME
          deploy method on the Web container service.
private static java.lang.String WARSERVICE_UNDEPLOY_METHODNAME
          undeploy method on the Web container service.
private static java.lang.String WEBMANAGERWRAPPER_CLASS
          JOnAS WEB Manager Wrapper class.
private static java.lang.String WEBMANAGERWRAPPER_SETALTDD_METHODNAME
          JOnAS WEB manager setAltDD method.
private  java.lang.reflect.Method webSetAltDD
          setAltDD method on Web manager.
 
Fields inherited from class org.objectweb.easybeans.deployer.AbsDeployer
DEFAULT_FOLDER
 
Constructor Summary
JOnASDeployer()
          Build a new instance of this deployer.
 
Method Summary
private  void addEjbContextIdToList(EARDeployable earDeployable, java.util.List<java.lang.String> contextIDs, boolean resetPolicyConfiguration)
          Add context-id for given jar urls to a given List.
private  void addWebBContextIdToList(EARDeployable earDeployable, java.util.List<java.lang.String> contextIDs, boolean resetPolicyConfiguration)
          Add context-id for given web urls to a given List.
private  void checkSupportedDeployable(EZBDeployable deployable)
          Check that the given deployable is supported by this deployer.
private  void commitEJBPolicyObjects(EARDeployable earDeployable)
          Commit policy configuration objects of EJB Component.
private  void commitPolicyObjects(java.util.List ctxIDs)
          Commit policy context IDs of the given list.
private  void commitWebBPolicyObjects(EARDeployable earDeployable)
          Commit policy configuration objects of Web Component.
 void deploy(EZBDeployable deployable)
          Deploy a deployable.
protected  void deployEAR(EARDeployable earDeployable)
          Deploy an EAR (called by the deploy method).
protected  void deployEJB21s(EARDeployable earDeployable, java.net.URL earURL, java.net.URLClassLoader earClassLoader, java.lang.ClassLoader ejbClassLoader)
          Deploy the EJB 2.1 of the given EAR.
protected  void deployRARs(EARDeployable earDeployable, java.net.URL earURL, java.lang.ClassLoader earClassLoader)
          Deploy the RARs of the given EAR.
protected  void deployWARs(EARDeployable earDeployable, java.net.URL earURL, java.lang.ClassLoader earClassLoader, java.lang.ClassLoader parentClassLoader)
          Deploy the WAR files present in the given EAR.
private  javax.security.jacc.PolicyConfigurationFactory getPolicyConfigurationFactory()
           
private  void linkPolicyObjects(EARDeployable earDeployable)
          Link policy configuration objects of EJB and Web Component.
 void undeploy(EZBDeployable deployable)
          Undeploy the given deployable.
protected  void undeployEAR(EARDeployable tmpEARDeployable)
          Undeploy an EAR (called by the undeploy method).
 
Methods inherited from class org.objectweb.easybeans.deployer.AbsDeployer
deployEJB, getClassLoaderForEAR, getEmbedded, getMethod, getPersistenceUnitManager, invoke, loadClass, loadClass, newInstance, newInstance, setEmbedded, undeployEJB3FromEAR, unpackEARDeployable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.easybeans.deployer.api.EZBDeployer
setEmbedded
 

Field Detail

logger

private static JLog logger
Logger.


JCLASSLOADER_CLASS

private static final java.lang.String JCLASSLOADER_CLASS
JOnAS JClassLoader class.

See Also:
Constant Field Values

SERVICE_MANAGER_CLASS

private static final java.lang.String SERVICE_MANAGER_CLASS
JOnAS service manager class.

See Also:
Constant Field Values

EJBMANAGERWRAPPER_CLASS

private static final java.lang.String EJBMANAGERWRAPPER_CLASS
JOnAS EJB Manager Wrapper class.

See Also:
Constant Field Values

WEBMANAGERWRAPPER_CLASS

private static final java.lang.String WEBMANAGERWRAPPER_CLASS
JOnAS WEB Manager Wrapper class.

See Also:
Constant Field Values

CLIENTMANAGERWRAPPER_CLASS

private static final java.lang.String CLIENTMANAGERWRAPPER_CLASS
JOnAS Client Manager Wrapper class.

See Also:
Constant Field Values

EJBMANAGERWRAPPER_SETAVAILABLE_METHODNAME

private static final java.lang.String EJBMANAGERWRAPPER_SETAVAILABLE_METHODNAME
JOnAS EJB manager setAvailable method.

See Also:
Constant Field Values

WEBMANAGERWRAPPER_SETALTDD_METHODNAME

private static final java.lang.String WEBMANAGERWRAPPER_SETALTDD_METHODNAME
JOnAS WEB manager setAltDD method.

See Also:
Constant Field Values

CLIENTMANAGERWRAPPER_SETALTDD_METHODNAME

private static final java.lang.String CLIENTMANAGERWRAPPER_SETALTDD_METHODNAME
JOnAS Client manager setAltDD method.

See Also:
Constant Field Values

SERVICE_MANAGER_GETINSTANCE_METHODNAME

private static final java.lang.String SERVICE_MANAGER_GETINSTANCE_METHODNAME
JOnAS service manager getInstance() method name.

See Also:
Constant Field Values

SERVICE_MANAGER_GETEJBSERVICE_METHODNAME

private static final java.lang.String SERVICE_MANAGER_GETEJBSERVICE_METHODNAME
JOnAS service manager getEjbService() method name.

See Also:
Constant Field Values

SERVICE_MANAGER_GETWEBCONTAINERSERVICE_METHODNAME

private static final java.lang.String SERVICE_MANAGER_GETWEBCONTAINERSERVICE_METHODNAME
JOnAS service manager getWebContainerService() method name.

See Also:
Constant Field Values

SERVICE_MANAGER_GETRARSERVICE_METHODNAME

private static final java.lang.String SERVICE_MANAGER_GETRARSERVICE_METHODNAME
JOnAS service manager getRarService() method name.

See Also:
Constant Field Values

CHECK_GENIC_METHODNAME

private static final java.lang.String CHECK_GENIC_METHODNAME
checkGenIC method on the EJB 2.1 service.

See Also:
Constant Field Values

EJBSERVICE_DEPLOY_METHODNAME

private static final java.lang.String EJBSERVICE_DEPLOY_METHODNAME
deploy method on the EJB 2.1 service.

See Also:
Constant Field Values

EJBSERVICE_UNDEPLOY_METHODNAME

private static final java.lang.String EJBSERVICE_UNDEPLOY_METHODNAME
deploy method on the EJB 2.1 service.

See Also:
Constant Field Values

RARSERVICE_DEPLOY_METHODNAME

private static final java.lang.String RARSERVICE_DEPLOY_METHODNAME
deploy method on the RAR service.

See Also:
Constant Field Values

RARSERVICE_UNDEPLOY_METHODNAME

private static final java.lang.String RARSERVICE_UNDEPLOY_METHODNAME
undeploy method on the RAR service.

See Also:
Constant Field Values

WARSERVICE_DEPLOY_METHODNAME

private static final java.lang.String WARSERVICE_DEPLOY_METHODNAME
deploy method on the Web container service.

See Also:
Constant Field Values

WARSERVICE_UNDEPLOY_METHODNAME

private static final java.lang.String WARSERVICE_UNDEPLOY_METHODNAME
undeploy method on the Web container service.

See Also:
Constant Field Values

serviceManager

private java.lang.Object serviceManager
Reference to the JOnAS service manager.


ejb21Service

private java.lang.Object ejb21Service
Reference to the JOnAS EJB 2.1 Service.


warService

private java.lang.Object warService
Reference to the JOnAS Web Service.


deployMethodwarService

private java.lang.reflect.Method deployMethodwarService
Reference to the deploy method of war service.


undeployMethodwarService

private java.lang.reflect.Method undeployMethodwarService
Reference to the undeploy method of war service.


deployMethodejb21Service

private java.lang.reflect.Method deployMethodejb21Service
Reference to the deploy method of EJB 2.1 service.


undeployMethodejb21Service

private java.lang.reflect.Method undeployMethodejb21Service
Reference to the undeploy method of EJB 2.1 service.


checkGenICMethod

private java.lang.reflect.Method checkGenICMethod
Reference to the checkGenIC method of EJB 2.1 service.


rarService

private java.lang.Object rarService
Reference to the JOnAS Resource Service.


deployMethodRarService

private java.lang.reflect.Method deployMethodRarService
Reference to the deploy method of rar service.


undeployMethodRarService

private java.lang.reflect.Method undeployMethodRarService
Reference to the undeploy method of rar service.


jClassLoaderConstructor

private java.lang.reflect.Constructor jClassLoaderConstructor
Classloader used by JOnAS.


ejbSetAltDD

private java.lang.reflect.Method ejbSetAltDD
setAltDD method on EJB manager.


webSetAltDD

private java.lang.reflect.Method webSetAltDD
setAltDD method on Web manager.


clientSetAltDD

private java.lang.reflect.Method clientSetAltDD
setAltDD method on Client manager.

Constructor Detail

JOnASDeployer

public JOnASDeployer()
              throws EZBDeployerException
Build a new instance of this deployer.

Throws:
EZBDeployerException - if the instance is not built.
Method Detail

deploy

public void deploy(EZBDeployable deployable)
            throws EZBDeployerException
Deploy a deployable. It can be an EJB jar, EAR, WAR, etc.

Specified by:
deploy in interface EZBDeployer
Parameters:
deployable - a given deployable
Throws:
EZBDeployerException - if the deployment is not done.

undeploy

public void undeploy(EZBDeployable deployable)
              throws EZBDeployerException
Undeploy the given deployable. It can be an EJB jar, EAR, WAR, etc.

Specified by:
undeploy in interface EZBDeployer
Parameters:
deployable - a given deployable to undeploy
Throws:
EZBDeployerException - if the undeploy operation fails.

undeployEAR

protected void undeployEAR(EARDeployable tmpEARDeployable)
                    throws EZBDeployerException
Undeploy an EAR (called by the undeploy method).

Parameters:
tmpEARDeployable - a given EAR deployable
Throws:
EZBDeployerException - if the undeployment is not done.

deployEAR

protected void deployEAR(EARDeployable earDeployable)
                  throws EZBDeployerException
Deploy an EAR (called by the deploy method).

Parameters:
earDeployable - a given EAR deployable
Throws:
EZBDeployerException - if the deployment is not done.

deployWARs

protected void deployWARs(EARDeployable earDeployable,
                          java.net.URL earURL,
                          java.lang.ClassLoader earClassLoader,
                          java.lang.ClassLoader parentClassLoader)
                   throws EZBDeployerException
Deploy the WAR files present in the given EAR.

Parameters:
earDeployable - the EAR containing the WARs
earURL - the EAR URL
earClassLoader - the EAR classloader
parentClassLoader - the parent classloader (EJB) to use
Throws:
EZBDeployerException - if the wars are not deployed.

deployRARs

protected void deployRARs(EARDeployable earDeployable,
                          java.net.URL earURL,
                          java.lang.ClassLoader earClassLoader)
                   throws EZBDeployerException
Deploy the RARs of the given EAR.

Parameters:
earDeployable - the EAR that contains the war files
earURL - the URL of the EAR
earClassLoader - the classloader of the EAR
Throws:
EZBDeployerException - if the RARs file can't be deployed

deployEJB21s

protected void deployEJB21s(EARDeployable earDeployable,
                            java.net.URL earURL,
                            java.net.URLClassLoader earClassLoader,
                            java.lang.ClassLoader ejbClassLoader)
                     throws EZBDeployerException
Deploy the EJB 2.1 of the given EAR.

Parameters:
earDeployable - the EAR that contains the EJB files
earURL - the URL of the EAR
earClassLoader - the classloader of the EAR
ejbClassLoader - the given EJB ClassLoader
Throws:
EZBDeployerException - if the EJB 2.1 filse can't be deployed

checkSupportedDeployable

private void checkSupportedDeployable(EZBDeployable deployable)
                               throws EZBDeployerException
Check that the given deployable is supported by this deployer. If it is not supported, throw an error.

Parameters:
deployable - the deployable that needs to be deployed
Throws:
EZBDeployerException - if this deployable is not supported.

linkPolicyObjects

private void linkPolicyObjects(EARDeployable earDeployable)
                        throws EZBDeployerException
Link policy configuration objects of EJB and Web Component.

Parameters:
earDeployable - the EAR that contains the EJB files
Throws:
EZBDeployerException - if the policy objects can't be linked

addEjbContextIdToList

private void addEjbContextIdToList(EARDeployable earDeployable,
                                   java.util.List<java.lang.String> contextIDs,
                                   boolean resetPolicyConfiguration)
                            throws EZBDeployerException
Add context-id for given jar urls to a given List.

Parameters:
earDeployable - the EAR deployable to analyze
contextIDs - the list of context-id.
resetPolicyConfiguration - reset or not the associated policy configuration.
Throws:
EZBDeployerException - if the EAR can't be analyzed

addWebBContextIdToList

private void addWebBContextIdToList(EARDeployable earDeployable,
                                    java.util.List<java.lang.String> contextIDs,
                                    boolean resetPolicyConfiguration)
                             throws EZBDeployerException
Add context-id for given web urls to a given List. Also, reset the context-id associated to it. *

Parameters:
earDeployable - the EAR deployable to analyze
contextIDs - the list of context-id.
resetPolicyConfiguration - reset or not the associated policy configuration.
Throws:
EZBDeployerException - if policy context cannot be get.

commitEJBPolicyObjects

private void commitEJBPolicyObjects(EARDeployable earDeployable)
                             throws EZBDeployerException
Commit policy configuration objects of EJB Component.

Parameters:
earDeployable - the EAR to analyze
Throws:
EZBDeployerException - if the policy objects can't be committed

commitWebBPolicyObjects

private void commitWebBPolicyObjects(EARDeployable earDeployable)
                              throws EZBDeployerException
Commit policy configuration objects of Web Component.

Parameters:
earDeployable - the EAR to analyze
Throws:
EZBDeployerException - if the policy objects can't be committed

getPolicyConfigurationFactory

private javax.security.jacc.PolicyConfigurationFactory getPolicyConfigurationFactory()
                                                                              throws EZBDeployerException
Returns:
policy configuration factory
Throws:
EZBDeployerException - if the policy configuration factory cannot be obtain

commitPolicyObjects

private void commitPolicyObjects(java.util.List ctxIDs)
                          throws EZBDeployerException
Commit policy context IDs of the given list.

Parameters:
ctxIDs - list of context ID to commit.
Throws:
EZBDeployerException - if the policy objects cannot be committed.