Class DomainClientImpl

java.lang.Object
org.jboss.as.controller.client.helpers.domain.impl.DomainClientImpl
All Implemented Interfaces:
Closeable, AutoCloseable, DomainClient, ModelControllerClient

public class DomainClientImpl extends Object implements DomainClient
Domain client implementation.
Author:
John Bailey
  • Constructor Details

  • Method Details

    • execute

      public ModelNode execute(ModelNode operation) throws IOException
      Description copied from interface: ModelControllerClient
      Execute an operation synchronously.
      Specified by:
      execute in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      Returns:
      the result of the operation
      Throws:
      IOException - if an I/O error occurs while executing the operation
    • execute

      public ModelNode execute(Operation operation) throws IOException
      Description copied from interface: ModelControllerClient
      Execute an operation synchronously. Note that associated input-streams have to be closed by the caller, after the operation completed OperationAttachments.isAutoCloseStreams().
      Specified by:
      execute in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      Returns:
      the result of the operation
      Throws:
      IOException - if an I/O error occurs while executing the operation
    • execute

      public ModelNode execute(ModelNode operation, OperationMessageHandler messageHandler) throws IOException
      Description copied from interface: ModelControllerClient
      Execute an operation synchronously, optionally receiving progress reports.
      Specified by:
      execute in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the result of the operation
      Throws:
      IOException - if an I/O error occurs while executing the operation
    • execute

      public ModelNode execute(Operation operation, OperationMessageHandler messageHandler) throws IOException
      Description copied from interface: ModelControllerClient
      Execute an operation synchronously, optionally receiving progress reports.

      Note that associated input-streams have to be closed by the caller, after the operation completed OperationAttachments.isAutoCloseStreams().

      Specified by:
      execute in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the result of the operation
      Throws:
      IOException - if an I/O error occurs while executing the operation
    • executeAsync

      public org.jboss.threads.AsyncFuture<ModelNode> executeAsync(ModelNode operation, OperationMessageHandler messageHandler)
      Description copied from interface: ModelControllerClient
      Execute an operation in another thread, optionally receiving progress reports.
      Specified by:
      executeAsync in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the future result of the operation
    • executeAsync

      public org.jboss.threads.AsyncFuture<ModelNode> executeAsync(Operation operation, OperationMessageHandler messageHandler)
      Description copied from interface: ModelControllerClient
      Execute an operation in another thread, optionally receiving progress reports.

      Note that associated input-streams have to be closed by the caller, after the operation completed OperationAttachments.isAutoCloseStreams().

      Specified by:
      executeAsync in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the future result of the operation
    • executeOperation

      public OperationResponse executeOperation(Operation operation, OperationMessageHandler messageHandler) throws IOException
      Description copied from interface: ModelControllerClient
      Execute an operation synchronously, optionally receiving progress reports, with the response to the operation making available any input streams that the server may associate with the response.

      Note that associated input-streams have to be closed by the caller, after the operation completed OperationAttachments.isAutoCloseStreams().

      Specified by:
      executeOperation in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the result of the operation
      Throws:
      IOException - if an I/O error occurs while executing the operation
    • executeOperationAsync

      public org.jboss.threads.AsyncFuture<OperationResponse> executeOperationAsync(Operation operation, OperationMessageHandler messageHandler)
      Description copied from interface: ModelControllerClient
      Execute an operation in another thread, optionally receiving progress reports, with the response to the operation making available any input streams that the server may associate with the response.

      Note that associated input-streams have to be closed by the caller, after the operation completed OperationAttachments.isAutoCloseStreams().

      Specified by:
      executeOperationAsync in interface ModelControllerClient
      Parameters:
      operation - the operation to execute
      messageHandler - the message handler to use for operation progress reporting, or null for none
      Returns:
      the future result of the operation
    • addDeploymentContent

      public byte[] addDeploymentContent(InputStream stream)
      Description copied from interface: DomainClient
      Add the content for a deployment to the domain controller. Note that the DomainDeploymentManager offers a more convenient API for manipulating domain deployments.
      Specified by:
      addDeploymentContent in interface DomainClient
      Parameters:
      stream - the data stream for the deployment
      Returns:
      the unique hash for the deployment
    • getDeploymentManager

      public DomainDeploymentManager getDeploymentManager()
      Description copied from interface: DomainClient
      Gets a DomainDeploymentManager that provides a convenience API for manipulating domain deployments.
      Specified by:
      getDeploymentManager in interface DomainClient
      Returns:
      the deployment manager. Will not be null
    • getHostControllerNames

      public List<String> getHostControllerNames()
      Description copied from interface: DomainClient
      Gets the list of currently running host controllers.
      Specified by:
      getHostControllerNames in interface DomainClient
      Returns:
      the names of the host controllers. Will not be null
    • getServerStatuses

      public Map<ServerIdentity,ServerStatus> getServerStatuses()
      Description copied from interface: DomainClient
      Gets a list of all servers known to the domain, along with their current status. Servers associated with host controllers that are currently off line will not be included.
      Specified by:
      getServerStatuses in interface DomainClient
      Returns:
      the servers and their current status. Will not be null
    • startServer

      public ServerStatus startServer(String hostControllerName, String serverName)
      Description copied from interface: DomainClient
      Starts the given server. Ignored if the server is not stopped.
      Specified by:
      startServer in interface DomainClient
      Parameters:
      hostControllerName - the name of the host controller responsible for the server
      serverName - the name of the server
      Returns:
      the status of the server following the start. Will not be null
    • stopServer

      public ServerStatus stopServer(String hostControllerName, String serverName, long gracefulShutdownTimeout, TimeUnit timeUnit)
      Description copied from interface: DomainClient
      Stops the given server.
      Specified by:
      stopServer in interface DomainClient
      Parameters:
      hostControllerName - the name of the host controller responsible for the server
      serverName - the name of the server
      gracefulShutdownTimeout - maximum period to wait to allow the server to gracefully handle long running tasks before shutting down, or -1 to shutdown immediately
      timeUnit - time unit in which gracefulShutdownTimeout is expressed
      Returns:
      the status of the server following the stop. Will not be null
    • restartServer

      public ServerStatus restartServer(String hostControllerName, String serverName, long gracefulShutdownTimeout, TimeUnit timeUnit)
      Description copied from interface: DomainClient
      Restarts the given server.
      Specified by:
      restartServer in interface DomainClient
      Parameters:
      hostControllerName - the name of the host controller responsible for the server
      serverName - the name of the server
      gracefulShutdownTimeout - maximum period to wait to allow the server to gracefully handle long running tasks before shutting down, or -1 to shutdown immediately
      timeUnit - time unit in which gracefulShutdownTimeout is expressed
      Returns:
      the status of the server following the restart. Will not be null
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException