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);
}
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;
}
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");
}
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;
}
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());
}
}
Aggregations