org.ow2.util.ee.deploy.impl.deployable
Class EARDeployableImpl

java.lang.Object
  extended by org.ow2.util.ee.deploy.impl.deployable.AbsDeployable<org.ow2.util.ee.deploy.api.deployable.EARDeployable>
      extended by org.ow2.util.ee.deploy.impl.deployable.EARDeployableImpl
All Implemented Interfaces:
org.ow2.util.ee.deploy.api.deployable.EARDeployable, org.ow2.util.ee.deploy.api.deployable.IDeployable<org.ow2.util.ee.deploy.api.deployable.EARDeployable>

public class EARDeployableImpl
extends AbsDeployable<org.ow2.util.ee.deploy.api.deployable.EARDeployable>
implements org.ow2.util.ee.deploy.api.deployable.EARDeployable

Implementation for an EAR.

Author:
Florent Benoit

Constructor Summary
EARDeployableImpl(org.ow2.util.archive.api.IArchive archive)
          Defines and create a deployable for the given archive.
 
Method Summary
 void addDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Add the given Deployable to this EAR deployable.
 void addDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable, EarUnpackOpts earUnpackOpts)
          Add the given Deployable to this EAR deployable.
protected  void analyzeClassPathModules(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Analyze the classpath of the given deployable.
protected  org.ow2.util.ee.deploy.api.deployable.IDeployable<?> changeTypeIfSpecified(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          If there is an XML file, ignore the type that we want to add, use the type specified by the XML file.
protected  org.ow2.util.ee.deploy.api.deployable.IDeployable<?> checkLibDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          If it is a library, change the type of the deployable.
protected  String computePathForModule(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable, String relativeName, boolean relative)
          Return the name of a module with a path from the root of the EAR.
 List<org.ow2.util.ee.deploy.api.deployable.IDeployable<?>> getAllDeployables()
           
 URL getAltDDURL(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
           
 List<org.ow2.util.ee.deploy.api.deployable.CARDeployable> getCARDeployables()
           
 org.ow2.util.ee.deploy.api.deployable.IDeployable<?> getDeployable(URL url)
           
 org.ow2.util.ee.deploy.api.deployment.ear.IEARInfo getEARInfo()
           
 List<org.ow2.util.ee.deploy.api.deployable.EJB21Deployable> getEJB21Deployables()
           
 List<org.ow2.util.ee.deploy.api.deployable.EJB3Deployable> getEJB3Deployables()
           
 List<org.ow2.util.ee.deploy.api.deployable.EJBDeployable<?>> getEJBDeployables()
           
 List<org.ow2.util.ee.deploy.api.deployable.LibDeployable> getLibDeployables()
           
 List<org.ow2.util.ee.deploy.api.deployable.OSGiDeployable> getOSGiDeployables()
           
protected  String getPathOfArelativeModuleFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable, String relativeName)
          Return the path (string form of url) of a module/file in the EAR.
 List<org.ow2.util.ee.deploy.api.deployable.RARDeployable> getRARDeployables()
           
protected  String getRelativeNameFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Return the relative name of the deployable from the EAR deployable.
protected  String getRelativeNameOfAModuleFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable, String relativeName)
          Return the name of a module with a path from the root of the EAR.
 List<org.ow2.util.ee.deploy.api.deployable.WARDeployable> getWARDeployables()
           
 void resolveClassPath()
          Resolve the ClassPath entries.
protected  void setContextRoot(org.ow2.util.ee.deploy.api.deployable.WARDeployable warDeployable)
          Set the name of the context-root for the given WAR by checking the EAR information (if any).
 String toString()
           
protected  org.ow2.util.ee.deploy.api.deployable.IDeployable<?> updateDeployableIfBundle(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          If it is a bundle (in the bundle/ directory), change the type of the deployable.
 
Methods inherited from class org.ow2.util.ee.deploy.impl.deployable.AbsDeployable
addExtension, equals, getArchive, getExtension, getModuleName, getOriginalDeployable, getShortName, getUnpackedDeployable, setOriginalDeployable, setUnpackedDeployable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ow2.util.ee.deploy.api.deployable.IDeployable
addExtension, getArchive, getExtension, getModuleName, getOriginalDeployable, getShortName, getUnpackedDeployable, setOriginalDeployable, setUnpackedDeployable
 

Constructor Detail

EARDeployableImpl

public EARDeployableImpl(org.ow2.util.archive.api.IArchive archive)
Defines and create a deployable for the given archive.

Parameters:
archive - the given archive.
Method Detail

getEJBDeployables

public List<org.ow2.util.ee.deploy.api.deployable.EJBDeployable<?>> getEJBDeployables()
Specified by:
getEJBDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the EJB deployables for this EAR.

getEJB21Deployables

public List<org.ow2.util.ee.deploy.api.deployable.EJB21Deployable> getEJB21Deployables()
Specified by:
getEJB21Deployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the EJB 2.1 deployables for this EAR.

getEJB3Deployables

public List<org.ow2.util.ee.deploy.api.deployable.EJB3Deployable> getEJB3Deployables()
Specified by:
getEJB3Deployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the EJB 3 deployables for this EAR.

getWARDeployables

public List<org.ow2.util.ee.deploy.api.deployable.WARDeployable> getWARDeployables()
Specified by:
getWARDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the War deployables for this EAR.

getRARDeployables

public List<org.ow2.util.ee.deploy.api.deployable.RARDeployable> getRARDeployables()
Specified by:
getRARDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the Rar deployables for this EAR.

getCARDeployables

public List<org.ow2.util.ee.deploy.api.deployable.CARDeployable> getCARDeployables()
Specified by:
getCARDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the Car deployables for this EAR.

getLibDeployables

public List<org.ow2.util.ee.deploy.api.deployable.LibDeployable> getLibDeployables()
Specified by:
getLibDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of the Library deployables for this EAR.

getOSGiDeployables

public List<org.ow2.util.ee.deploy.api.deployable.OSGiDeployable> getOSGiDeployables()
Returns:
the list of the OSGi deployables for this EAR.

addDeployable

public void addDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Add the given Deployable to this EAR deployable.

Parameters:
deployable - the given deployable object to add

addDeployable

public void addDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable,
                          EarUnpackOpts earUnpackOpts)
Add the given Deployable to this EAR deployable.

Parameters:
deployable - the given deployable object to add
earUnpackOpts - options to unpack an ear

analyzeClassPathModules

protected void analyzeClassPathModules(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Analyze the classpath of the given deployable.

Parameters:
deployable - the deployable to analyze

changeTypeIfSpecified

protected org.ow2.util.ee.deploy.api.deployable.IDeployable<?> changeTypeIfSpecified(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
If there is an XML file, ignore the type that we want to add, use the type specified by the XML file.

Parameters:
deployable - the module of this EAR
Returns:
the new deployable if it is a library module.

checkLibDeployable

protected org.ow2.util.ee.deploy.api.deployable.IDeployable<?> checkLibDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
If it is a library, change the type of the deployable.

Parameters:
deployable - the module of this EAR
Returns:
the new deployable if it is a library module.

updateDeployableIfBundle

protected org.ow2.util.ee.deploy.api.deployable.IDeployable<?> updateDeployableIfBundle(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
If it is a bundle (in the bundle/ directory), change the type of the deployable.

Parameters:
deployable - the module of this EAR
Returns:
the updated deployable if it is a bundle module.

getRelativeNameFromDeployable

protected String getRelativeNameFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Return the relative name of the deployable from the EAR deployable.

Parameters:
deployable - the module of the EAR
Returns:
the relative name

computePathForModule

protected String computePathForModule(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable,
                                      String relativeName,
                                      boolean relative)
Return the name of a module with a path from the root of the EAR.

Parameters:
deployable - a module of the EAR
relativeName - a relative name from the given deployable
relative - true for returning a relative path false otherwise
Returns:
a relative or absolute path in the EAR scope

getRelativeNameOfAModuleFromDeployable

protected String getRelativeNameOfAModuleFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable,
                                                        String relativeName)
Return the name of a module with a path from the root of the EAR.

Parameters:
deployable - a module of the EAR
relativeName - a relative name from the given deployable
Returns:
the relative name in the EAR scope

setContextRoot

protected void setContextRoot(org.ow2.util.ee.deploy.api.deployable.WARDeployable warDeployable)
Set the name of the context-root for the given WAR by checking the EAR information (if any).

Parameters:
warDeployable - the given war to analyze

resolveClassPath

public void resolveClassPath()
Resolve the ClassPath entries. It means that it puts the unknown modules into Library modules.


getPathOfArelativeModuleFromDeployable

protected String getPathOfArelativeModuleFromDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable,
                                                        String relativeName)
Return the path (string form of url) of a module/file in the EAR.

Parameters:
deployable - a module of the EAR
relativeName - a relative name from the given deployable
Returns:
the URL of the module in EAR

getEARInfo

public org.ow2.util.ee.deploy.api.deployment.ear.IEARInfo getEARInfo()
Specified by:
getEARInfo in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
EAR information (of the application.xml file).

getAllDeployables

public List<org.ow2.util.ee.deploy.api.deployable.IDeployable<?>> getAllDeployables()
Specified by:
getAllDeployables in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Returns:
the list of all deployables for this EAR.

getDeployable

public org.ow2.util.ee.deploy.api.deployable.IDeployable<?> getDeployable(URL url)
Specified by:
getDeployable in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Parameters:
url - of the wanted deployable
Returns:
deployable corresponding to the url

getAltDDURL

public URL getAltDDURL(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
Specified by:
getAltDDURL in interface org.ow2.util.ee.deploy.api.deployable.EARDeployable
Parameters:
deployable - a module of the EAR
Returns:
the url of the alt deployment descriptor file relative to the application's root or null if altDD element is not present

toString

public String toString()
Overrides:
toString in class AbsDeployable<org.ow2.util.ee.deploy.api.deployable.EARDeployable>
Returns:
String representation.


Copyright © 2007-2011 OW2 Consortium. All Rights Reserved.