Search in sources :

Example 26 with RemoteCLICommand

use of com.sun.enterprise.admin.cli.remote.RemoteCLICommand in project Payara by payara.

the class StopDomainsCommand method executeCommand.

@Override
protected int executeCommand() throws CommandException {
    try {
        String[] domains = userArgDomainName.split(",");
        for (String domainName : domains) {
            setConfig(domainName);
            RemoteCLICommand cmd = new RemoteCLICommand("stop-domain", programOpts, env);
            logger.fine("Stopping domain " + domainName);
            try {
                cmd.executeAndReturnOutput("stop-domain");
            } catch (Exception e) {
            }
            logger.fine("Stopped domain");
        }
        return 0;
    } catch (Exception ex) {
        throw new CommandException(ex.getLocalizedMessage());
    }
}
Also used : CommandException(org.glassfish.api.admin.CommandException) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand) CommandException(org.glassfish.api.admin.CommandException) CommandValidationException(org.glassfish.api.admin.CommandValidationException)

Aggregations

RemoteCLICommand (com.sun.enterprise.admin.cli.remote.RemoteCLICommand)26 CommandException (org.glassfish.api.admin.CommandException)8 ActionReport (org.glassfish.api.ActionReport)4 ArrayList (java.util.ArrayList)3 DomainException (com.sun.enterprise.admin.servermgmt.DomainException)2 BackupException (com.sun.enterprise.backup.BackupException)2 BackupWarningException (com.sun.enterprise.backup.BackupWarningException)2 IOException (java.io.IOException)2 RemoteCommand (com.sun.enterprise.admin.cli.remote.RemoteCommand)1 SmartFile (com.sun.enterprise.universal.io.SmartFile)1 MiniXmlParserException (com.sun.enterprise.universal.xml.MiniXmlParserException)1 SyncRequest (com.sun.enterprise.util.cluster.SyncRequest)1 File (java.io.File)1 ConnectException (java.net.ConnectException)1 Singleton (javax.inject.Singleton)1 MessagePart (org.glassfish.api.ActionReport.MessagePart)1 ParamModel (org.glassfish.api.admin.CommandModel.ParamModel)1 CommandValidationException (org.glassfish.api.admin.CommandValidationException)1