blob: 7105c66d354c1f89f8322121978dc74eaef17027 [file] [log] [blame]
Manuel L. Santillan7f25bab2006-09-27 23:03:57 +00001/*
2 * Copyright 2005 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
Manuel L. Santillan0b668002006-09-09 16:06:26 +000017package org.apache.felix.jmxintrospector;
18
19import java.io.IOException;
20import java.util.Set;
21
22import javax.management.Attribute;
23import javax.management.AttributeList;
24import javax.management.AttributeNotFoundException;
25import javax.management.InstanceAlreadyExistsException;
26import javax.management.InstanceNotFoundException;
27import javax.management.IntrospectionException;
28import javax.management.InvalidAttributeValueException;
29import javax.management.ListenerNotFoundException;
30import javax.management.MBeanException;
31import javax.management.MBeanInfo;
32import javax.management.MBeanRegistrationException;
33import javax.management.MBeanServerConnection;
34import javax.management.NotCompliantMBeanException;
35import javax.management.NotificationFilter;
36import javax.management.NotificationListener;
37import javax.management.ObjectInstance;
38import javax.management.ObjectName;
39import javax.management.QueryExp;
40import javax.management.ReflectionException;
41
42public class Server implements MBeanServerConnection {
43 private MBeanServerConnection server;
44 private String id;
45 public Server(MBeanServerConnection server, String id){
46 this.server=server;
47 this.id=id;
48 }
49
50 //Delegates
51 public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException {
52 server.addNotificationListener(name, listener, filter, handback);
53 }
54 public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException {
55 server.addNotificationListener(name, listener, filter, handback);
56 }
57 public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException {
58 return server.createMBean(className, name, params, signature);
59 }
60 public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException {
61 return server.createMBean(className, name, loaderName, params, signature);
62 }
63 public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException, IOException {
64 return server.createMBean(className, name, loaderName);
65 }
66 public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, IOException {
67 return server.createMBean(className, name);
68 }
69 public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException, IOException {
70 return server.getAttribute(name, attribute);
71 }
72 public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException {
73 return server.getAttributes(name, attributes);
74 }
75 public String getDefaultDomain() throws IOException {
76 return server.getDefaultDomain();
77 }
78 public String[] getDomains() throws IOException {
79 return server.getDomains();
80 }
81 public Integer getMBeanCount() throws IOException {
82 return server.getMBeanCount();
83 }
84 public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
85 return server.getMBeanInfo(name);
86 }
87 public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException, IOException {
88 return server.getObjectInstance(name);
89 }
90 public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, IOException {
91 return server.invoke(name, operationName, params, signature);
92 }
93 public boolean isInstanceOf(ObjectName name, String className) throws InstanceNotFoundException, IOException {
94 return server.isInstanceOf(name, className);
95 }
96 public boolean isRegistered(ObjectName name) throws IOException {
97 return server.isRegistered(name);
98 }
99 public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) throws IOException {
100 return server.queryMBeans(name, query);
101 }
102 public Set<ObjectName> queryNames(ObjectName name, QueryExp query) throws IOException {
103 return server.queryNames(name, query);
104 }
105 public void removeNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
106 server.removeNotificationListener(name, listener, filter, handback);
107 }
108 public void removeNotificationListener(ObjectName name, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
109 server.removeNotificationListener(name, listener);
110 }
111 public void removeNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
112 server.removeNotificationListener(name, listener, filter, handback);
113 }
114 public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
115 server.removeNotificationListener(name, listener);
116 }
117 public void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException, IOException {
118 server.setAttribute(name, attribute);
119 }
120 public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException, IOException {
121 return server.setAttributes(name, attributes);
122 }
123 public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException {
124 server.unregisterMBean(name);
125 }
126}