1 /***
2 *
3 * Copyright RAJD Consultancy Ltd
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 **/
18
19 package org.logicblaze.lingo.jmx.remote.jms;
20
21 import java.io.IOException;
22 import java.util.Set;
23 import javax.management.Attribute;
24 import javax.management.AttributeList;
25 import javax.management.AttributeNotFoundException;
26 import javax.management.InstanceAlreadyExistsException;
27 import javax.management.InstanceNotFoundException;
28 import javax.management.IntrospectionException;
29 import javax.management.InvalidAttributeValueException;
30 import javax.management.ListenerNotFoundException;
31 import javax.management.MBeanException;
32 import javax.management.MBeanInfo;
33 import javax.management.MBeanRegistrationException;
34 import javax.management.MBeanServerConnection;
35 import javax.management.NotCompliantMBeanException;
36 import javax.management.NotificationFilter;
37 import javax.management.NotificationListener;
38 import javax.management.ObjectInstance;
39 import javax.management.ObjectName;
40 import javax.management.QueryExp;
41 import javax.management.ReflectionException;
42
43 /***
44 * Acts as a delegate for the MBeanServerConnection
45 * @version $Revision: 1.1 $
46 */
47 public class MBeanServerConnectionDelegate implements MBeanServerConnection{
48
49 protected MBeanServerConnection connection;
50
51 public MBeanServerConnectionDelegate(MBeanServerConnection connection){
52 this.connection = connection;
53
54 }
55 public ObjectInstance createMBean(String className,ObjectName name) throws ReflectionException,InstanceAlreadyExistsException,MBeanRegistrationException,MBeanException,NotCompliantMBeanException,IOException{
56 return connection.createMBean(className, name);
57 }
58
59 public ObjectInstance createMBean(String className,ObjectName name,ObjectName loaderName) throws ReflectionException,InstanceAlreadyExistsException,MBeanRegistrationException,MBeanException,NotCompliantMBeanException,InstanceNotFoundException,IOException{
60 return connection.createMBean(className,name,loaderName);
61 }
62
63 public ObjectInstance createMBean(String className,ObjectName name,Object[] params,String[] signature) throws ReflectionException,InstanceAlreadyExistsException,MBeanRegistrationException,MBeanException,NotCompliantMBeanException,IOException{
64 return connection.createMBean(className,name,params,signature);
65 }
66
67
68 public ObjectInstance createMBean(String className,ObjectName name,ObjectName loaderName,Object[] params,String[] signature) throws ReflectionException,InstanceAlreadyExistsException,MBeanRegistrationException,MBeanException,NotCompliantMBeanException,InstanceNotFoundException,IOException{
69 return connection.createMBean(className, name, loaderName, params, signature);
70 }
71
72 public void unregisterMBean(ObjectName name) throws InstanceNotFoundException,MBeanRegistrationException,IOException{
73 connection.unregisterMBean(name);
74
75 }
76
77 public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException,IOException{
78 return connection.getObjectInstance(name);
79 }
80
81 public Set queryMBeans(ObjectName name,QueryExp query) throws IOException{
82 return connection.queryMBeans(name, query);
83 }
84
85 public Set queryNames(ObjectName name,QueryExp query) throws IOException{
86 return connection.queryNames(name, query);
87 }
88
89 public boolean isRegistered(ObjectName name) throws IOException{
90 return connection.isRegistered(name);
91 }
92
93 public Integer getMBeanCount() throws IOException{
94 return connection.getMBeanCount();
95 }
96
97 public Object getAttribute(ObjectName name,String attribute) throws MBeanException,AttributeNotFoundException,InstanceNotFoundException,ReflectionException,IOException{
98 return connection.getAttribute(name, attribute);
99 }
100
101 public AttributeList getAttributes(ObjectName name,String[] attributes) throws InstanceNotFoundException,ReflectionException,IOException{
102 return connection.getAttributes(name, attributes);
103 }
104
105 public void setAttribute(ObjectName name,Attribute attribute) throws InstanceNotFoundException,AttributeNotFoundException,InvalidAttributeValueException,MBeanException,ReflectionException,IOException{
106 connection.setAttribute(name, attribute);
107
108 }
109
110 public AttributeList setAttributes(ObjectName name,AttributeList attributes) throws InstanceNotFoundException,ReflectionException,IOException{
111 return connection.setAttributes(name, attributes);
112 }
113
114 public Object invoke(ObjectName name,String operationName,Object[] params,String[] signature) throws InstanceNotFoundException,MBeanException,ReflectionException,IOException{
115 return connection.invoke(name, operationName, params, signature);
116 }
117
118 public String getDefaultDomain() throws IOException{
119 return connection.getDefaultDomain();
120 }
121
122 public String[] getDomains() throws IOException{
123 return connection.getDomains();
124 }
125
126 public void addNotificationListener(ObjectName name,NotificationListener listener,NotificationFilter filter,Object handback) throws InstanceNotFoundException,IOException{
127 connection.addNotificationListener(name, listener, filter, handback);
128
129 }
130
131 public void addNotificationListener(ObjectName name,ObjectName listener,NotificationFilter filter,Object handback) throws InstanceNotFoundException,IOException{
132 connection.addNotificationListener(name, listener, filter, handback);
133
134 }
135
136 public void removeNotificationListener(ObjectName name,ObjectName listener) throws InstanceNotFoundException,ListenerNotFoundException,IOException{
137 connection.removeNotificationListener(name, listener);
138
139 }
140
141 public void removeNotificationListener(ObjectName name,ObjectName listener,NotificationFilter filter,Object handback) throws InstanceNotFoundException,ListenerNotFoundException,IOException{
142 connection.removeNotificationListener(name, listener,filter,handback);
143
144 }
145
146 public void removeNotificationListener(ObjectName name,NotificationListener listener) throws InstanceNotFoundException,ListenerNotFoundException,IOException{
147 connection.removeNotificationListener(name, listener);
148
149 }
150
151 public void removeNotificationListener(ObjectName name,NotificationListener listener,NotificationFilter filter,Object handback) throws InstanceNotFoundException,ListenerNotFoundException,IOException{
152 connection.removeNotificationListener(name, listener, filter, handback);
153
154 }
155
156 public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException,IntrospectionException,ReflectionException,IOException{
157 return connection.getMBeanInfo(name);
158 }
159
160 public boolean isInstanceOf(ObjectName name,String className) throws InstanceNotFoundException,IOException{
161 return connection.isInstanceOf(name, className);
162 }
163
164
165 }