1 8 9 package mx4j.tools.remote.local; 10 11 import java.io.IOException ; 12 import java.util.Set ; 13 import javax.management.Attribute ; 14 import javax.management.AttributeList ; 15 import javax.management.AttributeNotFoundException ; 16 import javax.management.InstanceAlreadyExistsException ; 17 import javax.management.InstanceNotFoundException ; 18 import javax.management.IntrospectionException ; 19 import javax.management.InvalidAttributeValueException ; 20 import javax.management.ListenerNotFoundException ; 21 import javax.management.MBeanException ; 22 import javax.management.MBeanInfo ; 23 import javax.management.MBeanRegistrationException ; 24 import javax.management.MBeanServerConnection ; 25 import javax.management.NotCompliantMBeanException ; 26 import javax.management.NotificationFilter ; 27 import javax.management.NotificationListener ; 28 import javax.management.ObjectInstance ; 29 import javax.management.ObjectName ; 30 import javax.management.QueryExp ; 31 import javax.management.ReflectionException ; 32 import javax.security.auth.Subject ; 33 34 37 class LocalConnectionMBeanServerConnection implements MBeanServerConnection 38 { 39 private final LocalConnection connection; 40 private final Subject delegate; 41 42 LocalConnectionMBeanServerConnection(LocalConnection connection, Subject delegate) 43 { 44 this.connection = connection; 45 this.delegate = delegate; 46 } 47 48 public void addNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, Object handback) 49 throws InstanceNotFoundException , IOException 50 { 51 connection.addNotificationListener(observed, listener, filter, handback, delegate); 52 } 53 54 public void removeNotificationListener(ObjectName observed, NotificationListener listener) 55 throws InstanceNotFoundException , ListenerNotFoundException , IOException 56 { 57 connection.removeNotificationListener(observed, listener, delegate); 58 } 59 60 public void removeNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, Object handback) 61 throws InstanceNotFoundException , ListenerNotFoundException , IOException 62 { 63 connection.removeNotificationListener(observed, listener, filter, handback, delegate); 64 } 65 66 public void addNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, Object handback) 67 throws InstanceNotFoundException , IOException 68 { 69 connection.addNotificationListener(observed, listener, filter, handback, delegate); 70 } 71 72 public void removeNotificationListener(ObjectName observed, ObjectName listener) 73 throws InstanceNotFoundException , ListenerNotFoundException , IOException 74 { 75 connection.removeNotificationListener(observed, listener, delegate); 76 } 77 78 public void removeNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, Object handback) 79 throws InstanceNotFoundException , ListenerNotFoundException , IOException 80 { 81 connection.removeNotificationListener(observed, listener, filter, handback, delegate); 82 } 83 84 public MBeanInfo getMBeanInfo(ObjectName objectName) 85 throws InstanceNotFoundException , IntrospectionException , ReflectionException , IOException 86 { 87 return connection.getMBeanInfo(objectName, delegate); 88 } 89 90 public boolean isInstanceOf(ObjectName objectName, String className) 91 throws InstanceNotFoundException , IOException 92 { 93 return connection.isInstanceOf(objectName, className, delegate); 94 } 95 96 public String [] getDomains() 97 throws IOException 98 { 99 return connection.getDomains(delegate); 100 } 101 102 public String getDefaultDomain() 103 throws IOException 104 { 105 return connection.getDefaultDomain(delegate); 106 } 107 108 public ObjectInstance createMBean(String className, ObjectName objectName) 109 throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , IOException 110 { 111 return connection.createMBean(className, objectName, null, null, delegate); 112 } 113 114 public ObjectInstance createMBean(String className, ObjectName objectName, Object [] args, String [] parameters) 115 throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , IOException 116 { 117 return connection.createMBean(className, objectName, args, parameters, delegate); 118 } 119 120 public ObjectInstance createMBean(String className, ObjectName objectName, ObjectName loaderName) 121 throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , InstanceNotFoundException , IOException 122 { 123 return connection.createMBean(className, objectName, loaderName, null, null, delegate); 124 } 125 126 public ObjectInstance createMBean(String className, ObjectName objectName, ObjectName loaderName, Object [] args, String [] parameters) 127 throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , InstanceNotFoundException , IOException 128 { 129 return connection.createMBean(className, objectName, loaderName, args, parameters, delegate); 130 } 131 132 public void unregisterMBean(ObjectName objectName) 133 throws InstanceNotFoundException , MBeanRegistrationException , IOException 134 { 135 connection.unregisterMBean(objectName, delegate); 136 } 137 138 public Object getAttribute(ObjectName objectName, String attribute) 139 throws MBeanException , AttributeNotFoundException , InstanceNotFoundException , ReflectionException , IOException 140 { 141 return connection.getAttribute(objectName, attribute, delegate); 142 } 143 144 public void setAttribute(ObjectName objectName, Attribute attribute) 145 throws InstanceNotFoundException , AttributeNotFoundException , InvalidAttributeValueException , MBeanException , ReflectionException , IOException 146 { 147 connection.setAttribute(objectName, attribute, delegate); 148 } 149 150 public AttributeList getAttributes(ObjectName objectName, String [] attributes) 151 throws InstanceNotFoundException , ReflectionException , IOException 152 { 153 return connection.getAttributes(objectName, attributes, delegate); 154 } 155 156 public AttributeList setAttributes(ObjectName objectName, AttributeList attributes) 157 throws InstanceNotFoundException , ReflectionException , IOException 158 { 159 return connection.setAttributes(objectName, attributes, delegate); 160 } 161 162 public Object invoke(ObjectName objectName, String methodName, Object [] args, String [] parameters) 163 throws InstanceNotFoundException , MBeanException , ReflectionException , IOException 164 { 165 return connection.invoke(objectName, methodName, args, parameters, delegate); 166 } 167 168 public Integer getMBeanCount() 169 throws IOException 170 { 171 return connection.getMBeanCount(delegate); 172 } 173 174 public boolean isRegistered(ObjectName objectName) 175 throws IOException 176 { 177 return connection.isRegistered(objectName, delegate); 178 } 179 180 public ObjectInstance getObjectInstance(ObjectName objectName) 181 throws InstanceNotFoundException , IOException 182 { 183 return connection.getObjectInstance(objectName, delegate); 184 } 185 186 public Set queryMBeans(ObjectName patternName, QueryExp filter) 187 throws IOException 188 { 189 return connection.queryMBeans(patternName, filter, delegate); 190 } 191 192 public Set queryNames(ObjectName patternName, QueryExp filter) 193 throws IOException 194 { 195 return connection.queryNames(patternName, filter, delegate); 196 } 197 } 198 | Popular Tags |