001: /* JFox, the OpenSource J2EE Application Server
002: *
003: * Copyright (C) 2002 huihoo.org
004: * Distributable under GNU LGPL license
005: * See the GNU Lesser General Public License for more details.
006: */
007:
008: package javax.management;
009:
010: import java.io.Serializable;
011:
012: /**
013: *
014: * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
015: */
016:
017: public class MBeanInfo implements Cloneable, Serializable {
018:
019: /**
020: * The human readable description of the class.
021: */
022: private String description = null;
023:
024: /**
025: * The MBean qualified name.
026: */
027: private String className = null;
028: /**
029: * The MBean attribute descriptors.
030: */
031: private MBeanAttributeInfo[] attributes = null;
032: /**
033: * The MBean operation descriptors.
034: */
035: private MBeanOperationInfo[] operations = null;
036:
037: /**
038: * The MBean constructor descriptors.
039: */
040: private MBeanConstructorInfo[] constructors = null;
041:
042: /**
043: * The MBean notification descriptors.
044: */
045: private MBeanNotificationInfo[] notifications = null;
046:
047: /**
048: * Constructs an <CODE>MBeanInfo</CODE>.
049: *
050: * @param className The name of the Java class of the MBean described by this <CODE>MBeanInfo</CODE>.
051: * @param description A human readable description of the MBean (optional).
052: * @param attributes The list of exposed attributes of the MBean.
053: * @param constructors The list of public constructors of the MBean.
054: * @param operations The list of operations of the MBean.
055: * @param notifications The list of notifications emitted by an MBean.
056: *
057: */
058: public MBeanInfo(String className, String description,
059: MBeanAttributeInfo[] attributes,
060: MBeanConstructorInfo[] constructors,
061: MBeanOperationInfo[] operations,
062: MBeanNotificationInfo[] notifications) {
063:
064: this .className = className;
065: this .description = description;
066: this .attributes = attributes;
067: this .operations = operations;
068: this .constructors = constructors;
069: this .notifications = notifications;
070: }
071:
072: public Object clone() {
073: try {
074: return super .clone();
075: } catch (CloneNotSupportedException clonenotsupportedexception) {
076: return null;
077: }
078: }
079:
080: /**
081: * Returns the name of the Java class of the MBean described by
082: * this <CODE>MBeanInfo</CODE>.
083: */
084: public String getClassName() {
085: return className;
086: }
087:
088: /**
089: * Returns a human readable description of the MBean.
090: */
091: public String getDescription() {
092: return description;
093: }
094:
095: /**
096: * Returns the list of attributes exposed for management.
097: * Each attribute is described by an <CODE>MBeanAttributeInfo</CODE> object.
098: *
099: * @return An array of <CODE>MBeanAttributeInfo</CODE> objects.
100: */
101: public MBeanAttributeInfo[] getAttributes() {
102: if (attributes != null) {
103: int len = attributes.length;
104: MBeanAttributeInfo[] res = new MBeanAttributeInfo[len];
105: for (int i = 0; i < len; i++) {
106: res[i] = (MBeanAttributeInfo) (attributes[i]).clone();
107: }
108: return res;
109: } else {
110: return new MBeanAttributeInfo[0];
111: }
112: }
113:
114: /**
115: * Returns the list of operations of the MBean.
116: * Each operation is described by an <CODE>MBeanOperationInfo</CODE> object.
117: *
118: * @return An array of <CODE>MBeanOperationInfo</CODE> objects.
119: */
120: public MBeanOperationInfo[] getOperations() {
121: if (operations != null) {
122: int len = operations.length;
123: MBeanOperationInfo[] res = new MBeanOperationInfo[len];
124: for (int i = 0; i < len; i++) {
125: res[i] = (MBeanOperationInfo) (operations[i]).clone();
126: }
127: return res;
128: } else {
129: return new MBeanOperationInfo[0];
130: }
131: }
132:
133: /**
134: * Returns the list of the public constructors of the MBean.
135: * Each constructor is described by an <CODE>MBeanConstructorInfo</CODE> object.
136: *
137: * @return An array of <CODE>MBeanConstructorInfo</CODE> objects.
138: */
139: public MBeanConstructorInfo[] getConstructors() {
140: if (constructors != null) {
141: int len = constructors.length;
142: MBeanConstructorInfo[] res = new MBeanConstructorInfo[len];
143: for (int i = 0; i < len; i++) {
144: res[i] = (MBeanConstructorInfo) (constructors[i])
145: .clone();
146: }
147: return res;
148: } else {
149: return new MBeanConstructorInfo[0];
150: }
151: }
152:
153: /**
154: * Returns the list of the notifications emitted by the MBean.
155: * Each notification is described by an <CODE>MBeanNotificationInfo</CODE> object.
156: *
157: * @return An array of <CODE>MBeanNotificationInfo</CODE> objects.
158: */
159: public MBeanNotificationInfo[] getNotifications() {
160: if (notifications != null) {
161: int len = notifications.length;
162: MBeanNotificationInfo[] res = new MBeanNotificationInfo[len];
163: for (int i = 0; i < len; i++) {
164: res[i] = (MBeanNotificationInfo) (notifications[i])
165: .clone();
166: }
167: return res;
168: } else {
169: return new MBeanNotificationInfo[0];
170: }
171: }
172: }
|