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.String
ALT_DD
The alt-dd module.protected java.lang.String
altDeploymentDescriptor
The alternate deployment descriptor.private org.apache.maven.artifact.Artifact
artifact
private java.lang.String
artifactId
protected java.lang.String
bundleDir
The bundleDir.protected java.lang.String
bundleFileName
The bundleFileName.private java.lang.String
classifier
protected EarExecutionContext
earExecutionContext
protected java.lang.Boolean
excluded
excluded by defaultfalse
.private java.lang.String
groupId
protected static java.lang.String
JAVA_MODULE
The java module.protected static java.lang.String
MODULE_ELEMENT
The module element.private java.lang.String
moduleId
protected java.lang.Boolean
unpack
unpackprivate java.lang.String
uri
-
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 boolean
areNullOrEqual(java.lang.Object first, java.lang.Object second)
Specify if the objects are both null or both equal.boolean
changeManifestClasspath()
(package private) static java.lang.String
cleanBundleDir(java.lang.String bundleDir)
Cleans the bundle directory so that it might be used properly.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.org.apache.maven.artifact.Artifact
getArtifact()
Returns theArtifact
representing this module.java.lang.String
getArtifactId()
Returns the artifact's Id.java.lang.String
getBundleDir()
Returns the bundle directory.java.lang.String
getBundleFileName()
Returns the bundle file name.java.lang.String
getClassifier()
Returns the artifact's classifier.java.lang.String
getGroupId()
Returns the artifact's groupId.java.lang.String
getLibDir()
java.lang.String
getModuleId()
java.lang.String
getOriginalBundleFileName()
Based on MEAR-189 we need to get back the original file name under any circumstances.java.lang.String
getUri()
Returns the URI for this module.boolean
isExcluded()
Specify whether this module should be excluded or not.void
resolveArtifact(java.util.Set<org.apache.maven.artifact.Artifact> artifacts)
Resolves theArtifact
represented by the module.void
setEarExecutionContext(EarExecutionContext earExecutionContext)
(package private) void
setUri(java.lang.String uri)
Sets the URI of the module explicitly for testing purposes.java.lang.Boolean
shouldUnpack()
Specify whether this module should be unpacked in the EAR archive or not.protected void
startModuleElement(org.codehaus.plexus.util.xml.XMLWriter writer, java.lang.Boolean generateId)
Starts a newMODULE_ELEMENT
on the specified writer, possibly including an id attribute.java.lang.String
toString()
protected void
writeAltDeploymentDescriptor(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:
setEarExecutionContext
in 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.MojoFailureException
Resolves theArtifact
represented by the module. Note that theEarExecutionContext
might be used to customize further the resolution.- Specified by:
resolveArtifact
in 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:EarModule
Returns theArtifact
representing this module. Note that this might return null till the module has been resolved.- Specified by:
getArtifact
in 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:EarModule
Returns 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:
getAltDeploymentDescriptor
in interfaceEarModule
- Returns:
- the alternative deployment descriptor for this module
-
isExcluded
public boolean isExcluded()
Specify whether this module should be excluded or not.- Specified by:
isExcluded
in interfaceEarModule
- Returns:
- true if this module should be skipped, false otherwise
-
shouldUnpack
public java.lang.Boolean shouldUnpack()
Description copied from interface:EarModule
Specify 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:
shouldUnpack
in 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_ELEMENT
on 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:
toString
in 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:
changeManifestClasspath
in interfaceEarModule
- Returns:
- always
true
-
-