1 23 package com.sun.appserv.management.util.jmx.stringifier; 24 25 import javax.management.MBeanOperationInfo ; 26 27 import com.sun.appserv.management.util.stringifier.Stringifier; 28 29 public class MBeanOperationInfoStringifier 30 extends MBeanFeatureInfoStringifier implements Stringifier 31 { 32 public static final MBeanOperationInfoStringifier DEFAULT = new MBeanOperationInfoStringifier(); 33 34 public 35 MBeanOperationInfoStringifier() 36 { 37 super( ); 38 } 39 40 public 41 MBeanOperationInfoStringifier( MBeanFeatureInfoStringifierOptions options ) 42 { 43 super( options ); 44 } 45 46 public static String 47 getImpact( MBeanOperationInfo info ) 48 { 49 String impactStr = null; 50 51 switch( info.getImpact() ) 52 { 53 default: impactStr = "unknown"; break; 54 case MBeanOperationInfo.INFO: impactStr = "info"; break; 55 case MBeanOperationInfo.ACTION: impactStr = "action"; break; 56 case MBeanOperationInfo.ACTION_INFO: impactStr = "action-info";break; 57 } 58 59 return( impactStr ); 60 } 61 62 public static String 63 getSignature( MBeanOperationInfo info ) 64 { 65 return( getSignature( info, MBeanFeatureInfoStringifierOptions.DEFAULT ) ); 66 } 67 68 public static String 69 getSignature( MBeanOperationInfo info, MBeanFeatureInfoStringifierOptions options ) 70 { 71 return( ParamsToString( info.getSignature(), options ) ); 72 } 73 74 public static String 75 getDescription( MBeanOperationInfo info ) 76 { 77 return( sOperationDelimiter + "\"" + info.getDescription() + "\"" ); 78 } 79 80 public String 81 stringify( Object o ) 82 { 83 assert( o != null ); 84 final MBeanOperationInfo op = (MBeanOperationInfo )o; 85 86 String result = getPresentationTypeString( op.getReturnType() ) + " " + op.getName() + "("; 87 88 result = result + getSignature( op, mOptions ) + ")"; 90 91 String impactStr = getImpact( op ); 92 93 result = result + sOperationDelimiter + "impact=" +impactStr; 94 95 if ( mOptions.mIncludeDescription ) 96 { 97 result = result + getDescription( op ); 98 } 99 100 return( result ); 101 } 102 } | Popular Tags |