use of com.sun.enterprise.admin.servermgmt.DomainsManager in project Payara by payara.
the class DeleteDomainCommand method executeCommand.
/**
*/
@Override
protected int executeCommand() throws CommandException, CommandValidationException {
try {
DomainConfig domainConfig = new DomainConfig(getDomainName(), getDomainsDir().getPath());
checkRunning();
checkRename();
DomainsManager manager = new PEDomainsManager();
manager.deleteDomain(domainConfig);
// By default, do as what v2 does -- don't delete the entry -
// might need a revisit (Kedar: 09/16/2009)
// deleteLoginInfo();
} catch (Exception e) {
throw new CommandException(e.getLocalizedMessage());
}
logger.fine(strings.get("DomainDeleted", getDomainName()));
return 0;
}
use of com.sun.enterprise.admin.servermgmt.DomainsManager in project Payara by payara.
the class ListDomainsCommand method getDomains.
/**
* Get a list of domains and their status
* @return Map<String, Boolean> of domain and status
* @throws IOException
* @throws DomainException
* @throws CommandException
*/
protected Map<String, Boolean> getDomains() throws IOException, DomainException, CommandException {
Map<String, Boolean> runningDomains = new HashMap<>();
File domainsDirFile = ok(domainDirParam) ? new File(domainDirParam) : DomainDirs.getDefaultDomainsDir();
DomainConfig domainConfig = new DomainConfig(null, domainsDirFile.getAbsolutePath());
DomainsManager manager = new PEDomainsManager();
String[] domainsList = manager.listDomains(domainConfig);
// no prompting for passwords
programOpts.setInteractive(false);
for (String domain : domainsList) {
runningDomains.put(domain, getStatus(domain).status);
}
return runningDomains;
}
use of com.sun.enterprise.admin.servermgmt.DomainsManager in project Payara by payara.
the class ListDomainsCommand method executeCommand.
@Override
protected int executeCommand() throws CommandException, CommandValidationException {
try {
File domainsDirFile = ok(domainDirParam) ? new File(domainDirParam) : DomainDirs.getDefaultDomainsDir();
DomainConfig domainConfig = new DomainConfig(null, domainsDirFile.getAbsolutePath());
DomainsManager manager = new PEDomainsManager();
String[] domainsList = manager.listDomains(domainConfig);
// no prompting for passwords
programOpts.setInteractive(false);
if (domainsList.length > 0) {
if (longOpt) {
String[] headings = { "DOMAIN", "ADMIN_HOST", "ADMIN_PORT", "RUNNING", "RESTART_REQUIRED" };
ColumnFormatter cf = header ? new ColumnFormatter(headings) : new ColumnFormatter();
for (String dn : domainsList) {
DomainInfo di = getStatus(dn);
cf.addRow(new Object[] { dn, di.adminAddr.getHost(), di.adminAddr.getPort(), di.status, di.restartRequired });
}
logger.info(cf.toString());
} else {
for (String dn : domainsList) {
logger.info(getStatus(dn).statusMsg);
}
}
} else {
logger.fine(STRINGS.get("NoDomainsToList"));
}
} catch (Exception ex) {
throw new CommandException(ex.getLocalizedMessage());
}
return 0;
}
use of com.sun.enterprise.admin.servermgmt.DomainsManager in project Payara by payara.
the class StopAllDomainsCommand method getDomains.
// Copied from ListDomainCommand.java
private String[] getDomains() throws DomainException, IOException {
File domainsDirFile = ok(domainDirParam) ? new File(domainDirParam) : DomainDirs.getDefaultDomainsDir();
DomainConfig domainConfig = new DomainConfig(null, domainsDirFile.getAbsolutePath());
DomainsManager manager = new PEDomainsManager();
String[] domainsList = manager.listDomains(domainConfig);
if (domainsList.length == 0) {
logger.fine(strings.get("NoDomainsToList"));
}
return domainsList;
}
Aggregations