protected void verifyTargetInstance(MBeanServerConnection mbsc, String instanceName)
throws CommandException
{
try
{
final DomainRoot domainRoot =
ProxyFactory.getInstance(mbsc).getDomainRoot();
boolean isServer=false;
isServer = domainRoot.getDomainConfig().getServerConfigMap().keySet().contains(instanceName);
if ( ! isServer )
{
throw new CommandException(getLocalizedString("TargetNotAnInstance",
new Object[] {instanceName}));
}
else
{
final Map<String,J2EEServer> servers =
domainRoot.getJ2EEDomain().getJ2EEServerMap();
final J2EEServer server = servers.get( instanceName );
final boolean running = server != null &&
server.getstate() == server.STATE_RUNNING ||
server.getstate() == server.STATE_STARTING;