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 StopAppservCommand extends StopDomainCommand { 38 39 46 public boolean validateOptions() throws CommandValidationException { 47 return super.validateOptions(); 48 } 49 50 54 public void runCommand() throws CommandException, CommandValidationException 55 { 56 CLILogger.getInstance().printWarning(getLocalizedString("CommandDeprecated", 57 new Object [] {name})); 58 validateOptions(); 59 60 String [] domainsList = null; 61 try 62 { 63 DomainConfig domainConfig = new DomainConfig(null, getDomainsRoot()); 64 DomainsManager manager = getFeatureFactory().getDomainsManager(); 65 domainsList = manager.listDomains(domainConfig); 66 } 67 catch(Exception e) 68 { 69 throw new CommandException(getLocalizedString("CommandUnSuccessful", 70 new Object [] {name} ), e); 71 } 72 boolean allDomainsStopped = true; 73 74 if (domainsList.length == 0) 75 throw new CommandException(getLocalizedString("NoDomainsToStop")); 76 else 77 CLILogger.getInstance().printDetailMessage(getLocalizedString("StoppingAppserv", 78 new Object [] {getDomainsRoot()})); 79 80 for (int i = 0; i < domainsList.length; i++) 81 { 82 try 83 { 84 stopDomain(domainsList[i]); 85 } 86 catch(Exception e) 87 { 88 allDomainsStopped = false; 89 CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage()); 90 CLILogger.getInstance().printExceptionStackTrace(e); 91 CLILogger.getInstance().printError(getLocalizedString("CannotStopDomainMsg", 92 new Object [] {domainsList[i]})); 93 } 94 } 95 if (!allDomainsStopped) 96 { 97 throw new CommandException(getLocalizedString("CannotStopOneOrMoreDomains")); 98 99 } 100 } 101 102 } 103 | Popular Tags |