Package org.wildfly.plugin.tools.server

## Class ServerManager.Builder

- java.lang.Object
- - org.wildfly.plugin.tools.server.ServerManager.Builder

- Enclosing interface:
    ServerManager

      public static class ServerManager.Builder
      extends Object

  A builder used to build a `ServerManager`.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletableFuture<ServerManager>` | `build()` | Creates either a `DomainManager` or `StandaloneManager` based on the `ServerManager.launchType(ModelControllerClient)`.
    `ServerManager.Builder` | `client​(org.jboss.as.controller.client.ModelControllerClient client)` | Sets the client to use for the server manager.
    `DomainManager` | `domain()` | Creates a `DomainManager` based on the builders settings.
    `ServerManager.Builder` | `managementAddress​(String managementAddress)` | The management address to use for the client if the client has not been set.
    `ServerManager.Builder` | `managementPort​(int managementPort)` | The management port to use for the client if the client has not been set.
    `ServerManager.Builder` | `process​(Process process)` | The process to associate with the server manager.
    `ServerManager.Builder` | `process​(ProcessHandle process)` | The process handle to associate with the server manager.
    `StandaloneManager` | `standalone()` | Creates a `StandaloneManager` based on the builders settings.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder()

  - ### Method Detail

    - #### client

          public ServerManager.Builder client​(org.jboss.as.controller.client.ModelControllerClient client)

      Sets the client to use for the server manager.
      Parameters:
        `client` - the client to use to communicate with the server
      Returns:
        this builder

    - #### process

          public ServerManager.Builder process​(ProcessHandle process)

      The process handle to associate with the server manager.
      Parameters:
        `process` - the process handle to associate with the server manager
      Returns:
        this builder

    - #### process

          public ServerManager.Builder process​(Process process)

      The process to associate with the server manager. If the `process` argument is not `null`, this simply invokes `process(process.toHandle())`.
      Parameters:
        `process` - the process to associate with the server manager
      Returns:
        this builder
      See Also:
        `process(ProcessHandle)`

    - #### managementAddress

          public ServerManager.Builder managementAddress​(String managementAddress)

      The management address to use for the client if the client has not been set.
      Parameters:
        `managementAddress` - the management address, default is `localhost`
      Returns:
        this builder

    - #### managementPort

          public ServerManager.Builder managementPort​(int managementPort)

      The management port to use for the client if the client has not been set.
      Parameters:
        `managementPort` - the management port, default is `9990`
      Returns:
        this builder

    - #### standalone

          public StandaloneManager standalone()

      Creates a `StandaloneManager` based on the builders settings. If the `client` was not set, the `managementAddress` and the `managementPort` will be used to create the client.
      Returns:
        a new `StandaloneManager`

    - #### domain

          public DomainManager domain()

      Creates a `DomainManager` based on the builders settings. If the `client` was not set, the `managementAddress` and the `managementPort` will be used to create the client.
      Returns:
        a new `DomainManager`

    - #### build

          public CompletableFuture<ServerManager> build()

      Creates either a `DomainManager` or `StandaloneManager` based on the `ServerManager.launchType(ModelControllerClient)`. If the `client` was not set, the `managementAddress` and the `managementPort` will be used to create the client.

      Note that if the process was not set, the future may never complete if a server is never started. It's best practice to either use a known `standalone()` or `domain()` server manager type, or use the `CompletableFuture.get(long, TimeUnit)` method to timeout if a server was never started.

      Returns:
        a completable future that will eventually produce a `DomainManager` or `StandaloneManager` assuming a server is running