1 23 24 29 30 package com.sun.cli.jmx.cmd; 31 32 import com.sun.cli.jmx.support.CLISupportMBeanProxy; 33 34 37 public class CountCmd extends JMXCmd 38 { 39 public 40 CountCmd( final CmdEnv env ) 41 { 42 super( env ); 43 } 44 45 int 46 getNumRequiredOperands() 47 { 48 return( 0 ); 49 } 50 51 public String 52 getUsage() 53 { 54 return( CmdStrings.COUNT_HELP.toString() ); 55 } 56 57 static private final String OPTIONS_INFO =""; 58 59 ArgHelper.OptionsInfo 60 getOptionInfo() 61 throws ArgHelper.IllegalOptionException 62 { 63 return( new ArgHelperOptionsInfo( OPTIONS_INFO ) ); 64 } 65 66 final static String NAME = "count"; 67 68 public static String [] 69 getNames( ) 70 { 71 return( new String [] { NAME } ); 72 } 73 74 void 75 executeInternal() 76 throws Exception 77 { 78 final String [] operands = getOperands(); 79 80 if ( operands.length != 0 ) 81 { 82 final String msg = "No arguments required"; 83 printError( msg ); 84 throw new IllegalArgumentException ( msg ); 85 } 86 87 try 88 { 89 establishProxy(); 90 final int numMBeans = getProxy().mbeanCount(); 91 println( "" + numMBeans ); 92 } 93 catch( Exception e ) 94 { 95 dm( e.getMessage() ); 96 e.printStackTrace(); 97 } 98 } 99 } 100 101 102 103 104 105 106 | Popular Tags |