KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.Properties JavaDoc;
27
28 import javax.management.ObjectName JavaDoc;
29
30 import javax.management.Attribute JavaDoc;
31 import javax.management.AttributeList JavaDoc;
32
33 import com.sun.appserv.management.base.XTypes;
34
35 import com.sun.appserv.management.util.jmx.JMXUtil;
36
37 import com.sun.enterprise.management.support.oldconfig.OldSecurityServiceMBean;
38
39 /**
40  */

41 public final class JACCProviderConfigFactory extends ConfigFactory
42 {
43     private static final String JavaDoc POLICY_PROVIDER_KEY = "PolicyProvider";
44
45     private static final String JavaDoc POLICY_CONFIGURATION_FACTORY_PROVIDER_KEY =
46         "PolicyConfigurationFactoryProvider";
47     
48     private final OldSecurityServiceMBean mOldSecurityService;
49     
50     /**
51
52      */

53         public
54     JACCProviderConfigFactory(final ConfigFactoryCallback callbacks )
55     {
56         super( callbacks );
57         
58         mOldSecurityService =
59             getOldConfigProxies().getOldSecurityServiceMBean( getConfigName() );
60     }
61
62     /**
63         Create a new <jacc-provider>
64         
65         @param name name of the <jacc-provider>
66         @param policyProvider a classname
67         @param policyConfigurationFactoryProvider a classname
68         @param reservedForFutureUse reserved for future use
69      */

70         public ObjectName JavaDoc
71     create(
72         String JavaDoc name,
73         String JavaDoc policyProvider,
74         String JavaDoc policyConfigurationFactoryProvider,
75         Map JavaDoc<String JavaDoc,String JavaDoc> reservedForFutureUse )
76     {
77         final String JavaDoc[] requiredParams = {
78             POLICY_PROVIDER_KEY, policyProvider,
79             POLICY_CONFIGURATION_FACTORY_PROVIDER_KEY, policyConfigurationFactoryProvider,
80         };
81         
82         if ( name == null )
83         {
84             throw new IllegalArgumentException JavaDoc( "" + null );
85         }
86
87         final Map JavaDoc<String JavaDoc,String JavaDoc> params = initParams( name, requiredParams, reservedForFutureUse );
88
89         final ObjectName JavaDoc amxName = createNamedChild( name, params );
90
91         return amxName;
92     }
93
94         public void
95     removeByName( final String JavaDoc name )
96     {
97         mOldSecurityService.removeJaccProviderByName( name );
98     }
99
100     /**
101         The caller is responsible for dealing with any Properties.
102      */

103         protected ObjectName JavaDoc
104     createOldChildConfig( final AttributeList JavaDoc translatedAttrs )
105     {
106         trace( "createOldChildConfig: attrs: " + stringify( translatedAttrs ) );
107         
108         final ObjectName JavaDoc objectName =
109                 mOldSecurityService.createJaccProvider( translatedAttrs );
110         
111         return( objectName );
112     }
113 }
114
115
116
117
118
Popular Tags