1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.*; 27 import javax.management.Attribute ; 28 import javax.management.AttributeList ; 29 import javax.management.ObjectName ; 30 import javax.management.MBeanServerConnection ; 31 import javax.management.MalformedObjectNameException ; 32 import javax.management.InstanceNotFoundException ; 33 import javax.management.IntrospectionException ; 34 import javax.management.ReflectionException ; 35 36 37 import java.util.Vector ; 38 import java.io.IOException ; 39 import java.util.StringTokenizer ; 40 41 45 public class JMSPingCommand extends S1ASCommand 46 { 47 48 55 public boolean validateOptions() throws CommandValidationException 56 { 57 return super.validateOptions(); 58 } 59 60 64 public void runCommand() throws CommandException, CommandValidationException 65 { 66 if (!validateOptions()) 67 throw new CommandValidationException("Validation is false"); 68 String objectName = getObjectName(); 69 Object [] params = getParamsInfo(); 70 String operationName = getOperationName(); 71 String [] types = getTypesInfo(); 72 73 MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), 74 getPort(), 75 getUser(), 76 getPassword()); 77 78 try 79 { 80 String returnValue = (String ) mbsc.invoke(new ObjectName (objectName), 81 operationName, params, types); 82 CLILogger.getInstance().printMessage(getLocalizedString( 83 "JMSPingStatus", 84 new Object [] {returnValue})); 85 CLILogger.getInstance().printDetailMessage(getLocalizedString( 87 "CommandSuccessful", 88 new Object [] {name})); 89 } 90 catch(Exception e) 91 { 92 if (e.getLocalizedMessage() != null) 93 CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage()); 94 throw new CommandException(getLocalizedString("CommandUnSuccessful", 95 new Object [] {name} ), e); 96 } 97 } 98 99 } 100 | Popular Tags |