KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > dottedname > Testee


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /*
25  * $Header: /cvs/glassfish/admin/mbeans/tests/com/sun/enterprise/admin/dottedname/Testee.java,v 1.3 2005/12/25 03:43:09 tcfujii Exp $
26  * $Revision: 1.3 $
27  * $Date: 2005/12/25 03:43:09 $
28  */

29  
30
31 package com.sun.enterprise.admin.dottedname;
32
33 import java.util.Iterator JavaDoc;
34 import java.util.HashMap JavaDoc;
35
36 import javax.management.Attribute JavaDoc;
37 import javax.management.AttributeList JavaDoc;
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 JavaDoc mCharacter = new Character JavaDoc( 'c' );
51     private Byte JavaDoc mByte = new Byte JavaDoc( (byte)0 );
52     private Short JavaDoc mShort = new Short JavaDoc( (short)0 );
53     private Integer JavaDoc mInteger = new Integer JavaDoc( 0 );
54     private Long JavaDoc mLong = new Long JavaDoc( 0 );
55     private Float JavaDoc mFloat = new Float JavaDoc( 0.0 );
56     private Double JavaDoc mDouble = new Double JavaDoc( 0.0 );
57     
58     private String JavaDoc mString = "";
59     private String JavaDoc [] mStringArray = new String JavaDoc[ 0 ];
60     private Integer JavaDoc [] mIntegerArray = new Integer JavaDoc[ 0 ];
61     
62     private HashMap JavaDoc mProperties;
63     
64     public final static String JavaDoc PROPERTY_NAME = "prop1";
65     public final static String JavaDoc PROPERTY_VALUE = "prop1-value";
66     
67         public
68     Testee()
69     {
70         mProperties = new HashMap JavaDoc();
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 JavaDoc 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 JavaDoc value ) { mString = value; }
93     
94     
95     public Character JavaDoc getCharacter() { return( mCharacter ); }
96     public Byte JavaDoc getByte() { return( mByte ); }
97     public Short JavaDoc getShort() { return( mShort ); }
98     public Integer JavaDoc getInteger(){ return( mInteger ); }
99     public Long JavaDoc getLong() { return( mLong ); }
100     public Float JavaDoc getFloat() { return( mFloat ); }
101     public Double JavaDoc getDouble() { return( mDouble ); }
102     public String JavaDoc[] getStringArray() { return( mStringArray ); }
103     public Integer JavaDoc[] getIntegerArray() { return( mIntegerArray ); }
104     
105     
106     public void setCharacter( Character JavaDoc value ) { mCharacter = value; }
107     public void setByte( Byte JavaDoc value ) { mByte = value; }
108     public void setShort( Short JavaDoc value ) { mShort = value; }
109     public void setInteger( Integer JavaDoc value ) { mInteger = value; }
110     public void setLong( Long JavaDoc value ) { mLong = value; }
111     public void setFloat( Float JavaDoc value ) { mFloat = value; }
112     public void setDouble( Double JavaDoc value ) { mDouble = value; }
113     public void setStringArray( String JavaDoc[] value ) { mStringArray = value; }
114     public void setIntegerArray( Integer JavaDoc[] value ) { mIntegerArray = value; }
115     
116     
117     
118         synchronized public Object JavaDoc
119     getPropertyValue( String JavaDoc propertyName )
120     {
121         return( (String JavaDoc)mProperties.get( propertyName ) );
122     }
123     
124         synchronized public AttributeList JavaDoc
125     getProperties()
126     {
127         final Iterator JavaDoc iter = mProperties.keySet().iterator();
128         final AttributeList JavaDoc attrs = new AttributeList JavaDoc();
129         
130         while ( iter.hasNext() )
131         {
132             final String JavaDoc name = (String JavaDoc)iter.next();
133             final Object JavaDoc value = mProperties.get( name );
134             
135             attrs.add( new Attribute JavaDoc( name, value ) );
136         }
137         
138         return( attrs );
139     }
140     
141         synchronized public void
142     setProperty( Attribute JavaDoc property )
143     {
144         mProperties.put( property.getName(), property.getValue() );
145     }
146 }
147
148
149
150
151
152
153
154
155
156
Popular Tags