KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > AdminObjectResourceConfigTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 package com.sun.enterprise.management.config;
25
26 import java.util.Collections JavaDoc;
27 import java.util.Map JavaDoc;
28
29 import com.sun.appserv.management.base.Container;
30 import com.sun.appserv.management.base.XTypes;
31 import com.sun.appserv.management.config.AMXConfig;
32 import com.sun.appserv.management.config.DomainConfig;
33 import com.sun.appserv.management.config.AdminObjectResourceConfig;
34
35 /**
36  */

37 public final class AdminObjectResourceConfigTest extends ResourceConfigTestBase
38 {
39     private static final String JavaDoc ADM_OBJ_RES_TYPE = "user";
40     private static final String JavaDoc ADM_OBJ_RES_ADAPTER = "cciblackbox-tx";
41
42
43     public AdminObjectResourceConfigTest()
44     {
45         if ( checkNotOffline( "ensureDefaultInstance" ) )
46         {
47             ensureDefaultInstance( getDomainConfig() );
48         }
49     }
50     
51         public static String JavaDoc
52     getDefaultInstanceName()
53     {
54         return getDefaultInstanceName( "AdminObjectResourceConfig" );
55     }
56     
57         public static AdminObjectResourceConfig
58     ensureDefaultInstance( final DomainConfig domainConfig )
59     {
60         AdminObjectResourceConfig result =
61             domainConfig.getAdminObjectResourceConfigMap().get( getDefaultInstanceName() );
62         
63         if ( result == null )
64         {
65             result = createInstance(
66                 domainConfig,
67                 getDefaultInstanceName(),
68                 ADM_OBJ_RES_TYPE,
69                 ADM_OBJ_RES_ADAPTER,
70                 null );
71         }
72         
73         return result;
74     }
75     
76         public static AdminObjectResourceConfig
77     createInstance(
78         final DomainConfig domainConfig,
79         final String JavaDoc name,
80         final String JavaDoc resType,
81         final String JavaDoc resAdapter,
82         final Map JavaDoc<String JavaDoc,String JavaDoc> optional )
83     {
84         return domainConfig.createAdminObjectResourceConfig( name,
85             resType, resAdapter, optional );
86     }
87     
88     
89     
90         protected Container
91     getProgenyContainer()
92     {
93         return getDomainConfig();
94     }
95
96         protected String JavaDoc
97     getProgenyJ2EEType()
98     {
99         return XTypes.ADMIN_OBJECT_RESOURCE_CONFIG;
100     }
101
102
103         protected void
104     removeProgeny( final String JavaDoc name )
105     {
106         getDomainConfig().removeAdminObjectResourceConfig( name );
107     }
108     
109         protected String JavaDoc
110     getProgenyTestName()
111     {
112         return( "jndi/AdminObjectResourceConfigMgrTest" );
113     }
114     
115         protected final AMXConfig
116     createProgeny(final String JavaDoc name, final Map JavaDoc<String JavaDoc,String JavaDoc> options )
117     {
118         final AdminObjectResourceConfig config = getDomainConfig().createAdminObjectResourceConfig(
119             name,
120             ADM_OBJ_RES_TYPE,
121             ADM_OBJ_RES_ADAPTER,
122             options);
123                 
124         addReference( config );
125
126         return( config );
127     }
128 }
129
130
131
Popular Tags