Search in sources :

Example 16 with RemoteCLICommand

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

the class BackupDomainCommand method isSuspended.

/**
 * This method determines if the DAS is currently suspended.
 */
private boolean isSuspended() {
    try {
        RemoteCLICommand cmd = new RemoteCLICommand("suspend-domain", programOpts, env);
        String response = cmd.executeAndReturnOutput("suspend-domain", "--_test=true");
        if (response.indexOf("SUSPENDED=TRUE") >= 0)
            return true;
    } catch (Exception e) {
        logger.info("Exception while probing DAS (suspend-domain): " + e.getMessage());
    }
    return false;
}
Also used : RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand) BackupWarningException(com.sun.enterprise.backup.BackupWarningException) CommandException(org.glassfish.api.admin.CommandException) BackupException(com.sun.enterprise.backup.BackupException)

Example 17 with RemoteCLICommand

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

the class BackupDomainCommand method canSuspend.

/**
 * This method determines if the DAS has the ability to suspend itself.
 */
private boolean canSuspend() {
    try {
        RemoteCLICommand cmd = new RemoteCLICommand("list-commands", programOpts, env);
        String response = cmd.executeAndReturnOutput("list-commands");
        if (response.indexOf("suspend-domain") >= 0)
            return true;
    } catch (Exception e) {
        logger.info("Exception while probing DAS (list-commands): " + e.getMessage());
    }
    return false;
}
Also used : RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand) BackupWarningException(com.sun.enterprise.backup.BackupWarningException) CommandException(org.glassfish.api.admin.CommandException) BackupException(com.sun.enterprise.backup.BackupException)

Example 18 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method rendezvousOccurred.

private boolean rendezvousOccurred() {
    boolean rendezvousOccurred = false;
    RemoteCLICommand rc = null;
    try {
        rc = new RemoteCLICommand("get", this.programOpts, this.env);
        String s = rc.executeAndReturnOutput("get", RENDEZVOUS_DOTTED_NAME);
        String val = s.substring(s.indexOf("=") + 1);
        rendezvousOccurred = Boolean.parseBoolean(val);
        logger.log(Level.FINER, "rendezvousOccurred = {0} for instance {1}", new Object[] { val, instanceName });
    } catch (CommandException ce) {
        logger.log(Level.FINER, RENDEZVOUS_PROPERTY_NAME + " property may not be set yet on {0}", instanceName);
    }
    return rendezvousOccurred;
}
Also used : CommandException(org.glassfish.api.admin.CommandException) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 19 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method registerToDAS.

private int registerToDAS() throws CommandException {
    ArrayList<String> argsList = new ArrayList<String>();
    argsList.add(0, "_register-instance");
    if (clusterName != null) {
        argsList.add("--cluster");
        argsList.add(clusterName);
    }
    if (lbEnabled != null) {
        argsList.add("--lbenabled");
        argsList.add(lbEnabled.toString());
    }
    if (configName != null) {
        argsList.add("--config");
        argsList.add(configName);
    }
    if (_node != null) {
        argsList.add("--node");
        argsList.add(_node);
    }
    argsList.add("--checkports");
    argsList.add(String.valueOf(checkPorts));
    if (portBase != null) {
        argsList.add("--portbase");
        argsList.add(portBase);
    }
    if (systemProperties != null) {
        argsList.add("--systemproperties");
        argsList.add(systemProperties);
    }
    argsList.add("--properties");
    argsList.add(RENDEZVOUS_PROPERTY_NAME + "=true");
    argsList.add(this.instanceName);
    String[] argsArray = new String[argsList.size()];
    argsArray = argsList.toArray(argsArray);
    RemoteCLICommand rc = new RemoteCLICommand("_register-instance", this.programOpts, this.env);
    return rc.execute(argsArray);
}
Also used : ArrayList(java.util.ArrayList) RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

Example 20 with RemoteCLICommand

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

the class CreateLocalInstanceCommand method bootstrapSecureAdminFiles.

private int bootstrapSecureAdminFiles() throws CommandException {
    RemoteCLICommand rc = new RemoteCLICommand("_bootstrap-secure-admin", this.programOpts, this.env);
    rc.setFileOutputDirectory(instanceDir);
    final int result = rc.execute(new String[] { "_bootstrap-secure-admin" });
    return result;
}
Also used : RemoteCLICommand(com.sun.enterprise.admin.cli.remote.RemoteCLICommand)

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