KickJava   Java API By Example, From Geeks To Geeks.

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


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 package com.sun.enterprise.management.config;
24
25 import java.util.Map JavaDoc;
26
27 import javax.management.ObjectName JavaDoc;
28
29 import com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource;
30 import com.sun.appserv.management.util.misc.ExceptionUtil;
31
32 import com.sun.appserv.management.base.AMX;
33 import com.sun.appserv.management.base.Container;
34 import com.sun.appserv.management.base.XTypes;
35
36 import com.sun.appserv.management.config.AMXConfig;
37 import com.sun.appserv.management.config.SecurityServiceConfig;
38 import com.sun.appserv.management.config.JACCProviderConfig;
39
40
41 import com.sun.enterprise.management.AMXTestBase;
42 import com.sun.enterprise.management.Capabilities;
43
44 /**
45  */

46 public final class JACCProviderConfigTest extends ConfigMgrTestBase
47 {
48     static final String JavaDoc PROVIDER = "com.sun.enterprise.security.provider.PolicyWrapper";
49     static final String JavaDoc PROVIDER_FACTORY = "com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl";
50     static final Map JavaDoc<String JavaDoc,String JavaDoc> RESERVED = null;
51
52         public
53     JACCProviderConfigTest()
54     {
55         if ( checkNotOffline( "ensureDefaultInstance" ) )
56         {
57             ensureDefaultInstance( getConfigConfig().getSecurityServiceConfig() );
58         }
59     }
60          public static String JavaDoc
61     getDefaultInstanceName()
62     {
63         return getDefaultInstanceName( "JACCProviderConfig" );
64     }
65     
66         public static JACCProviderConfig
67     ensureDefaultInstance( final SecurityServiceConfig ss )
68     {
69         JACCProviderConfig result = ss.getJACCProviderConfigMap().get( getDefaultInstanceName() );
70         
71         if ( result == null )
72         {
73             result = createInstance( ss, getDefaultInstanceName(), PROVIDER, PROVIDER_FACTORY );
74         }
75         
76         return result;
77     }
78     
79         public static JACCProviderConfig
80     createInstance(
81         final SecurityServiceConfig ss,
82         final String JavaDoc name,
83         final String JavaDoc policyProvider,
84         final String JavaDoc policyConfigurationFactoryProvider )
85     {
86         return ss.createJACCProviderConfig( name,
87             policyProvider, policyConfigurationFactoryProvider, null );
88     }
89     
90     
91         protected Container
92     getProgenyContainer()
93     {
94         return getConfigConfig().getSecurityServiceConfig();
95     }
96
97         protected String JavaDoc
98     getProgenyJ2EEType()
99     {
100         return XTypes.JACC_PROVIDER_CONFIG;
101     }
102
103
104         protected void
105     removeProgeny( final String JavaDoc name )
106     {
107         getConfigConfig().getSecurityServiceConfig().removeJACCProviderConfig( name );
108     }
109
110         protected final AMXConfig
111     createProgeny(final String JavaDoc name, final Map JavaDoc<String JavaDoc,String JavaDoc> options )
112     {
113         return getConfigConfig().getSecurityServiceConfig().createJACCProviderConfig(name, PROVIDER, PROVIDER_FACTORY, options);
114     }
115 }
116
117
118
Popular Tags