use of org.glassfish.api.admin.CommandException 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 org.glassfish.api.admin.CommandException in project Payara by payara.
the class InstallNodeBaseCommand method executeCommand.
@Override
protected int executeCommand() throws CommandException {
File zipFile = null;
try {
ArrayList<String> binDirFiles = new ArrayList<String>();
precopy();
zipFile = createZipFileIfNeeded(binDirFiles);
copyToHosts(zipFile, binDirFiles);
} catch (CommandException e) {
throw e;
} catch (Exception e) {
throw new CommandException(e);
} finally {
if (!save && delete) {
if (zipFile != null) {
if (!zipFile.delete())
zipFile.deleteOnExit();
}
}
}
return SUCCESS;
}
use of org.glassfish.api.admin.CommandException in project Payara by payara.
the class InstallNodeDcomCommand method precopy.
/**
* bnevins: This is exclusively a "user-performance" enhancement.
* We are forcing the failure
* to happen before the very very slow zipfile creation.
* FAIL FAST principle
* This adds a bit of extra overhead to the command...
* Note that allowing multiple hosts makes things MUCH more complicated.
* @throws WindowsException
*/
@Override
final void precopy() throws CommandException {
remoteInstallDirString = getInstallDir().replace('/', '\\');
try {
for (String host : hosts) {
String remotePassword = getWindowsPassword(host);
passwords.add(new HostAndPassword(host, remotePassword));
if (!getForce()) {
WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), remotePassword);
WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, remoteInstallDirString);
if (remoteInstallDir.exists())
throw new CommandException(Strings.get("install.dir.exists", remoteInstallDir));
}
}
} catch (WindowsException ex) {
throw new CommandException(ex);
}
}
use of org.glassfish.api.admin.CommandException in project Payara by payara.
the class UninstallNodeDcomCommand method deleteFromHosts.
@Override
final void deleteFromHosts() throws CommandException {
for (String host : hosts) {
try {
String pw = getWindowsPassword(host);
WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(host, getRemoteUser(), pw);
WindowsRemoteFile remoteInstallDir = new WindowsRemoteFile(wrfs, getInstallDir());
if (!remoteInstallDir.exists()) {
throw new CommandException(Strings.get("remote.install.dir.already.gone", getInstallDir()));
}
remoteInstallDir.delete();
// make sure it's gone now...
if (remoteInstallDir.exists()) {
throw new CommandException(Strings.get("remote.install.dir.cant.delete", getInstallDir()));
}
} catch (CommandException ce) {
throw ce;
} catch (Exception e) {
throw new CommandException(e);
}
}
}
use of org.glassfish.api.admin.CommandException in project Payara by payara.
the class RestartDomainsCommand method executeCommand.
@Override
protected int executeCommand() throws CommandException {
try {
String[] domains = userArgDomainName.split(",");
for (String domainName : domains) {
setDomainName(domainName);
super.executeCommand();
logger.fine("Restarted domain " + domainName);
}
return 0;
} catch (Exception ex) {
throw new CommandException(ex.getLocalizedMessage());
}
}
Aggregations