Package: org.gradle.plugins.ear.descriptor

## [Java] Interface DeploymentDescriptor

- A deployment descriptor such as application.xml.

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `String` | `getApplicationName()` The application name.
    `String` | `getDescription()` The application description.
    `String` | `getDisplayName()` The application display name.
    `String` | `getFileName()` The name of the descriptor file, typically "application.xml"
    `Boolean` | `getInitializeInOrder()` Whether to initialize modules in the order they appear in the descriptor, with the exception of client modules.
    `String` | `getLibraryDirectory()` The name of the directory to look for libraries in.
    `Map<String, String>` | `getModuleTypeMappings()` Mapping of module paths to module types.
    `Set<? extends EarModule>` | `getModules()` List of module descriptors.
    `Set<? extends EarSecurityRole>` | `getSecurityRoles()` List of security roles.
    `String` | `getVersion()` The version of application.xml.
    `DeploymentDescriptor` | `module(EarModule module, String type)` Add a module to the deployment descriptor.
    `DeploymentDescriptor` | `module(String path, String type)` Add a module to the deployment descriptor.
    `DeploymentDescriptor` | `readFrom(Reader reader)` Reads the deployment descriptor from a reader.
    `boolean` | `readFrom(Object path)` Reads the deployment descriptor from a file.
    `DeploymentDescriptor` | `securityRole(EarSecurityRole role)` Add a security role to the deployment descriptor.
    `DeploymentDescriptor` | `securityRole(String role)` Add a security role to the deployment descriptor.
    `DeploymentDescriptor` | `securityRole(Action<? extends EarSecurityRole> action)` Add a security role to the deployment descriptor after configuring it with the given action.
    `void` | `setApplicationName(String applicationName)`
    `void` | `setDescription(String description)`
    `void` | `setDisplayName(String displayName)`
    `void` | `setFileName(String fileName)`
    `void` | `setInitializeInOrder(Boolean initializeInOrder)`
    `void` | `setLibraryDirectory(String libraryDirectory)`
    `void` | `setModuleTypeMappings(Map<String, String> moduleTypeMappings)`
    `void` | `setModules(Set<? extends EarModule> modules)`
    `void` | `setSecurityRoles(Set<? extends EarSecurityRole> securityRoles)`
    `void` | `setVersion(String version)`
    `DeploymentDescriptor` | `webModule(String path, String contextRoot)` Add a web module to the deployment descriptor.
    `DeploymentDescriptor` | `withXml(groovy.lang.Closure closure)` Adds a closure to be called when the XML document has been created.
    `DeploymentDescriptor` | `withXml(Action<? super XmlProvider> action)` Adds an action to be called when the XML document has been created.
    `DeploymentDescriptor` | `writeTo(Writer writer)` Writes the deployment descriptor into a writer.
    `DeploymentDescriptor` | `writeTo(Object path)` Writes the deployment descriptor into a file.

- - ### Method Detail

    - #### public String getApplicationName()

      The application name. Optional. Only valid with version 6.

    - #### public String getDescription()

      The application description. Optional.

    - #### public String getDisplayName()

      The application display name. Optional.

    - #### public String getFileName()

      The name of the descriptor file, typically "application.xml"

    - #### public Boolean getInitializeInOrder()

      Whether to initialize modules in the order they appear in the descriptor, with the exception of client modules. Optional. Only valid with version 6.

    - #### public String getLibraryDirectory()

      The name of the directory to look for libraries in. Optional. If not specified then "lib" is assumed. Typically this should be set via EarPluginConvention.setLibDirName instead of this property.

    - #### public Map<String, String> getModuleTypeMappings()

      Mapping of module paths to module types. Non-null by default. For example, to specify that a module is a java module, set `moduleTypeMappings["myJavaModule.jar"] = "java"`.

    - #### public Set<? extends EarModule> getModules()

      List of module descriptors. Must not be empty. Non-null and order-maintaining by default. Must maintain order if initializeInOrder is `true`.

    - #### public Set<? extends EarSecurityRole> getSecurityRoles()

      List of security roles. Optional. Non-null and order-maintaining by default.

    - #### public String getVersion()

      The version of application.xml. Required. Valid versions are "1.3", "1.4", "5" and "6". Defaults to "6".

    - #### public DeploymentDescriptor module(EarModule module, String type)

      Add a module to the deployment descriptor.

      Parameters:
        `module` - The module to add.
        `type` - The type of the module, such as "ejb", "java", etc.
      Returns:
        this.

    - #### public DeploymentDescriptor module(String path, String type)

      Add a module to the deployment descriptor.

      Parameters:
        `path` - The path of the module to add.
        `type` - The type of the module, such as "ejb", "java", etc.
      Returns:
        this.

    - #### public DeploymentDescriptor readFrom(Reader reader)

      Reads the deployment descriptor from a reader.

      Parameters:
        `reader` - The reader to read the deployment descriptor from
      Returns:
        this

    - #### public boolean readFrom(Object path)

      Reads the deployment descriptor from a file. The paths are resolved as defined by Project.file

      Parameters:
        `path` - The path of the file to read the deployment descriptor from
      Returns:
        whether the descriptor could be read from the given path

    - #### public DeploymentDescriptor securityRole(EarSecurityRole role)

      Add a security role to the deployment descriptor.

      Parameters:
        `role` - The security role to add.
      Returns:
        this.

    - #### public DeploymentDescriptor securityRole(String role)

      Add a security role to the deployment descriptor.

      Parameters:
        `role` - The name of the security role to add.
      Returns:
        this.

    - #### public DeploymentDescriptor securityRole(Action<? extends EarSecurityRole> action)

      Add a security role to the deployment descriptor after configuring it with the given action.

      Parameters:
        `action` - an action to configure the security role
      Returns:
        this.

    - #### public void setApplicationName(String applicationName)

    - #### public void setDescription(String description)

    - #### public void setDisplayName(String displayName)

    - #### public void setFileName(String fileName)

    - #### public void setInitializeInOrder(Boolean initializeInOrder)

    - #### public void setLibraryDirectory(String libraryDirectory)

    - #### public void setModuleTypeMappings(Map<String, String> moduleTypeMappings)

    - #### public void setModules(Set<? extends EarModule> modules)

    - #### public void setSecurityRoles(Set<? extends EarSecurityRole> securityRoles)

    - #### public void setVersion(String version)

    - #### public DeploymentDescriptor webModule(String path, String contextRoot)

      Add a web module to the deployment descriptor.

      Parameters:
        `path` - The path of the module to add.
        `contextRoot` - The context root type of the web module.
      Returns:
        this.

    - #### public DeploymentDescriptor withXml(groovy.lang.Closure closure)

      Adds a closure to be called when the XML document has been created. The XML is passed to the closure as a parameter in form of a groovy.util.Node. The closure can modify the XML before it is written to the output file. This allows additional JavaEE version 6 elements like "data-source" or "resource-ref" to be included.

      Parameters:
        `closure` - The closure to execute when the XML has been created
      Returns:
        this

    - #### public DeploymentDescriptor withXml(Action<? super XmlProvider> action)

      Adds an action to be called when the XML document has been created. The XML is passed to the action as a parameter in form of a groovy.util.Node. The action can modify the XML before it is written to the output file. This allows additional JavaEE version 6 elements like "data-source" or "resource-ref" to be included.

      Parameters:
        `action` - The action to execute when the XML has been created
      Returns:
        this

    - #### public DeploymentDescriptor writeTo(Writer writer)

      Writes the deployment descriptor into a writer.

      Parameters:
        `writer` - The writer to write the deployment descriptor to
      Returns:
        this

    - #### public DeploymentDescriptor writeTo(Object path)

      Writes the deployment descriptor into a file. The paths are resolved as defined by Project.file

      Parameters:
        `path` - The path of the file to write the deployment descriptor into.
      Returns:
        this