KickJava   Java API By Example, From Geeks To Geeks.

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


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.Set JavaDoc;
27 import java.util.Collections JavaDoc;
28
29 import javax.management.ObjectName JavaDoc;
30 import javax.management.AttributeList JavaDoc;
31
32 import com.sun.appserv.management.base.Util;
33 import com.sun.appserv.management.config.AMXConfig;
34 import com.sun.appserv.management.config.ProviderConfig;
35 import com.sun.appserv.management.util.misc.MapUtil;
36 import com.sun.enterprise.management.support.oldconfig.OldSecurityServiceMBean;
37 import com.sun.enterprise.management.support.oldconfig.OldConfigsMBean;
38
39 import com.sun.appserv.management.util.misc.GSetUtil;
40 import com.sun.appserv.management.util.jmx.JMXUtil;
41
42
43 import com.sun.appserv.management.config.MessageSecurityConfigKeys;
44
45 /**
46  */

47 public final class MessageSecurityConfigFactory extends ConfigFactory
48 {
49     private final OldSecurityServiceMBean mOldSecurityServiceMBean;
50     private final OldConfigsMBean mOldConfigs;
51     
52         public
53     MessageSecurityConfigFactory( final ConfigFactoryCallback callbacks )
54     {
55         super( callbacks );
56         
57         mOldSecurityServiceMBean =
58             getOldConfigProxies().getOldSecurityServiceMBean( getConfigName() );
59         
60         mOldConfigs = getOldConfigProxies().getOldConfigsMBean();
61     }
62     
63         public ObjectName JavaDoc
64     create(
65         final String JavaDoc authLayer,
66         final String JavaDoc providerID,
67         final String JavaDoc providerType,
68         final String JavaDoc providerClassname,
69         Map JavaDoc<String JavaDoc,String JavaDoc> optional )
70     {
71         final String JavaDoc requestAuthSource = null;
72         final String JavaDoc requestAuthRecipient = null;
73         final String JavaDoc responseAuthSource = null;
74         final String JavaDoc responseAuthRecipient = null;
75         final boolean isDefaultProvider = false;
76         final java.util.Properties JavaDoc props = null;
77         final String JavaDoc targetName = getConfigName();
78         
79         final ObjectName JavaDoc provider = mOldConfigs.createMessageSecurityProvider(
80             authLayer,
81             providerID,
82             providerType,
83             providerClassname,
84             requestAuthSource,
85             requestAuthRecipient,
86             responseAuthSource,
87             responseAuthRecipient,
88             isDefaultProvider,
89             props,
90             targetName
91             );
92         // the resulting MBean is the *provider*, NOT the type=message-security mbean
93
getLogger().info( "OBJECTNAME: " + JMXUtil.toString( provider ) );
94         
95         final ObjectName JavaDoc providerObjectName = finish( provider, null );
96         final ProviderConfig providerConfig = (ProviderConfig)
97             Util.getExtra(getFactoryContainer()).getProxyFactory().getProxy( providerObjectName );
98         
99         final ObjectName JavaDoc amxName = Util.getExtra(providerConfig.getContainer()).getObjectName();
100         
101         return amxName;
102     }
103
104
105         protected final void
106     removeByName( final String JavaDoc authLayer )
107     {
108         mOldSecurityServiceMBean.removeMessageSecurityConfigByAuthLayer( authLayer );
109     }
110 }
111
112
113
114
115
116
117
Popular Tags