1 23 package com.sun.appserv.management.config; 24 25 import java.io.File ; 26 27 import java.lang.reflect.Constructor ; 28 29 import javax.management.MBeanServer ; 30 import javax.management.ObjectName ; 31 32 import com.sun.appserv.management.base.AMX; 33 import com.sun.appserv.management.base.Util; 34 import com.sun.appserv.management.DomainRoot; 35 import com.sun.appserv.management.client.ProxyFactory; 36 37 38 39 42 public final class OfflineConfigIniter 43 { 44 private final MBeanServer mServer; 45 private final File mDomainXML; 46 private final ObjectName mLoader; 47 private final DomainRoot mDomainRoot; 48 49 private static final String LOADER_CLASSNAME = 50 "com.sun.enterprise.management.offline.OfflineLoader"; 51 52 private final Class [] LOADER_CONSTRUCTOR_SIG = new Class [] 53 { 54 MBeanServer .class, 55 File .class, 56 }; 57 58 public 59 OfflineConfigIniter( 60 final MBeanServer server, 61 final File domainXML ) 62 { 63 mServer = server; 64 mDomainXML = domainXML; 65 mLoader = initLoader(); 66 67 mDomainRoot = ProxyFactory.getInstance( server ).getDomainRoot(); 68 } 69 70 public DomainRoot 71 getDomainRoot() 72 { 73 return mDomainRoot; 74 } 75 76 public static final String NAME = "offline-mbean-loader"; 77 78 private ObjectName 79 initLoader() 80 { 81 ObjectName loaderObjectName = null; 82 83 try 84 { 85 final Class loaderClass = Class.forName( LOADER_CLASSNAME ); 90 final Constructor constructor = 91 loaderClass.getConstructor( LOADER_CONSTRUCTOR_SIG ); 92 93 final Object loader = constructor.newInstance( mServer, mDomainXML ); 94 95 final String domain = AMX.JMX_DOMAIN + "-support"; 96 loaderObjectName = Util.newObjectName( domain, Util.makeNameProp( NAME ) ); 97 loaderObjectName = 98 mServer.registerMBean( loader, loaderObjectName ).getObjectName(); 99 } 100 catch(Throwable t) 101 { 102 t.printStackTrace(); 103 104 throw new RuntimeException ( t ); 105 } 106 107 return loaderObjectName; 108 } 109 } 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | Popular Tags |