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

ListDomainsCommand

public class ListDomainsCommand extends BaseLifeCycleCommand
This is a local command that creates a new domain
version
$Revision: 1.4 $

Fields Summary
Constructors Summary
public ListDomainsCommand()
Creates new CreateDomainCommand

    
Methods Summary
public voidrunCommand()
An abstract method that executes the command

throws
CommandException

        if (!validateOptions())
           throw new CommandValidationException("Validation failed");
        try {
            DomainConfig domainConfig = new DomainConfig(null, 
                getDomainsRoot());
            DomainsManager manager = getFeatureFactory().getDomainsManager();
            String[] domainsList = manager.listDomainsAndStatus(domainConfig);
            if (domainsList.length > 0) {
                //*bug fix for #6158809*
                //CLILogger.getInstance().printDetailMessage(
                //    getLocalizedString("ListOfDomains"));
                //*end of bug fix*
                for (int i = 0; i < domainsList.length; i++) {
                    CLILogger.getInstance().printMessage(domainsList[i]);
                }
            } else {
                CLILogger.getInstance().printDetailMessage(
                   getLocalizedString("NoDomainsToList"));
            }
            CLILogger.getInstance().printDetailMessage(getLocalizedString(
                                                       "CommandSuccessful",
                                                       new Object[] {name}));
        } catch (Exception ex) {
            CLILogger.getInstance().printDetailMessage(ex.getLocalizedMessage());
            throw new CommandException(getLocalizedString("CommandUnSuccessful",
						     new Object[] {name} ), ex);
        }
    
public booleanvalidateOptions()
An abstract method that validates the options on the specification in the xml properties file

return
true if successfull

        return super.validateOptions();