1 8 9 package mx4j.tools.remote.http; 10 11 import java.io.IOException ; 12 import java.util.Set ; 13 import javax.management.AttributeList ; 14 import javax.management.AttributeNotFoundException ; 15 import javax.management.InstanceAlreadyExistsException ; 16 import javax.management.InstanceNotFoundException ; 17 import javax.management.IntrospectionException ; 18 import javax.management.InvalidAttributeValueException ; 19 import javax.management.ListenerNotFoundException ; 20 import javax.management.MBeanException ; 21 import javax.management.MBeanInfo ; 22 import javax.management.MBeanRegistrationException ; 23 import javax.management.NotCompliantMBeanException ; 24 import javax.management.ObjectInstance ; 25 import javax.management.ObjectName ; 26 import javax.management.ReflectionException ; 27 import javax.management.remote.NotificationResult ; 28 import javax.security.auth.Subject ; 29 30 33 public abstract class HTTPClientInvoker implements HTTPConnection 34 { 35 private String connectionId; 36 37 protected abstract HTTPConnection getService(); 38 39 public String connect(Object credentials) throws IOException , SecurityException 40 { 41 connectionId = getService().connect(credentials); 42 return connectionId; 43 } 44 45 public void close() throws IOException 46 { 47 getService().close(); 48 } 49 50 public String getConnectionId() throws IOException 51 { 52 return connectionId; 53 } 54 55 public ObjectInstance createMBean(String className, ObjectName name, Object params, String [] signature, Subject delegate) throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , IOException 56 { 57 return getService().createMBean(className, name, params, signature, delegate); 58 } 59 60 public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object params, String [] signature, Subject delegate) throws ReflectionException , InstanceAlreadyExistsException , MBeanRegistrationException , MBeanException , NotCompliantMBeanException , InstanceNotFoundException , IOException 61 { 62 return getService().createMBean(className, name, loaderName, params, signature, delegate); 63 } 64 65 public void unregisterMBean(ObjectName name, Subject delegate) throws InstanceNotFoundException , MBeanRegistrationException , IOException 66 { 67 getService().unregisterMBean(name, delegate); 68 } 69 70 public ObjectInstance getObjectInstance(ObjectName name, Subject delegate) throws InstanceNotFoundException , IOException 71 { 72 return getService().getObjectInstance(name, delegate); 73 } 74 75 public Set queryMBeans(ObjectName name, Object query, Subject delegate) throws IOException 76 { 77 return getService().queryMBeans(name, query, delegate); 78 } 79 80 public Set queryNames(ObjectName name, Object query, Subject delegate) throws IOException 81 { 82 return getService().queryNames(name, query, delegate); 83 } 84 85 public boolean isRegistered(ObjectName name, Subject delegate) throws IOException 86 { 87 return getService().isRegistered(name, delegate); 88 } 89 90 public Integer getMBeanCount(Subject delegate) throws IOException 91 { 92 return getService().getMBeanCount(delegate); 93 } 94 95 public Object getAttribute(ObjectName name, String attribute, Subject delegate) throws MBeanException , AttributeNotFoundException , InstanceNotFoundException , ReflectionException , IOException 96 { 97 return getService().getAttribute(name, attribute, delegate); 98 } 99 100 public AttributeList getAttributes(ObjectName name, String [] attributes, Subject delegate) throws InstanceNotFoundException , ReflectionException , IOException 101 { 102 return getService().getAttributes(name, attributes, delegate); 103 } 104 105 public void setAttribute(ObjectName name, Object attribute, Subject delegate) throws InstanceNotFoundException , AttributeNotFoundException , InvalidAttributeValueException , MBeanException , ReflectionException , IOException 106 { 107 getService().setAttribute(name, attribute, delegate); 108 } 109 110 public AttributeList setAttributes(ObjectName name, Object attributes, Subject delegate) throws InstanceNotFoundException , ReflectionException , IOException 111 { 112 return getService().setAttributes(name, attributes, delegate); 113 } 114 115 public Object invoke(ObjectName name, String operationName, Object params, String [] signature, Subject delegate) throws InstanceNotFoundException , MBeanException , ReflectionException , IOException 116 { 117 return getService().invoke(name, operationName, params, signature, delegate); 118 } 119 120 public String getDefaultDomain(Subject delegate) throws IOException 121 { 122 return getService().getDefaultDomain(delegate); 123 } 124 125 public String [] getDomains(Subject delegate) throws IOException 126 { 127 return getService().getDomains(delegate); 128 } 129 130 public MBeanInfo getMBeanInfo(ObjectName name, Subject delegate) throws InstanceNotFoundException , IntrospectionException , ReflectionException , IOException 131 { 132 return getService().getMBeanInfo(name, delegate); 133 } 134 135 public boolean isInstanceOf(ObjectName name, String className, Subject delegate) throws InstanceNotFoundException , IOException 136 { 137 return getService().isInstanceOf(name, className, delegate); 138 } 139 140 public void addNotificationListener(ObjectName name, ObjectName listener, Object filter, Object handback, Subject delegate) throws InstanceNotFoundException , IOException 141 { 142 getService().addNotificationListener(name, listener, filter, handback, delegate); 143 } 144 145 public void removeNotificationListener(ObjectName name, ObjectName listener, Subject delegate) throws InstanceNotFoundException , ListenerNotFoundException , IOException 146 { 147 getService().removeNotificationListener(name, listener, delegate); 148 } 149 150 public void removeNotificationListener(ObjectName name, ObjectName listener, Object filter, Object handback, Subject delegate) throws InstanceNotFoundException , ListenerNotFoundException , IOException 151 { 152 getService().removeNotificationListener(name, listener, filter, handback, delegate); 153 } 154 155 public Integer addNotificationListener(ObjectName name, Object filter, Subject delegate) throws InstanceNotFoundException , IOException 156 { 157 return getService().addNotificationListener(name, filter, delegate); 158 } 159 160 public void removeNotificationListeners(ObjectName name, Integer [] listenerIDs, Subject delegate) throws InstanceNotFoundException , ListenerNotFoundException , IOException 161 { 162 getService().removeNotificationListeners(name, listenerIDs, delegate); 163 } 164 165 public NotificationResult fetchNotifications(long clientSequenceNumber, int maxNotifications, long timeout) throws IOException 166 { 167 return getService().fetchNotifications(clientSequenceNumber, maxNotifications, timeout); 168 } 169 } 170 | Popular Tags |