1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Collections ; 26 import java.util.Map ; 27 28 import com.sun.appserv.management.base.Container; 29 import com.sun.appserv.management.base.XTypes; 30 31 import com.sun.appserv.management.config.AMXConfig; 32 import com.sun.appserv.management.config.DomainConfig; 33 import com.sun.appserv.management.config.PersistenceManagerFactoryResourceConfig; 34 35 37 public final class PersistenceManagerFactoryResourceConfigTest extends ResourceConfigTestBase 38 { 39 public PersistenceManagerFactoryResourceConfigTest() 40 { 41 if ( checkNotOffline( "ensureDefaultInstance" ) ) 42 { 43 ensureDefaultInstance( getDomainConfig() ); 44 } 45 } 46 47 public static String 48 getDefaultInstanceName() 49 { 50 return getDefaultInstanceName( "PersistenceManagerFactoryResourceConfig" ); 51 } 52 53 public static PersistenceManagerFactoryResourceConfig 54 ensureDefaultInstance( final DomainConfig dc ) 55 { 56 PersistenceManagerFactoryResourceConfig result = 57 dc.getPersistenceManagerFactoryResourceConfigMap().get( getDefaultInstanceName() ); 58 59 if ( result == null ) 60 { 61 result = createInstance( dc, 62 getDefaultInstanceName(), 63 null ); 64 } 65 66 return result; 67 } 68 69 public static PersistenceManagerFactoryResourceConfig 70 createInstance( 71 final DomainConfig dc, 72 final String name, 73 final Map <String ,String > optional) 74 { 75 return dc.createPersistenceManagerFactoryResourceConfig( 76 name, optional ); 77 } 78 79 80 81 protected Container 82 getProgenyContainer() 83 { 84 return getDomainConfig(); 85 } 86 87 protected String 88 getProgenyJ2EEType() 89 { 90 return XTypes.PERSISTENCE_MANAGER_FACTORY_RESOURCE_CONFIG; 91 } 92 93 94 protected void 95 removeProgeny( final String name ) 96 { 97 getDomainConfig().removePersistenceManagerFactoryResourceConfig( name ); 98 } 99 100 protected final AMXConfig 101 createProgeny(final String name, final Map <String ,String > options ) 102 { 103 final PersistenceManagerFactoryResourceConfig config = 104 getDomainConfig().createPersistenceManagerFactoryResourceConfig( name, options); 105 106 addReference( config ); 107 108 return( config ); 109 } 110 } 111 112 113 | Popular Tags |