Source Code Cross Referenced for ComplianceSupport.java in  » JMX » mx4j » test » javax » management » support » 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 » mx4j » test.javax.management.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) The MX4J Contributors.
003:         * All rights reserved.
004:         *
005:         * This software is distributed under the terms of the MX4J License version 1.0.
006:         * See the terms of the MX4J License in the documentation provided with this software.
007:         */
008:
009:        package test.javax.management.support;
010:
011:        import javax.management.Attribute;
012:        import javax.management.AttributeList;
013:        import javax.management.AttributeNotFoundException;
014:        import javax.management.DynamicMBean;
015:        import javax.management.InvalidAttributeValueException;
016:        import javax.management.MBeanException;
017:        import javax.management.MBeanInfo;
018:        import javax.management.ReflectionException;
019:
020:        /**
021:         * @version $Revision: 1.6 $
022:         */
023:        public class ComplianceSupport {
024:            // Not a manageable class: missing management interface
025:            public static class NoManagement {
026:            }
027:
028:            // Not a manageable class: implements an interface with different name
029:            public interface LexicalPatternNotRespectedMBean {
030:                public void fake();
031:            }
032:
033:            public static class DoesntRespectLexicalPattern implements 
034:                    LexicalPatternNotRespectedMBean {
035:                public void fake() {
036:                }
037:            }
038:
039:            // MBeans with overloaded attributes are not compliant
040:            public interface OverloadedAttributeSetSetMBean {
041:                public void setAttribute(String s);
042:
043:                public void setAttribute(Integer i);
044:            }
045:
046:            public static class OverloadedAttributeSetSet implements 
047:                    OverloadedAttributeSetSetMBean {
048:                public void setAttribute(String s) {
049:                }
050:
051:                public void setAttribute(Integer i) {
052:                }
053:            }
054:
055:            public interface OverloadedAttributeGetSetMBean {
056:                public String getAttribute();
057:
058:                public void setAttribute(Integer i);
059:            }
060:
061:            public static class OverloadedAttributeGetSet implements 
062:                    OverloadedAttributeGetSetMBean {
063:                public String getAttribute() {
064:                    return null;
065:                }
066:
067:                public void setAttribute(Integer i) {
068:                }
069:            }
070:
071:            public interface OverloadedAttributeIsGetMBean {
072:                public boolean isBoolean();
073:
074:                public boolean getBoolean();
075:            }
076:
077:            public static class OverloadedAttributeIsGet implements 
078:                    OverloadedAttributeIsGetMBean {
079:                public boolean isBoolean() {
080:                    return false;
081:                }
082:
083:                public boolean getBoolean() {
084:                    return false;
085:                }
086:            }
087:
088:            // In JMX 1.0 this is not a manageable class: it's abstract
089:            // In JMX 1.1 the requirement for the MBean class to be concrete has been removed
090:            //	public interface AbstractMBean {}
091:            //	public static abstract class Abstract implements AbstractMBean {}
092:
093:            // Valid MBean
094:            public static interface BasicStandardMBean {
095:                public void test();
096:            }
097:
098:            public static class BasicStandard implements  BasicStandardMBean {
099:                private int m_count;
100:
101:                // This method should not be part of the management interface
102:                public void noManage() {
103:                }
104:
105:                public void test() {
106:                    ++m_count;
107:                }
108:            }
109:
110:            // Valid MBean that inherits from parent its manageability
111:            public static class Derived extends BasicStandard {
112:                public void derivedNoManage() {
113:                }
114:            }
115:
116:            // Valid MBean with inherited management interface
117:            public interface BaseMBean {
118:                public void base();
119:            }
120:
121:            public interface InheritedMBean extends BaseMBean {
122:                public void derived();
123:
124:                public void test2();
125:
126:                public void retest();
127:            }
128:
129:            public static class Inherited implements  InheritedMBean {
130:                public void base() {
131:                }
132:
133:                public void derived() {
134:                }
135:
136:                public void test2() {
137:                }
138:
139:                public void retest() {
140:                }
141:            }
142:
143:            // Valid MBean with a trap: the management interface should be only the one inherited from Basic
144:            public static class NotInherited extends BasicStandard implements 
145:                    InheritedMBean {
146:                public void base() {
147:                }
148:
149:                public void derived() {
150:                }
151:
152:                public void retest() {
153:                }
154:
155:                public void test2() {
156:                }
157:
158:                public void unManage() {
159:                }
160:            }
161:
162:            // Valid MBean with multiple inheritance
163:            public interface MultiMBean extends BasicStandardMBean,
164:                    InheritedMBean {
165:            }
166:
167:            public static class Multi extends Inherited implements  MultiMBean {
168:                public void test() {
169:                }
170:            }
171:
172:            // Valid MBean even if the class is package private
173:            public interface PackagePrivateMBean {
174:            }
175:
176:            static class PackagePrivate implements  PackagePrivateMBean {
177:            }
178:
179:            // In JMX 1.0 this is not a valid MBean: it is standard and dynamic
180:            // In JMX 1.1 it is dynamic, since the spec says that every class that implements DynamicMBean is a dynamic mbean
181:            // However, I assume that if someone writes such a class, or it did not understand JMX or is trying to fool the MBeanServer
182:            public interface StandardDynamicMBean {
183:            }
184:
185:            public static class StandardDynamic implements  DynamicMBean,
186:                    StandardDynamicMBean {
187:                public MBeanInfo getMBeanInfo() {
188:                    return new MBeanInfo(getClass().getName(), null, null,
189:                            null, null, null);
190:                }
191:
192:                public Object getAttribute(String attribute)
193:                        throws AttributeNotFoundException, MBeanException,
194:                        ReflectionException {
195:                    return null;
196:                }
197:
198:                public void setAttribute(Attribute attribute)
199:                        throws AttributeNotFoundException,
200:                        InvalidAttributeValueException, MBeanException,
201:                        ReflectionException {
202:                }
203:
204:                public AttributeList getAttributes(String[] attributes) {
205:                    return new AttributeList();
206:                }
207:
208:                public AttributeList setAttributes(AttributeList attributes) {
209:                    return new AttributeList();
210:                }
211:
212:                public Object invoke(String method, Object[] arguments,
213:                        String[] params) throws MBeanException,
214:                        ReflectionException {
215:                    return null;
216:                }
217:            }
218:
219:            // JMX 1.0: Invalid MBean: the standard MBean interface is a dynamic MBean
220:            // JMX 1.1: This is a dynamic MBean
221:            public interface StandardAndDynamicMBean extends DynamicMBean {
222:                public void mix();
223:            }
224:
225:            public static class StandardAndDynamic implements 
226:                    StandardAndDynamicMBean {
227:                public void mix() {
228:                }
229:
230:                public MBeanInfo getMBeanInfo() {
231:                    return new MBeanInfo(getClass().getName(), null, null,
232:                            null, null, null);
233:                }
234:
235:                public Object getAttribute(String attribute)
236:                        throws AttributeNotFoundException, MBeanException,
237:                        ReflectionException {
238:                    return null;
239:                }
240:
241:                public void setAttribute(Attribute attribute)
242:                        throws AttributeNotFoundException,
243:                        InvalidAttributeValueException, MBeanException,
244:                        ReflectionException {
245:                }
246:
247:                public AttributeList getAttributes(String[] attributes) {
248:                    return null;
249:                }
250:
251:                public AttributeList setAttributes(AttributeList attributes) {
252:                    return null;
253:                }
254:
255:                public Object invoke(String method, Object[] arguments,
256:                        String[] params) throws MBeanException,
257:                        ReflectionException {
258:                    return null;
259:                }
260:            }
261:
262:            // A valid dynamic MBean
263:            public static class BasicDynamic implements  DynamicMBean {
264:                public MBeanInfo getMBeanInfo() {
265:                    return new MBeanInfo(getClass().getName(), null, null,
266:                            null, null, null);
267:                }
268:
269:                public Object getAttribute(String attribute)
270:                        throws AttributeNotFoundException, MBeanException,
271:                        ReflectionException {
272:                    return null;
273:                }
274:
275:                public void setAttribute(Attribute attribute)
276:                        throws AttributeNotFoundException,
277:                        InvalidAttributeValueException, MBeanException,
278:                        ReflectionException {
279:                }
280:
281:                public AttributeList getAttributes(String[] attributes) {
282:                    return null;
283:                }
284:
285:                public AttributeList setAttributes(AttributeList attributes) {
286:                    return null;
287:                }
288:
289:                public Object invoke(String method, Object[] arguments,
290:                        String[] params) throws MBeanException,
291:                        ReflectionException {
292:                    return null;
293:                }
294:            }
295:
296:            // Invalid dynamic MBean because getClassName() returns null
297:            public static class NoClassNameDynamicMBean extends BasicDynamic {
298:                public MBeanInfo getMBeanInfo() {
299:                    MBeanInfo info = super .getMBeanInfo();
300:                    return new MBeanInfo(null, info.getDescription(), info
301:                            .getAttributes(), info.getConstructors(), info
302:                            .getOperations(), info.getNotifications());
303:                }
304:            }
305:
306:            // Valid dynamic MBean, even if its parent is standard
307:            public static class DynamicFromStandard extends BasicStandard
308:                    implements  DynamicMBean {
309:                public MBeanInfo getMBeanInfo() {
310:                    return new MBeanInfo(getClass().getName(), null, null,
311:                            null, null, null);
312:                }
313:
314:                public Object getAttribute(String attribute)
315:                        throws AttributeNotFoundException, MBeanException,
316:                        ReflectionException {
317:                    return null;
318:                }
319:
320:                public void setAttribute(Attribute attribute)
321:                        throws AttributeNotFoundException,
322:                        InvalidAttributeValueException, MBeanException,
323:                        ReflectionException {
324:                }
325:
326:                public AttributeList getAttributes(String[] attributes) {
327:                    return new AttributeList();
328:                }
329:
330:                public AttributeList setAttributes(AttributeList attributes) {
331:                    return new AttributeList();
332:                }
333:
334:                public Object invoke(String method, Object[] arguments,
335:                        String[] params) throws MBeanException,
336:                        ReflectionException {
337:                    return null;
338:                }
339:            }
340:
341:            // In JMX 1.0, this is a valid standard MBean even if its parent is dynamic
342:            // In JMX 1.1, this is a dynamic MBean
343:            public interface StandardFromDynamicMBean {
344:            }
345:
346:            public static class StandardFromDynamic extends DynamicFromStandard
347:                    implements  StandardFromDynamicMBean {
348:            }
349:
350:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.