# Interface DeploymentDescriptor

public interface DeploymentDescriptor
A deployment descriptor such as application.xml.

Since:
  1.0

- ## Method Summary

  Modifier and Type
  Method
  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.
  `Set<EarModule>`
  `getModules()`
  List of module descriptors.
  `Map<String,String>`
  `getModuleTypeMappings()`
  Mapping of module paths to module types.
  `Set<EarSecurityRole>`
  `getSecurityRoles()`
  List of security roles.
  `String`
  `getVersion()`
  The version of application.xml.
  `DeploymentDescriptor`
  `module(String path, String type)`
  Add a module to the deployment descriptor.
  `DeploymentDescriptor`
  `module(EarModule module, 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(String role)`
  Add a security role to the deployment descriptor.
  `DeploymentDescriptor`
  `securityRole(Action<? super EarSecurityRole> action)`
  Add a security role to the deployment descriptor after configuring it with the given action.
  `DeploymentDescriptor`
  `securityRole(EarSecurityRole role)`
  Add a security role to the deployment descriptor.
  `void`
  `setApplicationName(String applicationName)`
  Sets the application name.
  `void`
  `setDescription(String description)`
  Sets the description.
  `void`
  `setDisplayName(String displayName)`
  Sets the display name.
  `void`
  `setFileName(String fileName)`
  Sets the file name.
  `void`
  `setInitializeInOrder(Boolean initializeInOrder)`
  Sets the initialize in order.
  `void`
  `setLibraryDirectory(String libraryDirectory)`
  Sets the library directory.
  `void`
  `setModules(Set<EarModule> modules)`
  Sets the modules.
  `void`
  `setModuleTypeMappings(Map<String,String> moduleTypeMappings)`
  Sets the module type mappings.
  `void`
  `setSecurityRoles(Set<EarSecurityRole> securityRoles)`
  Sets the security roles.
  `void`
  `setVersion(String version)`
  Sets the version.
  `DeploymentDescriptor`
  `webModule(String path, String contextRoot)`
  Add a web module to the deployment descriptor.
  `DeploymentDescriptor`
  `withXml(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 Details

  - ### getFileName

    String getFileName()
    The name of the descriptor file, typically "application.xml"
    Since:
      1.0

  - ### setFileName

    void setFileName(String fileName)
    Sets the file name.
    Since:
      1.0

  - ### getVersion

    String getVersion()
    The version of application.xml. Required. Valid versions are "1.3", "1.4", "5", "6", "7", "8", "9", "10" and "11". Defaults to "6".
    Since:
      1.0

  - ### setVersion

    void setVersion(String version)
    Sets the version.
    Since:
      1.0

  - ### getApplicationName

    String getApplicationName()
    The application name. Optional. Only valid with version 6.
    Since:
      1.0

  - ### setApplicationName

    void setApplicationName(String applicationName)
    Sets the application name.
    Since:
      1.0

  - ### getInitializeInOrder

    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.
    Since:
      1.0

  - ### setInitializeInOrder

    void setInitializeInOrder(Boolean initializeInOrder)
    Sets the initialize in order.
    Since:
      1.0

  - ### getDescription

    String getDescription()
    The application description. Optional.
    Since:
      1.0

  - ### setDescription

    void setDescription(String description)
    Sets the description.
    Since:
      1.0

  - ### getDisplayName

    String getDisplayName()
    The application display name. Optional.
    Since:
      1.0

  - ### setDisplayName

    void setDisplayName(String displayName)
    Sets the display name.
    Since:
      1.0

  - ### getLibraryDirectory

    String getLibraryDirectory()
    The name of the directory to look for libraries in. Optional. If not specified, `Ear.getLibDirName()` is used.
    Since:
      1.0

  - ### setLibraryDirectory

    void setLibraryDirectory(String libraryDirectory)
    Sets the library directory.
    Since:
      1.0

  - ### getModules

    Set<EarModule> getModules()
    List of module descriptors. Must not be empty. Non-null and order-maintaining by default. Must maintain order if initializeInOrder is `true`.
    Since:
      1.0

  - ### setModules

    void setModules(Set<EarModule> modules)
    Sets the modules.
    Since:
      1.0

  - ### module

    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.
    Since:
      1.0

  - ### module

    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.
    Since:
      1.0

  - ### webModule

    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.
    Since:
      1.0

  - ### getSecurityRoles

    Set<EarSecurityRole> getSecurityRoles()
    List of security roles. Optional. Non-null and order-maintaining by default.
    Since:
      1.0

  - ### setSecurityRoles

    void setSecurityRoles(Set<EarSecurityRole> securityRoles)
    Sets the security roles.
    Since:
      1.0

  - ### securityRole

    DeploymentDescriptor securityRole(EarSecurityRole role)
    Add a security role to the deployment descriptor.
    Parameters:
      `role` - The security role to add.
    Returns:
      this.
    Since:
      1.0

  - ### securityRole

    DeploymentDescriptor securityRole(String role)
    Add a security role to the deployment descriptor.
    Parameters:
      `role` - The name of the security role to add.
    Returns:
      this.
    Since:
      1.0

  - ### securityRole

    DeploymentDescriptor securityRole(Action<? super 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.
    Since:
      2.1

  - ### getModuleTypeMappings

    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"`.
    Since:
      1.0

  - ### setModuleTypeMappings

    void setModuleTypeMappings(Map<String,String> moduleTypeMappings)
    Sets the module type mappings.
    Since:
      1.0

  - ### withXml

    DeploymentDescriptor withXml(@DelegatesTo(XmlProvider.class) 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 `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
    Since:
      1.0

  - ### withXml

    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 `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
    Since:
      1.0

  - ### readFrom

    DeploymentDescriptor readFrom(Reader reader)
    Reads the deployment descriptor from a reader.
    Parameters:
      `reader` - The reader to read the deployment descriptor from
    Returns:
      this
    Since:
      1.0

  - ### readFrom

    boolean readFrom(Object path)
    Reads the deployment descriptor from a file. The paths are resolved as defined by `Project.file(Object)`
    Parameters:
      `path` - The path of the file to read the deployment descriptor from
    Returns:
      whether the descriptor could be read from the given path
    Since:
      1.0

  - ### writeTo

    DeploymentDescriptor writeTo(Writer writer)
    Writes the deployment descriptor into a writer.
    Parameters:
      `writer` - The writer to write the deployment descriptor to
    Returns:
      this
    Since:
      1.0

  - ### writeTo

    DeploymentDescriptor writeTo(Object path)
    Writes the deployment descriptor into a file. The paths are resolved as defined by `Project.file(Object)`
    Parameters:
      `path` - The path of the file to write the deployment descriptor into.
    Returns:
      this
    Since:
      1.0