1 23 24 package com.sun.enterprise.admin.common; 25 26 28 import javax.management.MBeanServer ; 30 31 import com.sun.enterprise.admin.util.SOMLocalStringsManager; 33 34 49 50 public class MBeanServerFactory 51 { 52 public static final String kDefaultInitializerClassName = 53 "com.sun.enterprise.admin.server.core.AdminService"; 54 55 private static MBeanServer sMBeanServerInstance = null; 56 57 private static SOMLocalStringsManager localizedStrMgr = 59 SOMLocalStringsManager.getManager( MBeanServerFactory.class ); 60 61 73 public static void initialize(Object initializer, MBeanServer mbs) 74 { 75 if (sMBeanServerInstance != null) 76 { 77 String msg = localizedStrMgr.getString( "admin.common.already_initialized" ); 78 throw new IllegalStateException ( msg ); 79 } 80 if (initializer == null || mbs == null) 81 { 82 String msg = localizedStrMgr.getString( "admin.common.null_arg" ); 83 throw new IllegalArgumentException ( msg ); 84 } 85 if (!initializer.getClass().getName().equals(kDefaultInitializerClassName)) 86 { 87 String msg = localizedStrMgr.getString( "admin.common.invalid_initializer" ); 88 throw new IllegalArgumentException ( msg ); 89 } 90 sMBeanServerInstance = mbs; 91 } 92 93 101 public static MBeanServer getMBeanServer() 102 { 103 return ( sMBeanServerInstance ); 104 } 105 } 106 | Popular Tags |