java.lang.Object
org.wildfly.plugin.tools.server.DomainManager
- All Implemented Interfaces:
ServerManager
A utility for executing management operations on domain servers.
- Author:
- James R. Perkins
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.wildfly.plugin.tools.server.ServerManager
ServerManager.Builder -
Method Summary
Modifier and TypeMethodDescriptionorg.jboss.as.controller.client.ModelControllerClientclient()Returns the client associated with this server manager.Returns the container description for the running server.Returns the deployment manager for the server.org.jboss.dmr.ModelNodeDetermines the address for the host being used.voidReloads the server and returns immediately.voidexecuteReload(org.jboss.dmr.ModelNode reloadOp) Reloads the server and returns immediately.booleanChecks to see if the domain is running.Determines the servers "launch-type".voidChecks if the container status is "reload-required" and if it's the case, executes reload and waits for completion with a 10 second timeout.voidreloadIfRequired(long timeout, TimeUnit unit) Checks if the container status is "reload-required" and if it's the case, executes reload and waits for completion.Gets the "server-state" for standalone servers or the "host-state" for domain servers.voidshutdown()Shuts down the server.voidshutdown(long timeout) Shuts down the server.Takes a snapshot of the current servers configuration and returns the relative file name of the snapshot.booleanWaits the given amount of time for a server to start.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.plugin.tools.server.ServerManager
waitFor
-
Method Details
-
client
public org.jboss.as.controller.client.ModelControllerClient client()Description copied from interface:ServerManagerReturns the client associated with this server manager.- Returns:
- a client to communicate with the server
-
serverState
Description copied from interface:ServerManagerGets the "server-state" for standalone servers or the "host-state" for domain servers.- Returns:
- the server-state or "failed" if an error occurred
-
determineHostAddress
public org.jboss.dmr.ModelNode determineHostAddress() throws OperationExecutionException, IOExceptionDetermines the address for the host being used.- Returns:
- the address of the host
- Throws:
IOException- if an error occurs communicating with the serverOperationExecutionException- if the operation used to determine the host name fails
-
isRunning
public boolean isRunning()Checks to see if the domain is running. If the server is not in admin only mode each servers running state is checked. If any server is not in a started state the domain is not considered to be running.- Returns:
trueif the server is in a running state, otherwisefalse
-
shutdown
Description copied from interface:ServerManagerShuts down the server.- Throws:
IOException- if an error occurs communicating with the serverOperationExecutionException
-
shutdown
Description copied from interface:ServerManagerShuts down the server.- Parameters:
timeout- the graceful shutdown timeout, a value of-1will wait indefinitely and a value of0will not attempt a graceful shutdown- Throws:
IOException- if an error occurs communicating with the server
-
executeReload
public void executeReload()Description copied from interface:ServerManagerReloads the server and returns immediately. -
reloadIfRequired
Description copied from interface:ServerManagerChecks if the container status is "reload-required" and if it's the case, executes reload and waits for completion with a 10 second timeout.- Throws:
IOException- if an error occurs communicating with the server- See Also:
-
reloadIfRequired
Description copied from interface:ServerManagerChecks if the container status is "reload-required" and if it's the case, executes reload and waits for completion.- Parameters:
timeout- the time to wait for the server to reloadunit- the time unit for thetimeoutargument- Throws:
IOException- if an error occurs communicating with the server
-
containerDescription
Description copied from interface:ServerManagerReturns the container description for the running server.- Specified by:
containerDescriptionin interfaceServerManager- Returns:
- the container description for the running server
- Throws:
IOException- if an error occurs communicating with the server
-
deploymentManager
Description copied from interface:ServerManagerReturns the deployment manager for the server.- Specified by:
deploymentManagerin interfaceServerManager- Returns:
- the deployment manager
-
launchType
Determines the servers "launch-type".- Specified by:
launchTypein interfaceServerManager- Returns:
- the servers launch-type or "unknown" if it could not be determined
-
waitFor
Description copied from interface:ServerManagerWaits the given amount of time for a server to start.If the
processis notnulland a timeout occurs the process will be destroyed.- Specified by:
waitForin interfaceServerManager- Parameters:
startupTimeout- the time, to wait for the server startunit- the time unit for thestartupTimeoutargument- Returns:
trueif the server is up and running,falseif a timeout occurred waiting for the server to be in a running state- Throws:
InterruptedException- if interrupted while waiting for the server to start
-
takeSnapshot
Takes a snapshot of the current servers configuration and returns the relative file name of the snapshot.This simply executes the
take-snapshotoperation with no arguments.- Specified by:
takeSnapshotin interfaceServerManager- Returns:
- the file name of the snapshot configuration file
- Throws:
IOException- if an error occurs executing the operation
-
executeReload
public void executeReload(org.jboss.dmr.ModelNode reloadOp) Reloads the server and returns immediately.- Specified by:
executeReloadin interfaceServerManager- Parameters:
reloadOp- the reload operation to execute
-