org.ow2.jonas.ear.internal
Class EarDeployer

java.lang.Object
  extended by org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
      extended by org.ow2.jonas.ear.internal.EarDeployer
All Implemented Interfaces:
org.ow2.util.ee.deploy.api.deployer.IDeployer

public class EarDeployer
extends org.ow2.util.ee.deploy.impl.deployer.AbsDeployer

This deployer will deploy EAR by using the other services.

Author:
Florent BENOIT Contributors: S. Ali Tokmen (fixes for EARs with spaces on Windows, versioning)

Field Summary
static String DEFAULT_FOLDER
          Folder to create in tmp folder.
protected static String INEAR_WORK_WEBAPPS_DIR_SUFFIX
          The name of the property used in work directory for EAR webapps (in ear case).
protected static String WORK_WEBAPPS_DIR
          The name of the working apps directory.
 
Fields inherited from class org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
deployedDeployables
 
Constructor Summary
EarDeployer()
          Build a new instance of the EAR deployer.
 
Method Summary
protected  org.ow2.util.ee.deploy.api.deployable.EARDeployable applyGenClientStubIfNeeded(org.ow2.util.ee.deploy.api.deployable.EARDeployable deployable)
          Apply GenClientStub of the given archive.
protected  void completeWebServicesDeployment(URL earURL, org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, ClassLoader earClassLoader)
          Complete the Deployment of the WebServices.
protected  void deployEJB21s(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, URL earURL, URLClassLoader earClassLoader, ClassLoader ejbClassLoader, String[] roleNames)
          Deploy the EJB 2.1 of the given EAR.
protected  void deployRARs(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, URL earURL, ClassLoader earClassLoader)
          Deploy the RARs of the given EAR.
protected  void deployWARs(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, URL earURL, ClassLoader earClassLoader, ClassLoader parentClassLoader, org.ow2.easybeans.deployment.api.EZBInjectionHolder ejbInjectionHolder)
          Deploy the WAR files present in the given EAR.
protected  void deployWebServices(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable, URL earURL, ClassLoader earClassLoader, ClassLoader ejbClassLoader, List<URL> urlsEJB, List<URL> urlsWAR)
          Deploy the Web Services of the given EAR.
 void doDeploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Deploy the given deployable.
 void doUndeploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Undeploy the given EAR.
 void enableGenClientStub()
          Enable GenClientStub.
 Map<URL,org.ow2.util.ee.deploy.api.deployable.EARDeployable> getEars()
          Returns a Map containing all deployed EARs.
 org.ow2.easybeans.api.EZBServer getEmbedded()
           
protected  List<org.ow2.util.archive.api.IArchive> getLibArchives(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
          Gets Archives of the libraries of this EAR.
 ServerProperties getServerProperties()
          Returns the server properties.
 VersioningService getVersioningService()
           
 void setAppsClassLoader(ClassLoader appsClassLoader)
          Sets the classloader to use for all deployed applications.
 void setDeployerLog(DeployerLog deployerLog)
          Set the DeployerLog of the EarDeployer.
 void setEasyBeansService(IEasyBeansService service)
           
 void setEjb21Service(EJBService ejb21Service)
          Sets the EJB 2.1 service.
 void setEmbedded(org.ow2.easybeans.api.EZBServer embedded)
          Receive Embedded instance for this deployer.
 void setJAXRPCService(IJAXRPCService jaxrpcService)
          Sets the JAX-RPC service.
 void setJMXService(JmxService jmxService)
          Sets the JMX service.
 void setResourceService(ResourceService resourceService)
          Sets the RAR service.
 void setServerProperties(ServerProperties serverProperties)
          Sets the server properties.
 void setServiceManager(ServiceManager serviceManager)
          Sets the service manager.
 void setVersioningService(VersioningService versioningService)
           
 void setWebContainerService(JWebContainerService webContainerService)
          Sets the WEB container service.
 boolean supports(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Checks if the given deployable is supported by the Deployer.
protected  void undeployEJB3FromEAR(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
          Undeploy EJB3s of an EAR (called by the undeploy method).
 void unsetServiceManager()
          Sets the service manager to null.
 void unsetVersioningService()
          Sets the versioning service to null.
 void useEJB3ChildClassloader()
          Enable the use of a child classloader for EJB3s.
 
Methods inherited from class org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
check, deploy, getDeployedDeployables, getFile, getURL, isDeployed, stop, undeploy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FOLDER

public static final String DEFAULT_FOLDER
Folder to create in tmp folder.

See Also:
Constant Field Values

WORK_WEBAPPS_DIR

protected static final String WORK_WEBAPPS_DIR
The name of the working apps directory.


INEAR_WORK_WEBAPPS_DIR_SUFFIX

protected static final String INEAR_WORK_WEBAPPS_DIR_SUFFIX
The name of the property used in work directory for EAR webapps (in ear case).

See Also:
Constant Field Values
Constructor Detail

EarDeployer

public EarDeployer()
Build a new instance of the EAR deployer.

Method Detail

getEmbedded

public org.ow2.easybeans.api.EZBServer getEmbedded()
Returns:
the embedded instance used by this server.

setEmbedded

public void setEmbedded(org.ow2.easybeans.api.EZBServer embedded)
Receive Embedded instance for this deployer.

Parameters:
embedded - the given instance of the embedded server.

enableGenClientStub

public void enableGenClientStub()
Enable GenClientStub.


useEJB3ChildClassloader

public void useEJB3ChildClassloader()
Enable the use of a child classloader for EJB3s.


applyGenClientStubIfNeeded

protected org.ow2.util.ee.deploy.api.deployable.EARDeployable applyGenClientStubIfNeeded(org.ow2.util.ee.deploy.api.deployable.EARDeployable deployable)
                                                                                  throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Apply GenClientStub of the given archive.

Parameters:
deployable - the deployable to use
Returns:
the modified deployable or the original deployable if WSGen has not been launched.
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if WSGen cannot be applied.

doDeploy

public void doDeploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
              throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Deploy the given deployable.

Specified by:
doDeploy in class org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
Parameters:
deployable - the EAR deployable.
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the EAR is not deployed.

doUndeploy

public void doUndeploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
                throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Undeploy the given EAR.

Specified by:
doUndeploy in class org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
Parameters:
deployable - the deployable to remove.
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the EAR is not undeployed.

undeployEJB3FromEAR

protected void undeployEJB3FromEAR(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
                            throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Undeploy EJB3s of an EAR (called by the undeploy method).

Parameters:
earDeployable - a given EAR deployable
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the deployment is not done.

supports

public boolean supports(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Checks if the given deployable is supported by the Deployer.

Specified by:
supports in interface org.ow2.util.ee.deploy.api.deployer.IDeployer
Specified by:
supports in class org.ow2.util.ee.deploy.impl.deployer.AbsDeployer
Parameters:
deployable - the deployable to be checked
Returns:
true if it is supported, else false.

deployWARs

protected void deployWARs(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                          URL earURL,
                          ClassLoader earClassLoader,
                          ClassLoader parentClassLoader,
                          org.ow2.easybeans.deployment.api.EZBInjectionHolder ejbInjectionHolder)
                   throws org.ow2.util.ee.deploy.api.deployer.DeployerException
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
ejbInjectionHolder - the given ejb injection holder (including persistence unit manager, etc).
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the wars are not deployed.

deployEJB21s

protected void deployEJB21s(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                            URL earURL,
                            URLClassLoader earClassLoader,
                            ClassLoader ejbClassLoader,
                            String[] roleNames)
                     throws org.ow2.util.ee.deploy.api.deployer.DeployerException
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
roleNames - the name of the roles to use for security
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the EJB 2.1 filse can't be deployed

deployRARs

protected void deployRARs(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                          URL earURL,
                          ClassLoader earClassLoader)
                   throws org.ow2.util.ee.deploy.api.deployer.DeployerException
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:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the RARs file can't be deployed

deployWebServices

protected void deployWebServices(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                                 URL earURL,
                                 ClassLoader earClassLoader,
                                 ClassLoader ejbClassLoader,
                                 List<URL> urlsEJB,
                                 List<URL> urlsWAR)
                          throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Deploy the Web Services of the given EAR.

Parameters:
earDeployable - the EAR that contains the Web Services
earURL - the URL of the EAR
earClassLoader - the classloader of the EAR
ejbClassLoader - the classloader of the EJBs
urlsEJB - List of the EJBs of the EAR
urlsWAR - List of the WARs of the EAR
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - if the Web Services can't be deployed

completeWebServicesDeployment

protected void completeWebServicesDeployment(URL earURL,
                                             org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable,
                                             ClassLoader earClassLoader)
                                      throws org.ow2.util.ee.deploy.api.deployer.DeployerException
Complete the Deployment of the WebServices.

Parameters:
earURL - The URL of the EAR
earDeployable - the deployable of the EAR
earClassLoader - The classloader of the EAR
Throws:
org.ow2.util.ee.deploy.api.deployer.DeployerException - Thrown if the Web Services can't be deployed

setJAXRPCService

public void setJAXRPCService(IJAXRPCService jaxrpcService)
Sets the JAX-RPC service.

Parameters:
jaxrpcService - JAX-RPC service

setResourceService

public void setResourceService(ResourceService resourceService)
Sets the RAR service.

Parameters:
resourceService - RAR service.

setEjb21Service

public void setEjb21Service(EJBService ejb21Service)
Sets the EJB 2.1 service.

Parameters:
ejb21Service - the EJB 2.1 service.

setJMXService

public void setJMXService(JmxService jmxService)
Sets the JMX service.

Parameters:
jmxService - the JMX service.

setWebContainerService

public void setWebContainerService(JWebContainerService webContainerService)
Sets the WEB container service.

Parameters:
webContainerService - the web container service.

setAppsClassLoader

public void setAppsClassLoader(ClassLoader appsClassLoader)
Sets the classloader to use for all deployed applications.

Parameters:
appsClassLoader - the given classloader.

getLibArchives

protected List<org.ow2.util.archive.api.IArchive> getLibArchives(org.ow2.util.ee.deploy.api.deployable.EARDeployable earDeployable)
Gets Archives of the libraries of this EAR.

Parameters:
earDeployable - the given EAR deployable.
Returns:
list of archives

getServerProperties

public ServerProperties getServerProperties()
Returns the server properties.

Returns:
the server properties

setServerProperties

public void setServerProperties(ServerProperties serverProperties)
Sets the server properties.

Parameters:
serverProperties - the given server properties

setVersioningService

public void setVersioningService(VersioningService versioningService)
Parameters:
versioningService - The versioning service to set.

setEasyBeansService

public void setEasyBeansService(IEasyBeansService service)
Parameters:
service - the EJB3 Service to be injected.

unsetVersioningService

public void unsetVersioningService()
Sets the versioning service to null.


getVersioningService

public VersioningService getVersioningService()
Returns:
The versioning service.

unsetServiceManager

public void unsetServiceManager()
Sets the service manager to null.


setServiceManager

public void setServiceManager(ServiceManager serviceManager)
Sets the service manager.


setDeployerLog

public void setDeployerLog(DeployerLog deployerLog)
Set the DeployerLog of the EarDeployer.

Parameters:
deployerLog - the DeployerLog to use

getEars

public Map<URL,org.ow2.util.ee.deploy.api.deployable.EARDeployable> getEars()
Returns a Map containing all deployed EARs.

Returns:
a Map containing all deployed EARs.


Copyright © 2010 OW2 Consortium. All Rights Reserved.