Package org.wildfly.plugin.tools.server
Class ServerManager.Builder
java.lang.Object
org.wildfly.plugin.tools.server.ServerManager.Builder
- Enclosing interface:
ServerManager
A builder used to build a
ServerManager
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates either aDomainManager
orStandaloneManager
based on theServerManager.launchType(ModelControllerClient)
.client
(org.jboss.as.controller.client.ModelControllerClient client) Sets the client to use for the server manager.domain()
Creates aDomainManager
based on the builders settings.managementAddress
(String managementAddress) The management address to use for the client if the client has not been set.managementPort
(int managementPort) The management port to use for the client if the client has not been set.The process to associate with the server manager.process
(ProcessHandle process) The process handle to associate with the server manager.shutdownOnClose
(boolean shutdownOnClose) Creates aStandaloneManager
based on the builders settings.
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
client
Sets the client to use for the server manager.If the this server manager is closed, the client will also be closed.
- Parameters:
client
- the client to use to communicate with the server- Returns:
- this builder
-
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
The process to associate with the server manager. If theprocess
argument is notnull
, this simply invokesprocess(process.toHandle())
.- Parameters:
process
- the process to associate with the server manager- Returns:
- this builder
- See Also:
-
managementAddress
The management address to use for the client if the client has not been set.- Parameters:
managementAddress
- the management address, default islocalhost
- Returns:
- this builder
-
managementPort
The management port to use for the client if the client has not been set.- Parameters:
managementPort
- the management port, default is9990
- Returns:
- this builder
-
shutdownOnClose
- Parameters:
shutdownOnClose
-true
to shutdown the server when the server manager is closed- Returns:
- this builder
- Since:
- 1.2
-
standalone
Creates aStandaloneManager
based on the builders settings. If theclient
was not set, themanagementAddress
and themanagementPort
will be used to create the client.- Returns:
- a new
StandaloneManager
-
domain
Creates aDomainManager
based on the builders settings. If theclient
was not set, themanagementAddress
and themanagementPort
will be used to create the client.- Returns:
- a new
DomainManager
-
build
Creates either aDomainManager
orStandaloneManager
based on theServerManager.launchType(ModelControllerClient)
. If theclient
was not set, themanagementAddress
and themanagementPort
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()
ordomain()
server manager type, or use theCompletableFuture.get(long, TimeUnit)
method to timeout if a server was never started.- Returns:
- a completable future that will eventually produce a
DomainManager
orStandaloneManager
assuming a server is running
-