1 23 24 29 30 31 package com.sun.enterprise.admin.dottedname; 32 33 import java.util.Iterator ; 34 import java.util.HashMap ; 35 36 import javax.management.Attribute ; 37 import javax.management.AttributeList ; 38 39 40 public final class Testee implements TesteeMBean 41 { 42 private char mchar = 'c'; 43 private byte mbyte = 0; 44 private short mshort = 0; 45 private int mint = 0; 46 private long mlong = 0; 47 private float mfloat = (float)0.0; 48 private double mdouble = 0.0; 49 50 private Character mCharacter = new Character ( 'c' ); 51 private Byte mByte = new Byte ( (byte)0 ); 52 private Short mShort = new Short ( (short)0 ); 53 private Integer mInteger = new Integer ( 0 ); 54 private Long mLong = new Long ( 0 ); 55 private Float mFloat = new Float ( 0.0 ); 56 private Double mDouble = new Double ( 0.0 ); 57 58 private String mString = ""; 59 private String [] mStringArray = new String [ 0 ]; 60 private Integer [] mIntegerArray = new Integer [ 0 ]; 61 62 private HashMap mProperties; 63 64 public final static String PROPERTY_NAME = "prop1"; 65 public final static String PROPERTY_VALUE = "prop1-value"; 66 67 public 68 Testee() 69 { 70 mProperties = new HashMap (); 71 72 mProperties.put( PROPERTY_NAME, PROPERTY_VALUE ); 73 } 74 75 public char getchar() { return( mchar ); } 76 public byte getbyte() { return( mbyte ); } 77 public short getshort() { return( mshort ); } 78 public int getint() { return( mint ); } 79 public long getlong() { return( mlong ); } 80 public float getfloat() { return( mfloat ); } 81 public double getdouble() { return( mdouble ); } 82 public String getString() { return( mString ); } 83 84 85 public void setchar( char value ) { mchar = value; } 86 public void setbyte( byte value ) { mbyte = value; } 87 public void setshort( short value ) { mshort = value; } 88 public void setint( int value ) { mint = value; } 89 public void setlong( long value ) { mlong = value; } 90 public void setfloat( float value ) { mfloat = value; } 91 public void setdouble( double value ) { mdouble = value; } 92 public void setString( String value ) { mString = value; } 93 94 95 public Character getCharacter() { return( mCharacter ); } 96 public Byte getByte() { return( mByte ); } 97 public Short getShort() { return( mShort ); } 98 public Integer getInteger(){ return( mInteger ); } 99 public Long getLong() { return( mLong ); } 100 public Float getFloat() { return( mFloat ); } 101 public Double getDouble() { return( mDouble ); } 102 public String [] getStringArray() { return( mStringArray ); } 103 public Integer [] getIntegerArray() { return( mIntegerArray ); } 104 105 106 public void setCharacter( Character value ) { mCharacter = value; } 107 public void setByte( Byte value ) { mByte = value; } 108 public void setShort( Short value ) { mShort = value; } 109 public void setInteger( Integer value ) { mInteger = value; } 110 public void setLong( Long value ) { mLong = value; } 111 public void setFloat( Float value ) { mFloat = value; } 112 public void setDouble( Double value ) { mDouble = value; } 113 public void setStringArray( String [] value ) { mStringArray = value; } 114 public void setIntegerArray( Integer [] value ) { mIntegerArray = value; } 115 116 117 118 synchronized public Object 119 getPropertyValue( String propertyName ) 120 { 121 return( (String )mProperties.get( propertyName ) ); 122 } 123 124 synchronized public AttributeList 125 getProperties() 126 { 127 final Iterator iter = mProperties.keySet().iterator(); 128 final AttributeList attrs = new AttributeList (); 129 130 while ( iter.hasNext() ) 131 { 132 final String name = (String )iter.next(); 133 final Object value = mProperties.get( name ); 134 135 attrs.add( new Attribute ( name, value ) ); 136 } 137 138 return( attrs ); 139 } 140 141 synchronized public void 142 setProperty( Attribute property ) 143 { 144 mProperties.put( property.getName(), property.getValue() ); 145 } 146 } 147 148 149 150 151 152 153 154 155 156 | Popular Tags |