KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > management > autoload > 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 4:55:34 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.management.autoload;
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.MalformedObjectNameException JavaDoc;
40 import javax.management.NotCompliantMBeanException JavaDoc;
41 import javax.management.NotificationFilter JavaDoc;
42 import javax.management.NotificationListener JavaDoc;
43 import javax.management.ObjectInstance JavaDoc;
44 import javax.management.ObjectName JavaDoc;
45 import javax.management.OperationsException JavaDoc;
46 import javax.management.QueryExp JavaDoc;
47 import javax.management.ReflectionException JavaDoc;
48 import javax.management.loading.ClassLoaderRepository JavaDoc;
49
50 /**
51  * Mock object of the MBeanServer
52  *
53  * @author ddesjardins - eBMWebsourcing
54  */

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