1 23 24 29 30 package com.sun.cli.jmx.cmd; 31 32 import java.util.Arrays ; 33 34 import javax.management.ObjectName ; 35 36 import com.sun.cli.jmx.support.InvokeResult; 37 import com.sun.cli.jmx.support.CLISupportMBeanProxy; 38 import com.sun.cli.jmx.support.InvokeResultIteratorStringifier; 39 import com.sun.cli.util.stringifier.*; 40 41 44 public class ListCmd extends JMXCmd 45 { 46 public 47 ListCmd( final CmdEnv env ) 48 { 49 super( env ); 50 } 51 52 int 53 getNumRequiredOperands() 54 { 55 return( 0 ); 57 } 58 59 public String 60 getUsage() 61 { 62 return( "no help" ); 63 } 65 66 public static String [] 67 getNames( ) 68 { 69 return( new String [] { "list" } ); 70 } 71 72 void 73 executeInternal() 74 throws Exception 75 { 76 String [] targets = getTargets(); 77 78 if ( targets.length == 0 ) 79 { 80 targets = ALL_TARGET; 81 } 82 83 final InvokeResult [] results = getProxy().mbeanInvoke( "list", "true", targets); 84 85 if ( results.length == 0 ) 86 { 87 println( "No objects match the targets " + SmartStringifier.toString( targets ) ); 88 } 89 else 90 { 91 final InvokeResultIteratorStringifier s = new InvokeResultIteratorStringifier( "\n" ); 92 println( s.stringify( Arrays.asList( results ).iterator() ) ); 93 } 94 } 95 } 96 | Popular Tags |