1 23 24 29 package com.sun.enterprise.admin.mbeans; 30 31 32 import javax.management.MBeanServer ; 33 import javax.management.ObjectName ; 34 import javax.management.ObjectInstance ; 35 36 import com.sun.enterprise.admin.common.ObjectNames; 37 import com.sun.enterprise.admin.util.ClassUtil; 38 39 import com.sun.enterprise.admin.dottedname.DottedNameRegistry; 40 import com.sun.enterprise.admin.dottedname.DottedNameGetSetMBean; 41 import com.sun.enterprise.admin.server.core.AdminService; 42 import com.sun.enterprise.admin.AdminContext; 43 import java.lang.reflect.Constructor ; 44 import java.lang.reflect.InvocationTargetException ; 45 46 49 public class DottedNameMBeansIniter 50 { 51 public 52 DottedNameMBeansIniter( MBeanServer server ) 53 throws Exception 54 { 55 init( server ); 56 } 57 58 59 public void 60 init( MBeanServer server ) 61 throws Exception 62 { 63 final DottedNameRegistry registry = new DottedNameRegistryMBeanImpl(); 65 server.registerMBean( registry, ObjectNames.getDottedNameRegistryObjectName() ); 66 67 final DottedNameRegistry monitoringRegistry = new DottedNameRegistryMBeanImpl(); 69 server.registerMBean( monitoringRegistry, ObjectNames.getDottedNameMonitoringRegistryObjectName() ); 70 71 72 78 server.registerMBean( 79 getDottedNameGetSetMBean(server, registry, monitoringRegistry), 80 ObjectNames.getDottedNameGetSetObjectName() ); 81 } 82 83 private DottedNameGetSetMBean getDottedNameGetSetMBean( 84 final MBeanServer server, 85 final DottedNameRegistry registry, 86 final DottedNameRegistry monitoringRegistry) 87 throws Exception 88 { 89 final String dnClassName= AdminService.getAdminService().getAdminContext().getDottedNameMBeanImplClassName(); 90 final Class dnClass = Class.forName(dnClassName); 91 final Class [] types = new Class []{javax.management.MBeanServerConnection .class, 92 com.sun.enterprise.admin.dottedname.DottedNameRegistry.class, 93 com.sun.enterprise.admin.dottedname.DottedNameRegistry.class}; 94 final Constructor dnConstructor = dnClass.getConstructor(types); 95 final Object [] params = new Object []{server, registry, monitoringRegistry}; 96 final DottedNameGetSetMBean dnMbean = (DottedNameGetSetMBean) dnConstructor.newInstance(params); 97 return dnMbean; 98 } 99 } 100 101 | Popular Tags |