use of com.sun.enterprise.admin.servermgmt.DomainConfig 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.DomainConfig 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;
}
use of com.sun.enterprise.admin.servermgmt.DomainConfig in project Payara by payara.
the class TestDomainPortValidator method testForNullPorts.
@Test(expectedExceptions = DomainException.class)
public void testForNullPorts() throws Exception {
DomainConfig domainConfig = new DomainConfig("test", null);
domainConfig.add(DomainConfig.K_VALIDATE_PORTS, Boolean.TRUE);
_portValidator = new DomainPortValidator(domainConfig, new Properties());
_portValidator.validateAndSetPorts();
}
use of com.sun.enterprise.admin.servermgmt.DomainConfig in project Payara by payara.
the class TestDomainPortValidator method testForPortValueZero.
@Test(expectedExceptions = DomainException.class)
public void testForPortValueZero() throws Exception {
DomainConfig domainConfig = new DomainConfig("test", null);
domainConfig.add(DomainConfig.K_VALIDATE_PORTS, Boolean.TRUE);
domainConfig.add(DomainConfig.K_ADMIN_PORT, "0");
_portValidator = new DomainPortValidator(domainConfig, new Properties());
_portValidator.validateAndSetPorts();
}
use of com.sun.enterprise.admin.servermgmt.DomainConfig in project Payara by payara.
the class TestDomainPortValidator method testForNegativePort.
@Test(expectedExceptions = DomainException.class)
public void testForNegativePort() throws Exception {
DomainConfig domainConfig = new DomainConfig("test", null);
domainConfig.add(DomainConfig.K_VALIDATE_PORTS, Boolean.TRUE);
domainConfig.add(DomainConfig.K_ADMIN_PORT, "-2");
_portValidator = new DomainPortValidator(domainConfig, new Properties());
_portValidator.validateAndSetPorts();
}
Aggregations