OnlineCommandContext(OnlineManagementClient client, ServerVersion version) { this.client = client; this.options = client.options(); this.version = version; } }
@Override public OnlineOptions options() { return delegate.options(); }
/** @see #waitUntilServersRunning(String, java.util.List) */ public void waitUntilServersRunning(List<String> servers) throws InterruptedException, TimeoutException, IOException { domainOps.waitUntilServersAreRunning(client.options().defaultHost, servers, true); }
/** @see #shutdownServer(String, String) */ public void shutdownServerGracefully(String server, int timeoutInSeconds) throws InterruptedException, TimeoutException, IOException { shutdownServerGracefully(client.options().defaultHost, server, timeoutInSeconds); }
@Override public boolean isReloadRequired() throws IOException { return isRestartOperationRequired(client.options().defaultHost, CommonRestartOperation.RELOAD); }
@Override public void shutdown(int timeoutInSeconds) throws IOException { shutdown(client.options().defaultHost, timeoutInSeconds); }
@Override public void reload() throws IOException, InterruptedException, TimeoutException { performRestartOperation(client.options().defaultHost, CommonRestartOperation.RELOAD); }
@Override public void restart() throws IOException, InterruptedException, TimeoutException { performRestartOperation(client.options().defaultHost, CommonRestartOperation.RESTART); }
/** @see #startServer(String, String) */ public boolean startServer(String server) throws IOException { return startServer(client.options().defaultHost, server); }
/** @see #restartServer(String, String) */ public void restartServer(String server) throws InterruptedException, TimeoutException, IOException { restartServer(client.options().defaultHost, server); }
/** @see #removeServer(String, String) */ public boolean removeServer(String server) throws IOException, OperationException { return removeServer(client.options().defaultHost, server); }
/** @see #shutdownAllServers(String) */ public void shutdownAllServersGracefully(int timeoutInSeconds) throws InterruptedException, IOException, TimeoutException { shutdownAllServersGracefully(client.options().defaultHost, timeoutInSeconds); }
@Override public boolean isRestartRequired() throws IOException { return isRestartOperationRequired(client.options().defaultHost, CommonRestartOperation.RESTART); }
/** @see #shutdownAllServers(String) */ public void shutdownAllServers() throws InterruptedException, IOException, TimeoutException { shutdownAllServers(client.options().defaultHost); }
public ReloadToOriginal(OnlineManagementClient client, int timeoutInSeconds) throws IOException { if (!client.options().isStandalone) { throw new IllegalStateException("ReloadToOriginal is only supported for a standalone server"); } if (client.version().lessThan(ServerVersion.VERSION_1_4_0)) { throw new IllegalStateException("ReloadToOriginal requires at least JBoss AS 7.2.0 (EAP 6.1.0)"); } this.client = client; this.timeoutInSeconds = timeoutInSeconds; }
/** * Reload the server to a snapshot. In managed domain, reloads the default host to a domain.xml snapshot. */ public void perform() throws InterruptedException, TimeoutException, IOException { if (client.options().isStandalone) { new StandaloneAdministrationOperations(client, timeoutInSeconds) .performRestartOperation(new ReloadToStandaloneSnapshotRestartOperation(snapshot)); } else { perform(client.options().defaultHost); } }
@Override public boolean reloadIfRequired() throws IOException, InterruptedException, TimeoutException { if (isRestartOperationRequired(client.options().defaultHost, CommonRestartOperation.RELOAD)) { reload(); return true; } return false; }
@Override public boolean restartIfRequired() throws IOException, InterruptedException, TimeoutException { if (isRestartOperationRequired(client.options().defaultHost, CommonRestartOperation.RESTART)) { restart(); return true; } return false; }
public Administration(OnlineManagementClient client, int timeoutInSeconds) { this.client = client; if (client.options().isDomain) { this.ops = new DomainAdministrationOperations(client, timeoutInSeconds); } else { this.ops = new StandaloneAdministrationOperations(client, timeoutInSeconds); } }
/** * Reload given {@code host} to a domain.xml snapshot. This method only makes sense in managed domain. */ public void perform(String host) throws InterruptedException, TimeoutException, IOException { if (!client.options().isDomain) { throw new IllegalStateException("Asked to reload host '" + host + "' to a snapshot, but the server isn't a domain controller"); } new DomainAdministrationOperations(client, timeoutInSeconds) .performRestartOperation(host, new ReloadToDomainSnapshotRestartOperation(snapshot)); }