1 24 25 package org.objectweb.jonas.management; 26 27 import org.apache.commons.modeler.Registry; 28 import org.objectweb.jonas.server.Server; 29 30 import org.objectweb.jonas.common.Log; 32 33 import org.objectweb.util.monolog.api.Logger; 35 import org.objectweb.util.monolog.api.BasicLevel; 36 37 41 public class JonasMBeanTools { 42 43 45 private final static String [] PACKAGE_DESCRIPTORS = { 46 "org.objectweb.jonas.server", "org.objectweb.jonas.ear", 47 "org.objectweb.jonas.container", "org.objectweb.jonas.naming", 48 "org.objectweb.jonas.mail", 49 "org.objectweb.jonas.resource", "org.objectweb.jonas.jtm", 50 "org.objectweb.jonas.dbm", "org.objectweb.jonas.ws.mbean"}; 51 52 54 private static Registry s_Registry = null; 55 private static Logger s_Logger = Log.getLogger(Log.JONAS_MANAGEMENT_PREFIX); 56 57 59 64 public synchronized static Registry getRegistry() { 65 66 if (s_Registry == null) { 67 s_Registry = Registry.getRegistry(null, null); 69 ClassLoader cl = Server.class.getClassLoader(); 70 71 for (int i = 0; i < PACKAGE_DESCRIPTORS.length; i++) { 73 s_Registry.loadDescriptors(PACKAGE_DESCRIPTORS[i], cl); 74 } 75 76 if (s_Logger.isLoggable(BasicLevel.DEBUG)) { 78 String s; 79 String [] as = s_Registry.findManagedBeans(); 80 s_Logger.log(BasicLevel.DEBUG, ">>> List of all MBeans descriptors"); 81 for (int i = 0; i < as.length; i++) { 82 s = ">>> " + i + ") " + as[i]; 83 s_Logger.log(BasicLevel.DEBUG, s); 84 } 85 s_Logger.log(BasicLevel.DEBUG, "<<< List of all MBeans descriptors"); 86 } 87 } 88 return (s_Registry); 89 } 90 91 } 92 | Popular Tags |