org.wildfly.plugin.core

## Class Deployment

- java.lang.Object
- - org.wildfly.plugin.core.Deployment

- All Implemented Interfaces:
    Comparable<Deployment>, DeploymentDescription

      public class Deployment
      extends Object
      implements DeploymentDescription, Comparable<Deployment>

  Represents a deployment to be deployed or redeployed to a server.

  Instances of this are not thread-safe.

  Author:
    James R. Perkins

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Deployment` | `addServerGroup(String serverGroup)` Adds a server group for the deployment.
    `Deployment` | `addServerGroups(Collection<String> serverGroups)` Adds the server groups for the deployment.
    `Deployment` | `addServerGroups(String... serverGroups)` Adds the server groups for the deployment.
    `int` | `compareTo(Deployment o)`
    `boolean` | `equals(Object obj)`
    `String` | `getName()` Returns the name for this deployment.
    `String` | `getRuntimeName()` Returns the runtime name set for the deployment which may be `null`.
    `Set<String>` | `getServerGroups()` Returns the server groups for this deployment.
    `int` | `hashCode()`
    `boolean` | `isEnabled()` Indicates whether or not the deployment should be enabled by default.
    `static Deployment` | `of(File content)` Creates a new deployment for the file.
    `static Deployment` | `of(InputStream content, String name)` Creates a new deployment for the input stream.
    `static Deployment` | `of(Path content)` Creates a new deployment for the path.
    `static Deployment` | `of(URL url)` Creates a new deployment for the URL.
    `Deployment` | `setEnabled(boolean enabled)` Sets whether or not the deployment should be enabled.
    `Deployment` | `setName(String name)` Sets the name for the deployment.
    `Deployment` | `setRuntimeName(String runtimeName)` Sets the runtime name for the deployment.
    `Deployment` | `setServerGroups(Collection<String> serverGroups)` Sets the server groups for the deployment.
    `Deployment` | `setServerGroups(String... serverGroups)` Sets the server groups for the deployment.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### of

          public static Deployment of(File content)

      Creates a new deployment for the file. If the file is a directory the content will be deployed exploded using the file system location.
      Parameters:
        `content` - the file containing the content
      Returns:
        the deployment

    - #### of

          public static Deployment of(Path content)

      Creates a new deployment for the path. If the path is a directory the content will be deployed exploded using the file system location.
      Parameters:
        `content` - the path containing the content
      Returns:
        the deployment

    - #### of

          public static Deployment of(InputStream content,
                                      String name)

      Creates a new deployment for the input stream. The name is required for the deployment and cannot be `null`. If `setName(String)` with a `null` argument is invoked when using this static factory an `IllegalArgumentException` will be thrown.

      The content will be copied, stored in-memory and then closed. Large content should be written to a file and the `of(Path)` or `of(File)` static factory methods should be used.

      Parameters:
        `content` - the input stream representing the content
        `name` - the name for the deployment
      Returns:
        the deployment

    - #### of

          public static Deployment of(URL url)

      Creates a new deployment for the URL. The target server will require access to the URL.
      Parameters:
        `url` - the URL representing the content
      Returns:
        the deployment

    - #### addServerGroup

          public Deployment addServerGroup(String serverGroup)

      Adds a server group for the deployment.
      Parameters:
        `serverGroup` - the server group to add
      Returns:
        this deployment
      See Also:
        `addServerGroups(Collection)`, `addServerGroups(String...)`

    - #### addServerGroups

          public Deployment addServerGroups(String... serverGroups)

      Adds the server groups for the deployment.
      Parameters:
        `serverGroups` - the server groups to add
      Returns:
        this deployment
      See Also:
        `addServerGroup(String)`, `addServerGroups(Collection)`

    - #### addServerGroups

          public Deployment addServerGroups(Collection<String> serverGroups)

      Adds the server groups for the deployment.
      Parameters:
        `serverGroups` - the server groups to add
      Returns:
        this deployment
      See Also:
        `addServerGroup(String)`, `addServerGroups(String...)`

    - #### getServerGroups

          public Set<String> getServerGroups()

      Description copied from interface: `DeploymentDescription`
      Returns the server groups for this deployment.
      Specified by:
        `getServerGroups` in interface `DeploymentDescription`
      Returns:
        a set of server groups for this deployment

    - #### setServerGroups

          public Deployment setServerGroups(String... serverGroups)

      Sets the server groups for the deployment.
      Parameters:
        `serverGroups` - the server groups to set
      Returns:
        this deployment

    - #### setServerGroups

          public Deployment setServerGroups(Collection<String> serverGroups)

      Sets the server groups for the deployment.
      Parameters:
        `serverGroups` - the server groups to set
      Returns:
        this deployment

    - #### isEnabled

          public boolean isEnabled()

      Indicates whether or not the deployment should be enabled by default.

      If the value is set to `false` the content will only be added. An explicit `deploy` operation will be required to deploy the content to the runtime.

      Returns:
        `true` if the deployment should be enabled, `false` if the deployment should not be enabled

    - #### setEnabled

          public Deployment setEnabled(boolean enabled)

      Sets whether or not the deployment should be enabled. If set to `false` the deployment will not be enabled, but the content will be uploaded and added. This is set to `true` by default.

      If the value is set to `false` the content will only be added. An explicit `deploy` operation will be required to deploy the content to the runtime.

      Parameters:
        `enabled` - `false` to keep the content disabled
      Returns:
        this deployment

    - #### getName

          public String getName()

      Description copied from interface: `DeploymentDescription`
      Returns the name for this deployment.
      Specified by:
        `getName` in interface `DeploymentDescription`
      Returns:
        the name for this deployment

    - #### setName

          public Deployment setName(String name)

      Sets the name for the deployment. This can be `null` for a deployment created based on a file system path. If the deployment was created using in input stream and the value is `null` an `IllegalArgumentException` will be thrown.
      Parameters:
        `name` - the name for the deployment
      Returns:
        this deployment

    - #### getRuntimeName

          public String getRuntimeName()

      Returns the runtime name set for the deployment which may be `null`.
      Returns:
        the runtime name set or `null` if one was not set

    - #### setRuntimeName

          public Deployment setRuntimeName(String runtimeName)

      Sets the runtime name for the deployment.
      Parameters:
        `runtimeName` - the runtime name, can be `null`
      Returns:
        this deployment

    - #### compareTo

          public int compareTo(Deployment o)

      Specified by:
        `compareTo` in interface `Comparable<Deployment>`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 JBoss by Red Hat. All rights reserved.