KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > javax > management > support > NullMBeanInfoDMB


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package test.javax.management.support;
10
11 import javax.management.Attribute JavaDoc;
12 import javax.management.AttributeList JavaDoc;
13 import javax.management.AttributeNotFoundException JavaDoc;
14 import javax.management.DynamicMBean JavaDoc;
15 import javax.management.InvalidAttributeValueException JavaDoc;
16 import javax.management.MBeanAttributeInfo JavaDoc;
17 import javax.management.MBeanConstructorInfo JavaDoc;
18 import javax.management.MBeanException JavaDoc;
19 import javax.management.MBeanInfo JavaDoc;
20 import javax.management.MBeanNotificationInfo JavaDoc;
21 import javax.management.MBeanOperationInfo JavaDoc;
22 import javax.management.MBeanRegistration JavaDoc;
23 import javax.management.MBeanServer JavaDoc;
24 import javax.management.ObjectName JavaDoc;
25 import javax.management.ReflectionException JavaDoc;
26
27 /**
28  * @version $Revision: 1.4 $
29  */

30 public class NullMBeanInfoDMB implements DynamicMBean JavaDoc, MBeanRegistration JavaDoc
31 {
32    private boolean registered;
33
34    public MBeanInfo JavaDoc getMBeanInfo()
35    {
36       return (registered)
37              ? null
38              : new MBeanInfo JavaDoc("test.javax.management.support.NullMBeanInfoDMB",
39                              "A DynamicMBean that returns null in response to getMBeanInfo() invocations",
40                              new MBeanAttributeInfo JavaDoc[0],
41                              new MBeanConstructorInfo JavaDoc[0],
42                              new MBeanOperationInfo JavaDoc[0],
43                              new MBeanNotificationInfo JavaDoc[0]);
44    }
45
46    public Object JavaDoc getAttribute(String JavaDoc attribute)
47            throws AttributeNotFoundException JavaDoc, MBeanException JavaDoc, ReflectionException JavaDoc
48    {
49       return null;
50    }
51
52    public void setAttribute(Attribute JavaDoc attribute)
53            throws
54            AttributeNotFoundException JavaDoc,
55            InvalidAttributeValueException JavaDoc,
56            MBeanException JavaDoc,
57            ReflectionException JavaDoc
58    {
59    }
60
61    public AttributeList JavaDoc getAttributes(String JavaDoc[] attributes)
62    {
63       return null;
64    }
65
66    public AttributeList JavaDoc setAttributes(AttributeList JavaDoc attributes)
67    {
68       return null;
69    }
70
71    public Object JavaDoc invoke(String JavaDoc method, Object JavaDoc[] arguments, String JavaDoc[] params)
72            throws MBeanException JavaDoc, ReflectionException JavaDoc
73    {
74       return null;
75    }
76
77    public void postDeregister()
78    {
79    }
80
81    public void postRegister(Boolean JavaDoc registrationDone)
82    {
83       registered = registrationDone.booleanValue();
84    }
85
86    public void preDeregister() throws Exception JavaDoc
87    {
88    }
89
90    public ObjectName JavaDoc preRegister(MBeanServer JavaDoc server, ObjectName JavaDoc name)
91            throws Exception JavaDoc
92    {
93       return name;
94    }
95
96 }
97
Popular Tags