KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > management > systemstate > 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 3:25:38 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

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