Methods Summary |
---|
public void | runCommand()An abstract method that Executes the command
validateOptions();
String domainName = null;
try {
domainName = getDomainName();
} catch(Exception e) {
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
domainName = domainName==null?getLocalizedString("Undefined"):domainName;
throw new CommandException(getLocalizedString("CannotStopDomain",
new Object[] {domainName} ), e);
}
stopDomain(domainName);
|
public void | stopDomain(java.lang.String domainName)
try {
final ClientPluggableFeatureFactory fac = getFeatureFactory();
final DomainsManager mgr = fac.getDomainsManager();
final DomainConfig cfg = getDomainConfig(domainName);
final InstancesManager im = mgr.getInstancesManager(cfg);
final int state = im.getInstanceStatus();
final String[] domains = mgr.listDomains(cfg);
boolean exists = false;
for(int i = 0; domains != null && i < domains.length; i++)
{
if(domains[i].equals(domainName))
{
exists = true;
break;
}
}
if(!exists)
{
// it doesn't exist -- let the existing code throw an Exception with
// the correct error message
stopDomain(mgr, cfg);
}
// check if the Domain is running
else if (state == Status.kInstanceRunningCode)
{
stopDomain(mgr, cfg);
CLILogger.getInstance().printDetailMessage(getLocalizedString("DomainStopped",
new Object[] {domainName}));
}
else if (state == Status.kInstanceStartingCode)
{
stopDomain(mgr, cfg);
CLILogger.getInstance().printDetailMessage(getLocalizedString("DomainStoppedWasStarting",
new Object[] {domainName}));
}
else
{
//print the message if domain already stopped
CLILogger.getInstance().printDetailMessage(getLocalizedString("CannotStopDomainAlreadyStopped",
new Object[] {domainName}));
}
unconfigureAddons();
}
catch(Exception e) {
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
throw new CommandException(getLocalizedString("CannotStopDomain",
new Object[] {domainName} ), e);
}
|
private void | stopDomain(com.sun.enterprise.admin.servermgmt.DomainsManager mgr, com.sun.enterprise.admin.servermgmt.DomainConfig cfg)
String forceOption = getCLOption(KILL);
if (forceOption == null) {
mgr.stopDomain(cfg);
} else {
int timeout = getIntegerOption(KILL);
mgr.stopDomainForcibly(cfg, timeout);
}
|
private void | unconfigureAddons()
try {
AddonControl ac = new AddonControl();
String domainInstanceRoot = getDomainsRoot() + File.separator + getDomainName();
ac.unconfigureDAS(new File(domainInstanceRoot));
}catch(Throwable t) {
CLILogger.getInstance().printDetailMessage(t.getLocalizedMessage());
}
|
public boolean | validateOptions()An abstract method that validates the options
on the specification in the xml properties file
This method verifies for the correctness of number of
operands and if all the required options are supplied by the client.
return super.validateOptions();
|