1 23 24 package com.sun.enterprise.admin.jmx; 25 26 import java.util.Set ; 27 import java.util.IdentityHashMap ; 28 29 import javax.management.*; 30 import com.sun.jmx.mbeanserver.SunJmxMBeanServer; 31 import com.sun.jmx.interceptor.ForwardingMBeanServerInterceptor; 32 import java.io.IOException ; 33 34 52 public final class AppServerMBeanServerInterceptor extends ForwardingMBeanServerInterceptor { 53 61 protected AppServerMBeanServerInterceptor() { 62 } 63 64 public ObjectInstance createMBean(String className, ObjectName name, 65 Object params[], String signature[]) 66 throws ReflectionException, InstanceAlreadyExistsException, 67 MBeanRegistrationException, MBeanException, 68 NotCompliantMBeanException { 69 System.out.println("AppServerMBeanServerInterceptor: createMBean"); 70 return super.createMBean(className, name, params, signature); 71 } 72 73 public ObjectInstance createMBean(String className, ObjectName name, 74 ObjectName loaderName, Object params[], 75 String signature[]) 76 throws ReflectionException, InstanceAlreadyExistsException, 77 MBeanRegistrationException, MBeanException, 78 NotCompliantMBeanException, InstanceNotFoundException { 79 System.out.println("AppServerMBeanServerInterceptor: createMBean"); 80 return super.createMBean(className, name, loaderName, params, 81 signature); 82 } 83 84 public ObjectInstance createMBean(String className, ObjectName name, 85 ObjectName loaderName) 86 throws ReflectionException, InstanceAlreadyExistsException, 87 MBeanRegistrationException, MBeanException, 88 NotCompliantMBeanException, InstanceNotFoundException, 89 IOException { 90 System.out.println("NYI: createMBean"); 91 return null; 92 } 94 95 public ObjectInstance createMBean(String className, ObjectName name) 96 throws ReflectionException, InstanceAlreadyExistsException, 97 MBeanRegistrationException, MBeanException, 98 NotCompliantMBeanException, IOException { 99 System.out.println("NYI: createMBean"); 100 return null; 101 } 103 104 public ObjectInstance registerMBean(Object object, ObjectName name) 105 throws InstanceAlreadyExistsException, MBeanRegistrationException, 106 NotCompliantMBeanException { 107 System.out.println("AppServerMBeanServerInterceptor: registerMBean"); 108 return super.registerMBean(object, name); 109 } 110 111 public void unregisterMBean(ObjectName name) 112 throws InstanceNotFoundException, MBeanRegistrationException { 113 super.unregisterMBean(name); 114 } 115 116 public Set queryMBeans(ObjectName name, QueryExp query) { 117 return super.queryMBeans(name, query); 118 } 119 120 public Set queryNames(ObjectName name, QueryExp query) { 121 return super.queryNames(name, query); 122 } 123 124 public boolean isRegistered(ObjectName name) { 125 return super.isRegistered(name); 126 } 127 128 public Object getAttribute(ObjectName name, String attribute) 129 throws MBeanException, AttributeNotFoundException, 130 InstanceNotFoundException, ReflectionException { 131 System.out.println("AppServerMBeanServerInterceptor: getAttrbute"); 132 MBeanManufacturer.findPersistent(name); 133 return super.getAttribute(name, attribute); 134 } 135 136 public AttributeList getAttributes(ObjectName name, String [] attributes) 137 throws InstanceNotFoundException, ReflectionException { 138 MBeanManufacturer.findPersistent(name); 139 return super.getAttributes(name, attributes); 140 } 141 142 public void setAttribute(ObjectName name, Attribute attribute) 143 throws InstanceNotFoundException, AttributeNotFoundException, 144 InvalidAttributeValueException, MBeanException, 145 ReflectionException { 146 MBeanManufacturer.findPersistent(name); 147 super.setAttribute(name, attribute); 148 } 149 150 public AttributeList setAttributes(ObjectName name, 151 AttributeList attributes) 152 throws InstanceNotFoundException, ReflectionException { 153 return super.setAttributes(name, attributes); 154 } 155 156 public Object invoke(ObjectName name, String operationName, 157 Object params[], String signature[]) 158 throws InstanceNotFoundException, MBeanException, 159 ReflectionException { 160 MBeanManufacturer.findPersistent(name); 161 return super.invoke(name, operationName, params, signature); 162 } 163 164 public String getDefaultDomain() { 165 return super.getDefaultDomain(); 166 } 167 168 public MBeanInfo getMBeanInfo(ObjectName name) 169 throws InstanceNotFoundException, IntrospectionException, 170 ReflectionException { 171 MBeanManufacturer.findPersistent(name); 172 173 return super.getMBeanInfo(name); 174 } 175 176 public boolean isInstanceOf(ObjectName name, String className) 177 throws InstanceNotFoundException { 178 System.out.println("isInstanceOF: ?? FIXME"); 179 return super.isInstanceOf(name, className); 180 } 181 182 public ClassLoader getClassLoaderFor(ObjectName mbeanName) 183 throws InstanceNotFoundException { 184 return super.getClassLoaderFor(mbeanName); 185 } 186 187 public ClassLoader getClassLoader(ObjectName loaderName) 188 throws InstanceNotFoundException { 189 return super.getClassLoader(loaderName); 190 } 191 192 private String mapName(String name) { 194 return name.replace('-', '_'); 196 } 197 } 198 | Popular Tags |