Package org.wildfly.plugin.common

## Class ServerOperations

- java.lang.Object
- - org.jboss.as.controller.client.helpers.Operations
  - - org.wildfly.plugin.common.ServerOperations

-     public class ServerOperations
      extends org.jboss.as.controller.client.helpers.Operations

  A helper for creating operations.
  Author:
    James R. Perkins

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.jboss.as.controller.client.helpers.Operations

      `org.jboss.as.controller.client.helpers.Operations.CompositeOperationBuilder`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `ARCHIVE` |
    `static String` | `BYTES` |
    `static String` | `ENABLE` |
    `static String` | `ENABLED` |
    `static String` | `INPUT_STREAM_INDEX` |
    `static String` | `LAUNCH_TYPE` |
    `static String` | `PROFILE` |
    `static String` | `READ_CHILDREN_NAMES` |
    `static String` | `READ_RESOURCE` |
    `static String` | `RELOAD` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ServerOperations()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static org.jboss.dmr.ModelNode` | `createAddress​(String... pairs)` | Creates an address from the consecutive pairs.
    `static org.jboss.dmr.ModelNode` | `createAddress​(String key, String name)` |
    `static org.jboss.dmr.ModelNode` | `createListDeploymentsOperation()` | Creates an operation to list the deployments.
    `static org.jboss.dmr.ModelNode` | `createOperation​(String operation, org.jboss.dmr.ModelNode address, boolean recursive)` | Creates an operation.
    `static org.jboss.dmr.ModelNode` | `createReadAttributeOperation​(String attributeName)` | Creates an operation to read the attribute represented by the `attributeName` parameter.
    `static org.jboss.dmr.ModelNode` | `createRemoveOperation​(org.jboss.dmr.ModelNode address, boolean recursive)` | Creates a remove operation.
    `static org.jboss.dmr.Property` | `getChildAddress​(org.jboss.dmr.ModelNode address)` | Finds the last entry of the address list and returns it as a property.
    `static String` | `getFailureDescriptionAsString​(org.jboss.dmr.ModelNode result)` | Parses the result and returns the failure description.
    `static org.jboss.dmr.ModelNode` | `getParentAddress​(org.jboss.dmr.ModelNode address)` | Finds the parent address, everything before the last address part.
    `static String` | `readResultAsString​(org.jboss.dmr.ModelNode result)` | Reads the result of an operation and returns the result as a string.

    - ### Methods inherited from class org.jboss.as.controller.client.helpers.Operations

      `createAddOperation, createAddress, createCompositeOperation, createOperation, createOperation, createReadAttributeOperation, createReadResourceOperation, createReadResourceOperation, createRemoveOperation, createUndefineAttributeOperation, createWriteAttributeOperation, createWriteAttributeOperation, createWriteAttributeOperation, createWriteAttributeOperation, createWriteAttributeOperation, getFailureDescription, getOperationAddress, getOperationName, isSuccessfulOutcome, readResult`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ARCHIVE

          public static final String ARCHIVE

      See Also:
        Constant Field Values

    - #### BYTES

          public static final String BYTES

      See Also:
        Constant Field Values

    - #### ENABLE

          public static final String ENABLE

      See Also:
        Constant Field Values

    - #### ENABLED

          public static final String ENABLED

      See Also:
        Constant Field Values

    - #### INPUT_STREAM_INDEX

          public static final String INPUT_STREAM_INDEX

      See Also:
        Constant Field Values

    - #### LAUNCH_TYPE

          public static final String LAUNCH_TYPE

      See Also:
        Constant Field Values

    - #### PROFILE

          public static final String PROFILE

      See Also:
        Constant Field Values

    - #### READ_CHILDREN_NAMES

          public static final String READ_CHILDREN_NAMES

      See Also:
        Constant Field Values

    - #### READ_RESOURCE

          public static final String READ_RESOURCE

      See Also:
        Constant Field Values

    - #### RELOAD

          public static final String RELOAD

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ServerOperations

          public ServerOperations()

  - ### Method Detail

    - #### getFailureDescriptionAsString

          public static String getFailureDescriptionAsString​(org.jboss.dmr.ModelNode result)

      Parses the result and returns the failure description. If the result was successful, an empty string is returned.
      Parameters:
        `result` - the result of executing an operation
      Returns:
        the failure message or an empty string

    - #### createListDeploymentsOperation

          public static org.jboss.dmr.ModelNode createListDeploymentsOperation()

      Creates an operation to list the deployments.
      Returns:
        the operation

    - #### createRemoveOperation

          public static org.jboss.dmr.ModelNode createRemoveOperation​(org.jboss.dmr.ModelNode address,
                                                                      boolean recursive)

      Creates a remove operation.
      Parameters:
        `address` - the address for the operation
        `recursive` - `true` if the remove should be recursive, otherwise `false`
      Returns:
        the operation

    - #### createReadAttributeOperation

          public static org.jboss.dmr.ModelNode createReadAttributeOperation​(String attributeName)

      Creates an operation to read the attribute represented by the `attributeName` parameter.
      Parameters:
        `attributeName` - the name of the parameter to read
      Returns:
        the operation

    - #### createAddress

          public static org.jboss.dmr.ModelNode createAddress​(String key,
                                                              String name)

    - #### createAddress

          public static org.jboss.dmr.ModelNode createAddress​(String... pairs)

      Creates an address from the consecutive pairs. If there is an odd number of arguments the last argument will be a wildcard (`*`).
      Parameters:
        `pairs` - the name/value pairs to create the address for
      Returns:
        the address for the arguments

    - #### createOperation

          public static org.jboss.dmr.ModelNode createOperation​(String operation,
                                                                org.jboss.dmr.ModelNode address,
                                                                boolean recursive)

      Creates an operation.
      Parameters:
        `operation` - the operation name
        `address` - the address for the operation
        `recursive` - whether the operation is recursive or not
      Returns:
        the operation
      Throws:
        `IllegalArgumentException` - if the address is not of type `ModelType.LIST`

    - #### getChildAddress

          public static org.jboss.dmr.Property getChildAddress​(org.jboss.dmr.ModelNode address)

      Finds the last entry of the address list and returns it as a property.
      Parameters:
        `address` - the address to get the last part of
      Returns:
        the last part of the address
      Throws:
        `IllegalArgumentException` - if the address is not of type `ModelType.LIST` or is empty

    - #### getParentAddress

          public static org.jboss.dmr.ModelNode getParentAddress​(org.jboss.dmr.ModelNode address)

      Finds the parent address, everything before the last address part.
      Parameters:
        `address` - the address to get the parent
      Returns:
        the parent address
      Throws:
        `IllegalArgumentException` - if the address is not of type `ModelType.LIST` or is empty

    - #### readResultAsString

          public static String readResultAsString​(org.jboss.dmr.ModelNode result)

      Reads the result of an operation and returns the result as a string. If the operation does not have a `ClientConstants.RESULT` attribute and empty string is returned.
      Parameters:
        `result` - the result of executing an operation
      Returns:
        the result of the operation or an empty string