Source Code Cross Referenced for ModelMBeanOperationInfo.java in  » JMX » XMOJO » javax » management » modelmbean » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » XMOJO » javax.management.modelmbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * The XMOJO Project 5
003:         * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005:         * NO WARRANTY
006:
007:         * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008:         * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009:         * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010:         * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011:         * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012:         * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013:         * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014:         * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015:         * REPAIR OR CORRECTION.
016:
017:         * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018:         * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019:         * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020:         * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021:         * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022:         * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023:         * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024:         * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025:         * SUCH DAMAGES.
026:         **/package javax.management.modelmbean;
027:
028:        import java.lang.reflect.Method;
029:        import java.io.ObjectInputStream;
030:        import java.io.ObjectOutputStream;
031:        import java.io.ObjectStreamField;
032:        import java.io.IOException;
033:
034:        import javax.management.Descriptor;
035:        import javax.management.DescriptorAccess;
036:        import javax.management.MBeanOperationInfo;
037:        import javax.management.MBeanParameterInfo;
038:
039:        /**
040:         * The ModelMBeanOperationInfo object describes a management operation
041:         * of the ModelMBean. It is a subclass of MBeanOperationInfo with the
042:         * addition of an associated Descriptor and an implementation of the
043:         * DescriptorAccess interface.
044:         * <P>
045:         * <P>
046:         * <PRE>
047:         * The fields in the descriptor are defined, but not limited to, the following:
048:         *	name           : operation name
049:         *	descriptorType : must be "operation"
050:         *	class          : class where method is defined (fully qualified)
051:         *	role           : getter, setter, operation, constructor
052:         *	targetObject   : object on which to execute this method
053:         *	targetType     : type of object reference for targetObject:
054:         *
055:         *                ObjectReference|EJBHandle|IOR|RMIReference
056:         *	lastReturnedValue     : cached value for operation
057:         *	currencyTimeLimit     : how long cached value is valid
058:         *	lastReturnedTimeStamp : when cached value was set
059:         *	visibility            : 1-4 where 1: always visible 4: rarely visible
060:         *	presentationString    :  xml formatted string to describe how to present operation
061:         * </PRE>
062:         * <P> The default descriptor will have name, descriptorType, and role fields set.
063:         */
064:
065:        public class ModelMBeanOperationInfo extends MBeanOperationInfo
066:                implements  DescriptorAccess {
067:            Descriptor descriptor = new DescriptorSupport();
068:
069:            private static final long serialVersionUID = 0x7e1dce2a56f1e767L;
070:
071:            private static final ObjectStreamField[] serialPersistentFields = {
072:                    new ObjectStreamField("operationDescriptor",
073:                            DescriptorSupport.class),
074:                    new ObjectStreamField("currClass", java.lang.String.class) };
075:
076:            /**
077:             * Constructs a new ModelMBeanOperationInfo object with default descriptor
078:             *
079:             * @param method  The java.lang.reflect.Method object describing the MBean operation.
080:             *
081:             * @param description  A human readable description of the operation.
082:             */
083:            public ModelMBeanOperationInfo(String description, Method method) {
084:                super (description, method);
085:            }
086:
087:            /**
088:             * Constructs a new ModelMBeanOperationInfo object
089:             * @param method  The java.lang.reflect.Method object describing the MBean operation.
090:             * @param description  A human readable description of the operation.
091:             * @param descriptor Descriptor containing the appropriate metadata for this
092:             * instance of the MBeanNotificationInfo.If it is null or invalid then a default
093:             * desriptor will be created.
094:             */
095:            public ModelMBeanOperationInfo(String description, Method method,
096:                    Descriptor descriptor) {
097:                super (description, method);
098:                this .descriptor = descriptor;
099:            }
100:
101:            /**
102:             * Constructs a ModelMBeanOperationInfo object with a default descriptor.
103:             *
104:             * @param name The method name
105:             *
106:             * @param description  A human readable description of the operation.
107:             *
108:             * @param signature The array of MBeanParameterInfo contains the parameters
109:             * 				or arguments of the method
110:             *
111:             * @param type The return type of the method
112:             *
113:             * @param impact The impact of the method, will be anyone of the following
114:             * 				INFO, ACTION, ACTION_INFO,  UNKNOWN.
115:             */
116:            public ModelMBeanOperationInfo(String name, String description,
117:                    MBeanParameterInfo[] signature, String type, int impact) {
118:                super (name, description, signature, type, impact);
119:            }
120:
121:            /**
122:             * Constructs a ModelMBeanOperationInfo object escriptorth with
123:             * the specified Descriptor.
124:             *
125:             * @param name The method name
126:             *
127:             * @param description  A human readable description of the operation.
128:             *
129:             * @param signature The array of MBeanParameterInfo contains the parameters
130:             * 				or arguments of the method
131:             *
132:             * @param type The return type of the method
133:             *
134:             * @param impact The impact of the method, will be anyone of the following
135:             * 				INFO, ACTION, ACTION_INFO,  UNKNOWN.
136:             *
137:             * @param descriptor Descriptor containing the appropriate metadata for
138:             * 				this instance of the MBeanOperationInfo. If it is null or
139:             * 				invalid then a default desriptor will be created.
140:             */
141:            public ModelMBeanOperationInfo(String name, String description,
142:                    MBeanParameterInfo[] signature, String type, int impact,
143:                    Descriptor descriptor) {
144:                super (name, description, signature, type, impact);
145:                this .descriptor = descriptor;
146:            }
147:
148:            /**
149:             * Creates a ModelMBeanOperationInfo with the specified
150:             * ModelMBeanOperationInfo object.
151:             *
152:             * @param inInfo ModelMBeanOperationInfo object
153:             */
154:            public ModelMBeanOperationInfo(ModelMBeanOperationInfo inInfo) {
155:                super (inInfo.getName(), inInfo.getDescription(), inInfo
156:                        .getSignature(), inInfo.getReturnType(), inInfo
157:                        .getImpact());
158:                if (inInfo.getDescriptor() != null)
159:                    this .descriptor = (Descriptor) inInfo.getDescriptor()
160:                            .clone();
161:            }
162:
163:            /**
164:             * Creates a duplicate object of ModelMBeanOperationInfo
165:             *
166:             * @return Create and return a duplicate object of ModelMBeanOperationInfo
167:             */
168:            public Object clone() {
169:                Descriptor clonedDescr = null;
170:
171:                if (descriptor != null)
172:                    clonedDescr = (Descriptor) descriptor.clone();
173:
174:                return new ModelMBeanOperationInfo(getName(), getDescription(),
175:                        getSignature(), getReturnType(), getImpact(),
176:                        clonedDescr);
177:            }
178:
179:            /**
180:             * Gets the corresponding Descriptor of this ModelMBeanNotificationInfo
181:             *
182:             * @return This returns the Descriptor associated with
183:             * 				this ModelMBeanNotificationInfo
184:             */
185:            public Descriptor getDescriptor() {
186:                return descriptor;
187:            }
188:
189:            /**
190:             * Sets the specified Descriptor to this ModelMBeanNotificationInfo.If the
191:             * value is null then default Descriptor will be taken.  The Descriptor is
192:             * validated before it is assigned. If the new Descriptor is invalid, then
193:             * an IllegalArgumentException is thrown.
194:             *
195:             * @param inDescriptor This replaces the Descriptor associated with the
196:             * 				ModelMBeanNotification interface
197:             *
198:             * @throws IllegalArgumentException If the new Descriptor is invalid,
199:             * 				then it will be thrown.
200:             */
201:            public void setDescriptor(Descriptor inDescriptor) {
202:                this .descriptor = inDescriptor;
203:            }
204:
205:            /**
206:             * Returns a human readable version of the ModelMBeanOperationInfo instance
207:             *
208:             * @return This returns human readable version of the
209:             * 				ModelMBeanOperationInfo instance
210:             */
211:            public String toString() {
212:                if (descriptor != null)
213:                    return (super .toString() + "\n Descriptor = " + descriptor
214:                            .toString());
215:                else
216:                    return (super .toString() + "\n Descriptor = null");
217:            }
218:
219:            //--------------------------- Private methods ---------------------------//
220:
221:            private void readObject(ObjectInputStream objectinputstream)
222:                    throws IOException, ClassNotFoundException {
223:                ObjectInputStream.GetField getfield = objectinputstream
224:                        .readFields();
225:
226:                try {
227:                    descriptor = (DescriptorSupport) getfield.get(
228:                            "operationDescriptor", null);
229:                } catch (Exception exception) {
230:                    //throw new IOException(malformedobjectnameexception.toString());
231:                }
232:            }
233:
234:            private void writeObject(ObjectOutputStream objectoutputstream)
235:                    throws IOException {
236:                ObjectOutputStream.PutField putfield = objectoutputstream
237:                        .putFields();
238:                putfield.put("operationDescriptor", descriptor);
239:                putfield.put("currClass", "ModelMBeanOperationInfo");
240:
241:                objectoutputstream.writeFields();
242:            }
243:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.