Package org.apache.maven.plugin.ear
Class AbstractEarModule
- java.lang.Object
-
- org.apache.maven.plugin.ear.AbstractEarModule
-
- All Implemented Interfaces:
EarModule
- Direct Known Subclasses:
AppClientModule,EjbModule,HarModule,JarModule,RarModule,SarModule,WebModule
public abstract class AbstractEarModule extends java.lang.Object implements EarModule
A base implementation of anEarModule.- Version:
- $Id: AbstractEarModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringALT_DDThe alt-dd module.protected java.lang.StringaltDeploymentDescriptorThe alternate deployment descriptor.private org.apache.maven.artifact.Artifactartifactprivate java.lang.StringartifactIdprotected java.lang.StringbundleDirThe bundleDir.protected java.lang.StringbundleFileNameThe bundleFileName.private java.lang.Stringclassifierprotected EarExecutionContextearExecutionContextprotected java.lang.Booleanexcludedexcluded by defaultfalse.private java.lang.StringgroupIdprotected static java.lang.StringJAVA_MODULEThe java module.protected static java.lang.StringMODULE_ELEMENTThe module element.private java.lang.StringmoduleIdprotected java.lang.Booleanunpackunpackprivate java.lang.Stringuri
-
Constructor Summary
Constructors Constructor Description AbstractEarModule()Empty constructor to be used when the module is built based on the configuration.AbstractEarModule(org.apache.maven.artifact.Artifact a)Creates an ear module from the artifact.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleanareNullOrEqual(java.lang.Object first, java.lang.Object second)Specify if the objects are both null or both equal.booleanchangeManifestClasspath()(package private) static java.lang.StringcleanBundleDir(java.lang.String bundleDir)Cleans the bundle directory so that it might be used properly.java.lang.StringgetAltDeploymentDescriptor()The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a particular Java EE module.org.apache.maven.artifact.ArtifactgetArtifact()Returns theArtifactrepresenting this module.java.lang.StringgetArtifactId()Returns the artifact's Id.java.lang.StringgetBundleDir()Returns the bundle directory.java.lang.StringgetBundleFileName()Returns the bundle file name.java.lang.StringgetClassifier()Returns the artifact's classifier.java.lang.StringgetGroupId()Returns the artifact's groupId.java.lang.StringgetLibDir()java.lang.StringgetModuleId()java.lang.StringgetOriginalBundleFileName()Based on MEAR-189 we need to get back the original file name under any circumstances.java.lang.StringgetUri()Returns the URI for this module.booleanisExcluded()Specify whether this module should be excluded or not.voidresolveArtifact(java.util.Set<org.apache.maven.artifact.Artifact> artifacts)Resolves theArtifactrepresented by the module.voidsetEarExecutionContext(EarExecutionContext earExecutionContext)(package private) voidsetUri(java.lang.String uri)Sets the URI of the module explicitly for testing purposes.java.lang.BooleanshouldUnpack()Specify whether this module should be unpacked in the EAR archive or not.protected voidstartModuleElement(org.codehaus.plexus.util.xml.XMLWriter writer, java.lang.Boolean generateId)Starts a newMODULE_ELEMENTon the specified writer, possibly including an id attribute.java.lang.StringtoString()protected voidwriteAltDeploymentDescriptor(org.codehaus.plexus.util.xml.XMLWriter writer, java.lang.String version)Writes the alternative deployment descriptor if necessary.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.maven.plugin.ear.EarModule
appendModule, getType
-
-
-
-
Field Detail
-
MODULE_ELEMENT
protected static final java.lang.String MODULE_ELEMENT
The module element.- See Also:
- Constant Field Values
-
JAVA_MODULE
protected static final java.lang.String JAVA_MODULE
The java module.- See Also:
- Constant Field Values
-
ALT_DD
protected static final java.lang.String ALT_DD
The alt-dd module.- See Also:
- Constant Field Values
-
artifact
private org.apache.maven.artifact.Artifact artifact
-
groupId
private java.lang.String groupId
-
artifactId
private java.lang.String artifactId
-
classifier
private java.lang.String classifier
-
bundleDir
protected java.lang.String bundleDir
The bundleDir.
-
bundleFileName
protected java.lang.String bundleFileName
The bundleFileName.
-
excluded
protected java.lang.Boolean excluded
excluded by defaultfalse.
-
uri
private java.lang.String uri
-
unpack
protected java.lang.Boolean unpack
unpack
-
altDeploymentDescriptor
protected java.lang.String altDeploymentDescriptor
The alternate deployment descriptor.
-
moduleId
private java.lang.String moduleId
-
earExecutionContext
protected EarExecutionContext earExecutionContext
-
-
Method Detail
-
setEarExecutionContext
public void setEarExecutionContext(EarExecutionContext earExecutionContext)
- Specified by:
setEarExecutionContextin interfaceEarModule- Parameters:
earExecutionContext- The execution context.
-
resolveArtifact
public void resolveArtifact(java.util.Set<org.apache.maven.artifact.Artifact> artifacts) throws EarPluginException, org.apache.maven.plugin.MojoFailureExceptionResolves theArtifactrepresented by the module. Note that theEarExecutionContextmight be used to customize further the resolution.- Specified by:
resolveArtifactin interfaceEarModule- Parameters:
artifacts- the project's artifacts- Throws:
EarPluginException- if the artifact could not be resolvedorg.apache.maven.plugin.MojoFailureException- if an unexpected error occurred
-
getArtifact
public org.apache.maven.artifact.Artifact getArtifact()
Description copied from interface:EarModuleReturns theArtifactrepresenting this module. Note that this might return null till the module has been resolved.- Specified by:
getArtifactin interfaceEarModule- Returns:
artifact- See Also:
EarModule.resolveArtifact(java.util.Set)
-
getModuleId
public java.lang.String getModuleId()
- Returns:
moduleId
-
getUri
public java.lang.String getUri()
Description copied from interface:EarModuleReturns the URI for this module.
-
getGroupId
public java.lang.String getGroupId()
Returns the artifact's groupId.- Returns:
groupId
-
getArtifactId
public java.lang.String getArtifactId()
Returns the artifact's Id.- Returns:
artifactId
-
getClassifier
public java.lang.String getClassifier()
Returns the artifact's classifier.- Returns:
- the artifact classifier
-
getBundleDir
public java.lang.String getBundleDir()
Returns the bundle directory. If null, the module is bundled in the root of the EAR.- Returns:
- the custom bundle directory
-
getBundleFileName
public java.lang.String getBundleFileName()
Returns the bundle file name. If null, the artifact's file name is returned.- Returns:
- the bundle file name
-
getOriginalBundleFileName
public java.lang.String getOriginalBundleFileName()
Based on MEAR-189 we need to get back the original file name under any circumstances.- Returns:
- The original file name.
-
getAltDeploymentDescriptor
public java.lang.String getAltDeploymentDescriptor()
The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to the application's root directory.- Specified by:
getAltDeploymentDescriptorin interfaceEarModule- Returns:
- the alternative deployment descriptor for this module
-
isExcluded
public boolean isExcluded()
Specify whether this module should be excluded or not.- Specified by:
isExcludedin interfaceEarModule- Returns:
- true if this module should be skipped, false otherwise
-
shouldUnpack
public java.lang.Boolean shouldUnpack()
Description copied from interface:EarModuleSpecify whether this module should be unpacked in the EAR archive or not. Returns null if no configuration was specified so that defaulting may apply.- Specified by:
shouldUnpackin interfaceEarModule- Returns:
unpack
-
writeAltDeploymentDescriptor
protected void writeAltDeploymentDescriptor(org.codehaus.plexus.util.xml.XMLWriter writer, java.lang.String version)Writes the alternative deployment descriptor if necessary.- Parameters:
writer- the writer to useversion- the java EE version in use
-
startModuleElement
protected void startModuleElement(org.codehaus.plexus.util.xml.XMLWriter writer, java.lang.Boolean generateId)Starts a newMODULE_ELEMENTon the specified writer, possibly including an id attribute.- Parameters:
writer- the XML writer.generateId- whether an id should be generated
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
cleanBundleDir
static java.lang.String cleanBundleDir(java.lang.String bundleDir)
Cleans the bundle directory so that it might be used properly.- Parameters:
bundleDir- the bundle directory to clean- Returns:
- the cleaned bundle directory
-
areNullOrEqual
static boolean areNullOrEqual(java.lang.Object first, java.lang.Object second)Specify if the objects are both null or both equal.- Parameters:
first- the first objectsecond- the second object- Returns:
- true if parameters are either both null or equal
-
setUri
void setUri(java.lang.String uri)
Sets the URI of the module explicitly for testing purposes.- Parameters:
uri- the uri
-
changeManifestClasspath
public boolean changeManifestClasspath()
- Specified by:
changeManifestClasspathin interfaceEarModule- Returns:
- always
true
-
-