1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.*; 27 28 import javax.management.ObjectName ; 29 import javax.management.MBeanServerConnection ; 30 import com.sun.enterprise.admin.common.ObjectNames; 31 32 import java.io.File ; 34 import java.util.Iterator ; 35 import java.util.ArrayList ; 36 import java.util.StringTokenizer ; 37 38 public class ListResourceAdapterConfigsCommand extends GenericCommand 39 { 40 44 public void runCommand()throws CommandException, CommandValidationException 45 { 46 if (!validateOptions()) 47 throw new CommandValidationException("Validation failed"); 48 49 String objectName = getObjectName(); 50 Object [] params = getParamsInfo(); 51 String operationName = getOperationName(); 52 String [] types = getTypesInfo(); 53 54 MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(), 55 getUser(), getPassword()); 56 try 57 { 58 String rac = (String )mbsc.invoke(new ObjectName (objectName), 59 operationName, params, types); 60 61 CLILogger.getInstance().printMessage(rac); 62 CLILogger.getInstance().printDetailMessage(getLocalizedString( 63 "CommandSuccessful", 64 new Object [] {name})); 65 }catch(Exception e){ 66 if (e.getLocalizedMessage() != null) 67 CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage()); 68 69 throw new CommandException(getLocalizedString("CommandUnSuccessful", 70 new Object [] {name} ), e); 71 } 72 } 73 74 public boolean validateOptions() throws CommandValidationException { 75 if (getOperands().size() == 1) 76 { 77 CLILogger.getInstance().printWarning(getLocalizedString("OperandTargetDeprecated")); 78 } 79 80 return super.validateOptions(); 81 } 82 } 83 | Popular Tags |