Class AbstractEarModule

java.lang.Object
org.apache.maven.plugins.ear.AbstractEarModule
All Implemented Interfaces:
EarModule
Direct Known Subclasses:
AppClientModule, EjbModule, HarModule, JarModule, RarModule, SarModule, WebModule

public abstract class AbstractEarModule extends Object implements EarModule
A base implementation of an EarModule.
Author:
Stephane Nicoll
  • Field Details

    • MODULE_ELEMENT

      protected static final String MODULE_ELEMENT
      The module element.
      See Also:
    • JAVA_MODULE

      protected static final String JAVA_MODULE
      The java module.
      See Also:
    • ALT_DD

      protected static final String ALT_DD
      The alt-dd module.
      See Also:
    • type

      protected String type
      The type of the artifact
    • bundleDir

      protected String bundleDir
      The bundleDir.
    • bundleFileName

      protected String bundleFileName
      The bundleFileName.
    • excluded

      protected Boolean excluded
      excluded by default false.
    • unpack

      protected Boolean unpack
      unpack
    • altDeploymentDescriptor

      protected String altDeploymentDescriptor
      The alternate deployment descriptor.
    • libDirectory

      protected String libDirectory
      Directory of module which contains libraries packaged into module. null value means that module doesn't contain any library. Each module type can provide default value for this directory and this option can be used to override that default value. If module libraries are located at the root of module then use single slash (/) to configure that in POM. That is, a single slash is treated as an empty string.
    • classPathItem

      protected boolean classPathItem
      If module is considered for inclusion into the Class-Path entry of MANIFEST.mf of other modules. false value leads to removal of the module from the Class-Path entry. true value leads to modification of the reference to the module in the Class-Path entry if such reference exists or leads to adding of the module into the Class-Path entry if such reference doesn't exist. Removal, modification or adding of the reference in the Class-Path entry depends on libDirectory property of another module and on skinnyWars / skinnyModules parameters of EAR Plugin.
    • earExecutionContext

      protected EarExecutionContext earExecutionContext
  • Constructor Details

    • AbstractEarModule

      public AbstractEarModule()
      Empty constructor to be used when the module is built based on the configuration.
    • AbstractEarModule

      public AbstractEarModule(org.apache.maven.artifact.Artifact a)
      Creates an ear module from the artifact.
      Parameters:
      a - the artifact
  • Method Details

    • setEarExecutionContext

      public void setEarExecutionContext(EarExecutionContext earExecutionContext)
      Specified by:
      setEarExecutionContext in interface EarModule
      Parameters:
      earExecutionContext - The execution context.
    • resolveArtifact

      public void resolveArtifact(Set<org.apache.maven.artifact.Artifact> artifacts) throws EarPluginException, org.apache.maven.plugin.MojoFailureException
      Resolves the Artifact represented by the module. Note that the EarExecutionContext might be used to customize further the resolution.
      Specified by:
      resolveArtifact in interface EarModule
      Parameters:
      artifacts - the project's artifacts
      Throws:
      EarPluginException - if the artifact could not be resolved
      org.apache.maven.plugin.MojoFailureException - if an unexpected error occurred
    • getArtifact

      public org.apache.maven.artifact.Artifact getArtifact()
      Description copied from interface: EarModule
      Returns the Artifact representing this module. Note that this might return null till the module has been resolved.
      Specified by:
      getArtifact in interface EarModule
      Returns:
      artifact
      See Also:
    • getModuleId

      public String getModuleId()
      Returns:
      moduleId
    • getUri

      public String getUri()
      Description copied from interface: EarModule
      Returns the URI for this module.
      Specified by:
      getUri in interface EarModule
      Returns:
      Return the URI.
    • getType

      public String getType()
      Returns the type associated to the module.
      Specified by:
      getType in interface EarModule
      Returns:
      the artifact's type of the module
    • getGroupId

      public String getGroupId()
      Returns the artifact's groupId.
      Returns:
      groupId
    • getArtifactId

      public String getArtifactId()
      Returns the artifact's Id.
      Returns:
      artifactId
    • getClassifier

      public String getClassifier()
      Returns the artifact's classifier.
      Returns:
      the artifact classifier
    • getBundleDir

      public String getBundleDir()
      Returns the bundle directory. If null, the module is bundled in the root of the EAR.
      Returns:
      the custom bundle directory
    • getLibDir

      public String getLibDir()
      Specified by:
      getLibDir in interface EarModule
      Returns:
      The directory of the module which contains the JAR libraries packaged within the module. Can be null, which means that module doesn't contain any packaged libraries.
    • isClassPathItem

      public boolean isClassPathItem()
      If module should be included into the Class-Path entry of MANIFEST.mf. Doesn't impact Class-Path entry of MANIFEST.mf of modules which contain all of their dependencies unless skinnyWars / skinnyModules is turned on.
      Specified by:
      isClassPathItem in interface EarModule
      Returns:
      True} if module should be included into the Class-Path entry of MANIFEST.mf
    • getBundleFileName

      public String getBundleFileName()
      Returns the bundle file name. If null, the artifact's file name is returned.
      Specified by:
      getBundleFileName in interface EarModule
      Returns:
      the bundle file name
    • getAltDeploymentDescriptor

      public 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 interface EarModule
      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 interface EarModule
      Returns:
      true if this module should be skipped, false otherwise
    • shouldUnpack

      public 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 interface EarModule
      Returns:
      unpack
    • writeAltDeploymentDescriptor

      protected void writeAltDeploymentDescriptor(org.codehaus.plexus.util.xml.XMLWriter writer, String version)
      Writes the alternative deployment descriptor if necessary.
      Parameters:
      writer - the writer to use
      version - the java EE version in use
    • startModuleElement

      protected void startModuleElement(org.codehaus.plexus.util.xml.XMLWriter writer, Boolean generateId)
      Starts a new MODULE_ELEMENT on the specified writer, possibly including an id attribute.
      Parameters:
      writer - the XML writer.
      generateId - whether an id should be generated
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • changeManifestClasspath

      public boolean changeManifestClasspath()
      Specified by:
      changeManifestClasspath in interface EarModule
      Returns:
      always true