1 28 29 30 package com.caucho.management.j2ee; 31 32 import com.caucho.ejb.AbstractSessionBean; 33 import com.caucho.jmx.AbstractMBeanServer; 34 import com.caucho.jmx.Jmx; 35 36 import javax.ejb.CreateException ; 37 import javax.management.*; 38 import javax.management.j2ee.statistics.ListenerRegistration ; 39 import java.rmi.RemoteException ; 40 import java.util.Set ; 41 42 public class ManagementImpl 43 extends AbstractSessionBean 44 { 45 private final ListenerRegistration _listenerRegistrationImpl 46 = new ListenerRegistrationImpl(); 47 48 public void ejbCreate() 49 throws CreateException 50 { 51 } 52 53 private AbstractMBeanServer getMBeanServer() 54 { 55 return Jmx.getMBeanServer(); 56 } 57 58 public Object getAttribute(ObjectName name, String attribute) 59 throws 60 MBeanException, 61 AttributeNotFoundException, 62 InstanceNotFoundException, 63 ReflectionException, 64 RemoteException 65 { 66 return getMBeanServer().getAttribute(name, attribute); 67 } 68 69 public AttributeList getAttributes(ObjectName name, String []attributes) 70 throws InstanceNotFoundException, ReflectionException, RemoteException 71 { 72 return getMBeanServer().getAttributes(name, attributes); 73 } 74 75 public String getDefaultDomain() 76 throws RemoteException 77 { 78 return getMBeanServer().getDefaultDomain(); 79 } 80 81 public Integer getMBeanCount() 82 throws RemoteException 83 { 84 return getMBeanServer().getMBeanCount(); 85 } 86 87 public MBeanInfo getMBeanInfo(ObjectName objectName) 88 throws 89 IntrospectionException, 90 InstanceNotFoundException, 91 ReflectionException, 92 RemoteException 93 { 94 return getMBeanServer().getMBeanInfo(objectName); 95 } 96 97 public Object invoke(ObjectName objectName, 98 String operationName, 99 Object []parameters, 100 String []signature) 101 throws 102 MBeanException, 103 InstanceNotFoundException, 104 ReflectionException, 105 RemoteException 106 { 107 return getMBeanServer().invoke(objectName, operationName, parameters, signature); 108 } 109 110 public boolean isRegistered(ObjectName objectName) 111 throws RemoteException 112 { 113 return getMBeanServer().isRegistered(objectName); 114 } 115 116 public Set queryNames(ObjectName objectName, QueryExp queryExp) 117 throws RemoteException 118 { 119 return getMBeanServer().queryNames(objectName, queryExp); 120 } 121 122 public void setAttribute(ObjectName objectName, Attribute attribute) 123 throws InstanceNotFoundException, 124 AttributeNotFoundException, 125 InvalidAttributeValueException, 126 MBeanException, 127 ReflectionException, 128 RemoteException 129 { 130 getMBeanServer().setAttribute(objectName, attribute); 131 } 132 133 public AttributeList setAttributes(ObjectName objectName, 134 AttributeList attributes) 135 throws InstanceNotFoundException, ReflectionException, RemoteException 136 { 137 return getMBeanServer().setAttributes(objectName, attributes); 138 } 139 140 public ListenerRegistration getListenerRegistry() 141 throws RemoteException 142 { 143 return _listenerRegistrationImpl; 144 } 145 146 public class ListenerRegistrationImpl 147 implements ListenerRegistration 148 { 149 public void addNotificationListener(ObjectName objectName, 150 NotificationListener listener, 151 NotificationFilter filter, 152 Object handback) 153 throws InstanceNotFoundException, RemoteException 154 { 155 } 156 157 public void removeNotificationListener(ObjectName objectName, 158 NotificationListener listener) 159 throws InstanceNotFoundException, ListenerNotFoundException, RemoteException 160 { 161 } 162 } 163 } 164 | Popular Tags |