KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > Descriptor


1 /*
2  * @(#)file Descriptor.java
3  * @(#)author IBM Corp.
4  * @(#)version 1.23
5  * @(#)lastedit 04/02/10
6  */

7 /*
8  * Copyright IBM Corp. 1999-2000. All rights reserved.
9  *
10  * The program is provided "as is" without any warranty express or implied,
11  * including the warranty of non-infringement and the implied warranties of
12  * merchantibility and fitness for a particular purpose. IBM will not be
13  * liable for any damages suffered by you or any third party claim against
14  * you regarding the Program.
15  *
16  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
17  * This software is the proprietary information of Sun Microsystems, Inc.
18  * Use is subject to license terms.
19  *
20  * Copyright 2004 Sun Microsystems, Inc. Tous droits reserves.
21  * Ce logiciel est propriete de Sun Microsystems, Inc.
22  * Distribue par des licences qui en restreignent l'utilisation.
23  *
24  */

25
26 package javax.management;
27
28
29 import javax.management.RuntimeOperationsException JavaDoc;
30 import javax.management.MBeanException JavaDoc;
31
32 import com.sun.jmx.trace.Trace;
33
34 /**
35  * This interface represents the behavioral metadata set for a JMX Element.
36  * For examples, a descriptor is part of the ModelMBeanInfo, ModelMBeanNotificationInfo, ModelMBeanAttributeInfo,
37  * ModelMBeanConstructorInfo, and ModelMBeanParameterInfo.
38  * <P>
39  * A descriptor consists of a collection of fields. Each field is in fieldname=fieldvalue format.
40  * <P>
41  * All field names and values are not predefined. New fields can be defined and added by any program.
42  * In the case of ModelMBean some fields have been predefined for consistency of implementation and support by the ModelMBeanInfo
43  * ModelMBean*Info, and ModelMBean classes.
44  *<P>
45  *
46  * @since 1.5
47  */

48 public interface Descriptor extends java.io.Serializable JavaDoc, Cloneable JavaDoc
49 {
50
51     /**
52      * Returns the value for a specific fieldname.
53      *
54      * @param fieldName The field name in question; if not found, null is returned.
55      *
56      * @return Object Field value.
57      *
58      * @exception RuntimeOperationsException for illegal value for field name.
59      *
60      */

61     public Object JavaDoc getFieldValue(String JavaDoc fieldName)
62     throws RuntimeOperationsException JavaDoc;
63
64     /**
65      * Sets the value for a specific fieldname. The field value will be validated before
66      * it is set. If it is not valid, then an exception will be thrown. This will modify
67      * an existing field or add a new field.
68      *
69      * @param fieldName The field name to be set. Cannot be null or empty.
70      * @param fieldValue The field value to be set for the field
71      * name. Can be null.
72      *
73      * @exception RuntimeOperationsException for illegal value for field name or field value.
74      *
75      */

76     public void setField(String JavaDoc fieldName, Object JavaDoc fieldValue)
77     throws RuntimeOperationsException JavaDoc;
78
79
80     /**
81      * Returns all of the fields contained in this descriptor as a string array.
82      *
83      * @return String array of fields in the format <i>fieldName=fieldValue</i>
84      * If the value of a field is not a String, then the toString() method
85      * will be called on it and the returned value used as the value for
86      * the field in the returned array. Object values which are not Strings
87      * will be enclosed in parentheses. If the descriptor is empty, you will get
88      * an empty array.
89      *
90      * @see #setFields
91      */

92     public String JavaDoc[] getFields() ;
93
94
95     /**
96      * Returns all the fields names in the descriptor.
97      *
98      * @return String array of fields names. If the descriptor is empty, you will get
99      * an empty array.
100      *
101      */

102     public String JavaDoc[] getFieldNames() ;
103
104     /**
105      * Returns all the field values in the descriptor as an array of Objects. The
106      * returned values are in the same order as the fieldNames String array parameter.
107      *
108      * @param fieldNames String array of the names of the fields that the values
109      * should be returned for. If the array is empty then an empty array will be
110      * returned. If the array is 'null' then all values will be returned. If a field
111      * name in the array does not exist, then null is returned for the matching array
112      * element being returned.
113      *
114      * @return Object array of field values. If the descriptor is empty, you will get
115      * an empty array.
116      *
117      */

118     public Object JavaDoc[] getFieldValues(String JavaDoc[] fieldNames) ;
119
120     /**
121      * Removes a field from the descriptor.
122      *
123      * @param fieldName String name of the field to be removed.
124      * If the field is not found no exception is thrown.
125      */

126     public void removeField(String JavaDoc fieldName) ;
127
128     /**
129      * Sets all Fields in the list to the new value in with the same index
130      * in the fieldValue array. Array sizes must match.
131      * The field value will be validated before it is set.
132      * If it is not valid, then an exception will be thrown.
133      * If the arrays are empty, then no change will take effect.
134      *
135      * @param fieldNames String array of field names. The array and array elements cannot be null.
136      * @param fieldValues Object array of the corresponding field values. The array cannot be null.
137      * Elements of the array can be null.
138      *
139      * @exception RuntimeOperationsException for illegal value for field Names or field Values.
140      * Neither can be null. The array lengths must be equal.
141      * If the descriptor construction fails for any reason, this exception will be thrown.
142      *
143      * @see #getFields
144      */

145     public void setFields(String JavaDoc[] fieldNames, Object JavaDoc[] fieldValues)
146     throws RuntimeOperationsException JavaDoc;
147
148
149     /**
150      * Returns a new Descriptor which is a duplicate of the Descriptor.
151      *
152      * @exception RuntimeOperationsException for illegal value for field Names or field Values.
153      * If the descriptor construction fails for any reason, this exception will be thrown.
154      */

155     public Object JavaDoc clone() throws RuntimeOperationsException JavaDoc;
156
157
158     /**
159      * Returns true if all of the fields have legal values given their
160      * names.
161      *
162      * @return true if the values are legal.
163      *
164      * @exception RuntimeOperationsException If the validity checking fails for any reason, this exception will be thrown.
165      */

166     public boolean isValid() throws RuntimeOperationsException JavaDoc;
167
168 }
169
170
Popular Tags