1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.CommandValidationException; 27 import com.sun.enterprise.cli.framework.CommandException; 28 import com.sun.enterprise.cli.framework.CLILogger; 29 30 import com.sun.enterprise.admin.servermgmt.DomainsManager; 31 import com.sun.enterprise.admin.servermgmt.DomainConfig; 32 33 37 public class StartAppservCommand extends StartDomainCommand 38 { 39 40 47 public boolean validateOptions() throws CommandValidationException 48 { 49 return super.validateOptions(); 50 } 51 52 56 public void runCommand() throws CommandException, CommandValidationException 57 { 58 CLILogger.getInstance().printWarning(getLocalizedString("CommandDeprecated", 59 new Object [] {name})); 60 61 validateOptions(); 62 63 String [] domainsList = null; 64 try 65 { 66 DomainConfig domainConfig = new DomainConfig(null, getDomainsRoot()); 67 DomainsManager manager = getFeatureFactory().getDomainsManager(); 68 domainsList = manager.listDomains(domainConfig); 69 } 70 catch(Exception e) 71 { 72 throw new CommandException(getLocalizedString("CommandUnSuccessful", 73 new Object [] {name} ), e); 74 } 75 boolean allDomainsStarted = true; 76 77 if (domainsList.length == 0) 78 throw new CommandException(getLocalizedString("NoDomainsToStart")); 79 else 80 CLILogger.getInstance().printDetailMessage(getLocalizedString("StartingAppserv", 81 new Object [] {getDomainsRoot()})); 82 83 for (int i = 0; i < domainsList.length; i++) 84 { 85 try 86 { 87 startDomain(domainsList[i]); 88 } 89 catch(Exception e) 90 { 91 allDomainsStarted = false; 92 CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage()); 93 CLILogger.getInstance().printExceptionStackTrace(e); 94 CLILogger.getInstance().printError(getLocalizedString("CannotStartDomainMsg", 95 new Object [] {domainsList[i]})); 96 } 97 } 98 if (!allDomainsStarted) 99 { 100 throw new CommandException(getLocalizedString("CannotStartOneOrMoreDomains")); 101 102 } 103 } 104 105 } 106 | Popular Tags |