public class ServerHelper extends Object
| Constructor and Description |
|---|
ServerHelper() |
| Modifier and Type | Method and Description |
|---|---|
static org.jboss.dmr.ModelNode |
determineHostAddress(org.jboss.as.controller.client.ModelControllerClient client)
Determines the address for the host being used.
|
static ContainerDescription |
getContainerDescription(org.jboss.as.controller.client.ModelControllerClient client)
Returns the description of the running container.
|
static boolean |
isDomainRunning(org.jboss.as.controller.client.ModelControllerClient client)
Checks to see if the domain is running.
|
static boolean |
isDomainServer(org.jboss.as.controller.client.ModelControllerClient client)
Deprecated.
|
static boolean |
isStandaloneRunning(org.jboss.as.controller.client.ModelControllerClient client)
Checks to see if a standalone server is running.
|
static boolean |
isValidHomeDirectory(Path path)
Checks whether or not the directory is a valid home directory for a server.
|
static boolean |
isValidHomeDirectory(String path)
Checks whether or not the directory is a valid home directory for a server.
|
static void |
shutdownDomain(org.jboss.as.controller.client.ModelControllerClient client)
Shuts down a managed domain container.
|
static void |
shutdownDomain(org.jboss.as.controller.client.ModelControllerClient client,
int timeout)
Shuts down a managed domain container.
|
static void |
shutdownStandalone(org.jboss.as.controller.client.ModelControllerClient client)
Shuts down a standalone server.
|
static void |
shutdownStandalone(org.jboss.as.controller.client.ModelControllerClient client,
int timeout)
Shuts down a standalone server.
|
static void |
waitForDomain(org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
Waits the given amount of time in seconds for a managed domain to start.
|
static void |
waitForDomain(Process process,
org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
Waits the given amount of time in seconds for a managed domain to start.
|
static void |
waitForStandalone(org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
Waits the given amount of time in seconds for a standalone server to start.
|
static void |
waitForStandalone(Process process,
org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
Waits the given amount of time in seconds for a standalone server to start.
|
public static boolean isValidHomeDirectory(Path path)
This validates the path is not null, exists, is a directory and contains a jboss-modules.jar.
path - the path to validatetrue if the path is valid otherwise falsepublic static boolean isValidHomeDirectory(String path)
This validates the path is not null, exists, is a directory and contains a jboss-modules.jar.
path - the path to validatetrue if the path is valid otherwise falsepublic static ContainerDescription getContainerDescription(org.jboss.as.controller.client.ModelControllerClient client) throws IOException, OperationExecutionException
client - the client used to query the serverIOException - if an error occurs communicating with the serverOperationExecutionException - if the operation used to query the container fails@Deprecated public static boolean isDomainServer(org.jboss.as.controller.client.ModelControllerClient client) throws IOException
ContainerDescription.isDomain()
Note that if the operation fails this will return false. It's better to use the
ContainerDescription.isDomain() which can be queried via the
getContainerDescription(ModelControllerClient). This will throw a OperationExecutionException
if the operation fails.
client - the client used to query the servertrue if the running server is a managed domain, otherwise falseIOException - if an error occurs communicating with the servergetContainerDescription(ModelControllerClient)public static void waitForDomain(org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
throws InterruptedException,
RuntimeException,
TimeoutException
client - the client used to communicate with the serverstartupTimeout - the time, in seconds, to wait for the server startInterruptedException - if interrupted while waiting for the server to startRuntimeException - if the process has diedTimeoutException - if the timeout has been reached and the server is still not startedpublic static void waitForDomain(Process process, org.jboss.as.controller.client.ModelControllerClient client, long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException
If the process is not null and a timeout occurs the process will be
destroyed.
process - the Java process can be null if no process is availableclient - the client used to communicate with the serverstartupTimeout - the time, in seconds, to wait for the server startInterruptedException - if interrupted while waiting for the server to startRuntimeException - if the process has diedTimeoutException - if the timeout has been reached and the server is still not startedpublic static boolean isDomainRunning(org.jboss.as.controller.client.ModelControllerClient client)
client - the client used to communicate with the servertrue if the server is in a running state, otherwise falsepublic static void shutdownDomain(org.jboss.as.controller.client.ModelControllerClient client)
throws IOException,
OperationExecutionException
client - the client used to communicate with the serverIOException - if an error occurs communicating with the serverOperationExecutionException - if the operation used to shutdown the managed domain failedpublic static void shutdownDomain(org.jboss.as.controller.client.ModelControllerClient client,
int timeout)
throws IOException,
OperationExecutionException
client - the client used to communicate with the servertimeout - the graceful shutdown timeout, a value of -1 will wait indefinitely and a value of
0 will not attempt a graceful shutdownIOException - if an error occurs communicating with the serverOperationExecutionException - if the operation used to shutdown the managed domain failedpublic static org.jboss.dmr.ModelNode determineHostAddress(org.jboss.as.controller.client.ModelControllerClient client)
throws IOException,
OperationExecutionException
client - the client used to communicate with the serverIOException - if an error occurs communicating with the serverOperationExecutionException - if the operation used to determine the host name failspublic static void waitForStandalone(org.jboss.as.controller.client.ModelControllerClient client,
long startupTimeout)
throws InterruptedException,
RuntimeException,
TimeoutException
client - the client used to communicate with the serverstartupTimeout - the time, in seconds, to wait for the server startInterruptedException - if interrupted while waiting for the server to startRuntimeException - if the process has diedTimeoutException - if the timeout has been reached and the server is still not startedpublic static void waitForStandalone(Process process, org.jboss.as.controller.client.ModelControllerClient client, long startupTimeout) throws InterruptedException, RuntimeException, TimeoutException
If the process is not null and a timeout occurs the process will be
destroyed.
process - the Java process can be null if no process is availableclient - the client used to communicate with the serverstartupTimeout - the time, in seconds, to wait for the server startInterruptedException - if interrupted while waiting for the server to startRuntimeException - if the process has diedTimeoutException - if the timeout has been reached and the server is still not startedpublic static boolean isStandaloneRunning(org.jboss.as.controller.client.ModelControllerClient client)
client - the client used to communicate with the servertrue if the server is running, otherwise falsepublic static void shutdownStandalone(org.jboss.as.controller.client.ModelControllerClient client)
throws IOException
client - the client used to communicate with the serverIOException - if an error occurs communicating with the serverpublic static void shutdownStandalone(org.jboss.as.controller.client.ModelControllerClient client,
int timeout)
throws IOException
client - the client used to communicate with the servertimeout - the graceful shutdown timeout, a value of -1 will wait indefinitely and a value of
0 will not attempt a graceful shutdownIOException - if an error occurs communicating with the serverCopyright © 2021 JBoss by Red Hat. All rights reserved.