Search in sources :

Example 21 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method createNodeImplicit.

/* installdir is product install dir (parent of glassfish install root) */
private int createNodeImplicit(String name, String installdir, String nodeHost) throws CommandException {
    ArrayList<String> argsList = new ArrayList<String>();
    argsList.add(0, "_create-node-implicit");
    if (name != null) {
        argsList.add("--name");
        argsList.add(name);
    }
    if (nodeDir != null) {
        argsList.add("--nodedir");
        argsList.add(nodeDir);
    }
    if (installdir != null) {
        argsList.add("--installdir");
        argsList.add(installdir);
    }
    argsList.add(nodeHost);
    String[] argsArray = new String[argsList.size()];
    argsArray = argsList.toArray(argsArray);
    RemoteCLICommand rc = new RemoteCLICommand("_create-node-implicit", this.programOpts, this.env);
    return rc.execute(argsArray);
}
Also used : ArrayList(java.util.ArrayList) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 22 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method isRegisteredToDAS.

private boolean isRegisteredToDAS() {
    boolean isRegistered = false;
    try {
        RemoteCLICommand rc = new RemoteCLICommand("get", this.programOpts, this.env);
        rc.executeAndReturnOutput("get", INSTANCE_DOTTED_NAME);
        isRegistered = true;
    } catch (CommandException ex) {
        logger.log(Level.FINER, "{0} is not yet registered to DAS.", instanceName);
        isRegistered = false;
    }
    return isRegistered;
}
Also used : CommandException(org.glassfish.api.admin.CommandException) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 23 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method setDomainName.

private void setDomainName() throws CommandException {
    RemoteCLICommand rc = new RemoteCLICommand("_get-runtime-info", this.programOpts, this.env);
    ActionReport report = rc.executeAndReturnActionReport("_get-runtime-info", "--target", "server");
    this.domainName = report.findProperty("domain_name");
}
Also used : ActionReport(org.glassfish.api.ActionReport) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 24 with RemoteCLICommand

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

the class DeleteLocalInstanceCommand method isRegisteredToDas.

/**
 * If the instance is not registered on DAS (server xml entry doesn't exist
 * in domain.xml), the get command will throw a CommandException
 */
private boolean isRegisteredToDas() {
    boolean isRegistered;
    RemoteCLICommand rc;
    String INSTANCE_DOTTED_NAME = "servers.server." + instanceName;
    try {
        rc = new RemoteCLICommand("get", this.programOpts, this.env);
        rc.executeAndReturnOutput("get", INSTANCE_DOTTED_NAME);
        isRegistered = true;
    } catch (CommandException ce) {
        isRegistered = false;
    }
    return isRegistered;
}
Also used : RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 25 with RemoteCLICommand

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

the class StopAllDomainsCommand method executeCommand.

@Override
protected int executeCommand() throws CommandException {
    try {
        String[] domainsList = getDomains();
        for (String domain : domainsList) {
            setConfig(domain);
            RemoteCLICommand cmd = new RemoteCLICommand("stop-domain", programOpts, env);
            logger.fine("Stopping domain " + domain);
            try {
                cmd.executeAndReturnOutput("stop-domain", "--force", force.toString());
            } catch (Exception e) {
            // System.out.println(e.getLocalizedMessage());
            }
            logger.fine("Stopped domain");
        }
        return 0;
    } catch (Exception ex) {
        throw new CommandException(ex.getLocalizedMessage());
    }
}
Also used : RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand) IOException(java.io.IOException) DomainException(com.sun.enterprise.admin.servermgmt.DomainException)

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