FileDocCategorySizeDatePackage
StopAppservCommand.javaAPI DocGlassfish v2 API4936Fri May 04 22:25:12 BST 2007com.sun.enterprise.cli.commands

StopAppservCommand

public class StopAppservCommand extends StopDomainCommand
Stops all the domains in the specified/default domaindir
version
$Revision: 1.4 $

Fields Summary
Constructors Summary
Methods Summary
public voidrunCommand()
An abstract method that Executes the command

throws
CommandException

        CLILogger.getInstance().printWarning(getLocalizedString("CommandDeprecated",
                                                                new Object[] {name}));
        validateOptions();
        
        String[] domainsList = null;
        try
        {
            DomainConfig domainConfig = new DomainConfig(null, getDomainsRoot());
            DomainsManager manager = getFeatureFactory().getDomainsManager();
            domainsList = manager.listDomains(domainConfig);
        }
        catch(Exception e)
        {
            throw new CommandException(getLocalizedString("CommandUnSuccessful",
                                                     new Object[] {name} ), e);
        }
        boolean allDomainsStopped = true;

        if (domainsList.length == 0)
            throw new CommandException(getLocalizedString("NoDomainsToStop"));
        else
            CLILogger.getInstance().printDetailMessage(getLocalizedString("StoppingAppserv",
                                                             new Object[] {getDomainsRoot()}));
        
        for (int i = 0; i < domainsList.length; i++)
        {
            try
            {
                stopDomain(domainsList[i]);                
            }
            catch(Exception e)
            {
                allDomainsStopped = false;
                CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
                CLILogger.getInstance().printExceptionStackTrace(e);
                CLILogger.getInstance().printError(getLocalizedString("CannotStopDomainMsg",
                                                       new Object[] {domainsList[i]}));
            }
        }
        if (!allDomainsStopped)
        {
            throw new CommandException(getLocalizedString("CannotStopOneOrMoreDomains"));

        }
    
public booleanvalidateOptions()
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
boolean returns true if success else returns false

        return super.validateOptions();