KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > kernel > mx4j > mock > MockMBeanServer


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: MockMBeanServer.java 11:51:56 AM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.kernel.mx4j.mock;
23
24 import java.io.ObjectInputStream JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import javax.management.Attribute JavaDoc;
28 import javax.management.AttributeList JavaDoc;
29 import javax.management.AttributeNotFoundException JavaDoc;
30 import javax.management.InstanceAlreadyExistsException JavaDoc;
31 import javax.management.InstanceNotFoundException JavaDoc;
32 import javax.management.IntrospectionException JavaDoc;
33 import javax.management.InvalidAttributeValueException JavaDoc;
34 import javax.management.ListenerNotFoundException JavaDoc;
35 import javax.management.MBeanException JavaDoc;
36 import javax.management.MBeanInfo JavaDoc;
37 import javax.management.MBeanRegistrationException JavaDoc;
38 import javax.management.MBeanServer JavaDoc;
39 import javax.management.NotCompliantMBeanException JavaDoc;
40 import javax.management.NotificationFilter JavaDoc;
41 import javax.management.NotificationListener JavaDoc;
42 import javax.management.ObjectInstance JavaDoc;
43 import javax.management.ObjectName JavaDoc;
44 import javax.management.OperationsException JavaDoc;
45 import javax.management.QueryExp JavaDoc;
46 import javax.management.ReflectionException JavaDoc;
47 import javax.management.loading.ClassLoaderRepository JavaDoc;
48
49 /**
50  * Mock object of the MBeanServer
51  *
52  * @author ddesjardins - eBMWebsourcing
53  */

54 public class MockMBeanServer implements MBeanServer JavaDoc {
55
56     protected boolean unregisterMBean;
57
58     public void addNotificationListener(ObjectName JavaDoc name,
59         NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter,
60         Object JavaDoc handback) throws InstanceNotFoundException JavaDoc {
61     }
62
63     public void addNotificationListener(ObjectName JavaDoc name, ObjectName JavaDoc listener,
64         NotificationFilter JavaDoc filter, Object JavaDoc handback)
65         throws InstanceNotFoundException JavaDoc {
66     }
67
68     public ObjectInstance JavaDoc createMBean(String JavaDoc className, ObjectName JavaDoc name)
69         throws ReflectionException JavaDoc, InstanceAlreadyExistsException JavaDoc,
70         MBeanRegistrationException JavaDoc, MBeanException JavaDoc, NotCompliantMBeanException JavaDoc {
71         return null;
72     }
73
74     public ObjectInstance JavaDoc createMBean(String JavaDoc className, ObjectName JavaDoc name,
75         Object JavaDoc[] params, String JavaDoc[] signature) throws ReflectionException JavaDoc,
76         InstanceAlreadyExistsException JavaDoc, MBeanRegistrationException JavaDoc,
77         MBeanException JavaDoc, NotCompliantMBeanException JavaDoc {
78         return null;
79     }
80
81     public ObjectInstance JavaDoc createMBean(String JavaDoc className, ObjectName JavaDoc name,
82         ObjectName JavaDoc loaderName) throws ReflectionException JavaDoc,
83         InstanceAlreadyExistsException JavaDoc, MBeanRegistrationException JavaDoc,
84         MBeanException JavaDoc, NotCompliantMBeanException JavaDoc, InstanceNotFoundException JavaDoc {
85         return null;
86     }
87
88     public ObjectInstance JavaDoc createMBean(String JavaDoc className, ObjectName JavaDoc name,
89         ObjectName JavaDoc loaderName, Object JavaDoc[] params, String JavaDoc[] signature)
90         throws ReflectionException JavaDoc, InstanceAlreadyExistsException JavaDoc,
91         MBeanRegistrationException JavaDoc, MBeanException JavaDoc, NotCompliantMBeanException JavaDoc,
92         InstanceNotFoundException JavaDoc {
93         return null;
94     }
95
96     public ObjectInputStream JavaDoc deserialize(ObjectName JavaDoc name, byte[] data)
97         throws InstanceNotFoundException JavaDoc, OperationsException JavaDoc {
98         return null;
99     }
100
101     public ObjectInputStream JavaDoc deserialize(String JavaDoc className, byte[] data)
102         throws OperationsException JavaDoc, ReflectionException JavaDoc {
103         return null;
104     }
105
106     public ObjectInputStream JavaDoc deserialize(String JavaDoc className,
107         ObjectName JavaDoc loaderName, byte[] data) throws InstanceNotFoundException JavaDoc,
108         OperationsException JavaDoc, ReflectionException JavaDoc {
109         return null;
110     }
111
112     public Object JavaDoc getAttribute(ObjectName JavaDoc name, String JavaDoc attribute)
113         throws MBeanException JavaDoc, AttributeNotFoundException JavaDoc,
114         InstanceNotFoundException JavaDoc, ReflectionException JavaDoc {
115         return null;
116     }
117
118     public AttributeList JavaDoc getAttributes(ObjectName JavaDoc name, String JavaDoc[] attributes)
119         throws InstanceNotFoundException JavaDoc, ReflectionException JavaDoc {
120         return null;
121     }
122
123     public ClassLoader JavaDoc getClassLoader(ObjectName JavaDoc loaderName)
124         throws InstanceNotFoundException JavaDoc {
125         return null;
126     }
127
128     public ClassLoader JavaDoc getClassLoaderFor(ObjectName JavaDoc mbeanName)
129         throws InstanceNotFoundException JavaDoc {
130         return null;
131     }
132
133     public ClassLoaderRepository JavaDoc getClassLoaderRepository() {
134         return null;
135     }
136
137     public String JavaDoc getDefaultDomain() {
138         return null;
139     }
140
141     public String JavaDoc[] getDomains() {
142         return null;
143     }
144
145     public Integer JavaDoc getMBeanCount() {
146         return null;
147     }
148
149     public MBeanInfo JavaDoc getMBeanInfo(ObjectName JavaDoc name)
150         throws InstanceNotFoundException JavaDoc, IntrospectionException JavaDoc,
151         ReflectionException JavaDoc {
152         return null;
153     }
154
155     public ObjectInstance JavaDoc getObjectInstance(ObjectName JavaDoc name)
156         throws InstanceNotFoundException JavaDoc {
157         return null;
158     }
159
160     public Object JavaDoc instantiate(String JavaDoc className) throws ReflectionException JavaDoc,
161         MBeanException JavaDoc {
162         return null;
163     }
164
165     public Object JavaDoc instantiate(String JavaDoc className, Object JavaDoc[] params,
166         String JavaDoc[] signature) throws ReflectionException JavaDoc, MBeanException JavaDoc {
167         return null;
168     }
169
170     public Object JavaDoc instantiate(String JavaDoc className, ObjectName JavaDoc loaderName)
171         throws ReflectionException JavaDoc, MBeanException JavaDoc, InstanceNotFoundException JavaDoc {
172         return null;
173     }
174
175     public Object JavaDoc instantiate(String JavaDoc className, ObjectName JavaDoc loaderName,
176         Object JavaDoc[] params, String JavaDoc[] signature) throws ReflectionException JavaDoc,
177         MBeanException JavaDoc, InstanceNotFoundException JavaDoc {
178         return null;
179     }
180
181     public Object JavaDoc invoke(ObjectName JavaDoc name, String JavaDoc operationName,
182         Object JavaDoc[] params, String JavaDoc[] signature) throws InstanceNotFoundException JavaDoc,
183         MBeanException JavaDoc, ReflectionException JavaDoc {
184         return null;
185     }
186
187     public boolean isInstanceOf(ObjectName JavaDoc name, String JavaDoc className)
188         throws InstanceNotFoundException JavaDoc {
189         return false;
190     }
191
192     public boolean isRegistered(ObjectName JavaDoc name) {
193         return false;
194     }
195
196     public boolean isUnregisterMBean() {
197         return unregisterMBean;
198     }
199
200     public Set JavaDoc queryMBeans(ObjectName JavaDoc name, QueryExp JavaDoc query) {
201         return null;
202     }
203
204     public Set JavaDoc queryNames(ObjectName JavaDoc name, QueryExp JavaDoc query) {
205         return null;
206     }
207
208     protected boolean registerMBean;
209
210     public ObjectInstance JavaDoc registerMBean(Object JavaDoc object, ObjectName JavaDoc name)
211         throws InstanceAlreadyExistsException JavaDoc, MBeanRegistrationException JavaDoc,
212         NotCompliantMBeanException JavaDoc {
213         registerMBean = true;
214         return null;
215     }
216
217     public void removeNotificationListener(ObjectName JavaDoc name,
218         NotificationListener JavaDoc listener) throws InstanceNotFoundException JavaDoc,
219         ListenerNotFoundException JavaDoc {
220     }
221
222     public void removeNotificationListener(ObjectName JavaDoc name,
223         NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter,
224         Object JavaDoc handback) throws InstanceNotFoundException JavaDoc,
225         ListenerNotFoundException JavaDoc {
226     }
227
228     public void removeNotificationListener(ObjectName JavaDoc name, ObjectName JavaDoc listener)
229         throws InstanceNotFoundException JavaDoc, ListenerNotFoundException JavaDoc {
230     }
231
232     public void removeNotificationListener(ObjectName JavaDoc name,
233         ObjectName JavaDoc listener, NotificationFilter JavaDoc filter, Object JavaDoc handback)
234         throws InstanceNotFoundException JavaDoc, ListenerNotFoundException JavaDoc {
235     }
236
237     public void setAttribute(ObjectName JavaDoc name, Attribute JavaDoc attribute)
238         throws InstanceNotFoundException JavaDoc, AttributeNotFoundException JavaDoc,
239         InvalidAttributeValueException JavaDoc, MBeanException JavaDoc, ReflectionException JavaDoc {
240     }
241
242     public AttributeList JavaDoc setAttributes(ObjectName JavaDoc name, AttributeList JavaDoc attributes)
243         throws InstanceNotFoundException JavaDoc, ReflectionException JavaDoc {
244         return null;
245     }
246
247     public void setUnregisterMBean(boolean unregisterMBean) {
248         this.unregisterMBean = unregisterMBean;
249     }
250
251     public void unregisterMBean(ObjectName JavaDoc name)
252         throws InstanceNotFoundException JavaDoc, MBeanRegistrationException JavaDoc {
253         unregisterMBean = true;
254     }
255
256     public boolean isRegisterMBean() {
257         return registerMBean;
258     }
259
260     public void setRegisterMBean(boolean registerMBean) {
261         this.registerMBean = registerMBean;
262     }
263
264 }
265
Popular Tags