KickJava   Java API By Example, From Geeks To Geeks.

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


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.Set JavaDoc;
26 import java.util.Map JavaDoc;
27 import java.util.Properties JavaDoc;
28
29 import javax.management.ObjectName JavaDoc;
30 import javax.management.AttributeList JavaDoc;
31
32 import com.sun.appserv.management.base.XTypes;
33 import com.sun.appserv.management.config.AMXConfig;
34 import com.sun.appserv.management.config.ResourceAdapterConfigKeys;
35 import com.sun.enterprise.management.support.Delegate;
36 import com.sun.appserv.management.util.misc.MapUtil;
37 import com.sun.appserv.management.util.misc.GSetUtil;
38
39
40
41
42
43 /**
44     MBean managing all instances of <resource-adapter-config> .
45  */

46
47 public final class ResourceAdapterConfigFactory extends ResourceFactoryImplBase
48     // implements ResourceAdapterConfigMgr
49
{
50         public
51     ResourceAdapterConfigFactory( final ConfigFactoryCallback callbacks )
52     {
53         super( callbacks );
54     }
55
56     private final Set JavaDoc<String JavaDoc> LEGAL_OPTIONAL_KEYS =
57         GSetUtil.newUnmodifiableStringSet(
58         ResourceAdapterConfigKeys.THREAD_POOL_IDS_KEY
59     );
60     
61         protected Set JavaDoc<String JavaDoc>
62     getLegalOptionalCreateKeys()
63     {
64         return( LEGAL_OPTIONAL_KEYS );
65     }
66     
67     
68     public static final String JavaDoc RES_ADAPTOR_NAME_KEY = "ResourceAdapterName";
69     
70         protected Map JavaDoc<String JavaDoc,String JavaDoc>
71     getParamNameOverrides()
72     {
73         return( MapUtil.newMap( ResourceAdapterConfigKeys.THREAD_POOL_IDS_KEY, "thread-pool-ids" ) );
74     }
75
76                 
77     /**
78         The caller is responsible for dealing with any Properties.
79      */

80         protected ObjectName JavaDoc
81     createOldChildConfig(
82         final AttributeList JavaDoc translatedAttrs,
83         final Properties JavaDoc properties )
84     {
85         final ObjectName JavaDoc objectName =
86                 getOldResourcesMBean().createResourceAdapterConfig(
87                     translatedAttrs, properties, null );
88
89         return( objectName );
90     }
91
92     /**
93         Create a new &lt;resource-adapter-config&gt
94         
95         @param resourceAdapterName
96         @param optional
97      */

98         public ObjectName JavaDoc
99     create( String JavaDoc resourceAdapterName, Map JavaDoc<String JavaDoc,String JavaDoc> optional )
100     {
101         final String JavaDoc[] requiredParams = new String JavaDoc[] {
102             RES_ADAPTOR_NAME_KEY, resourceAdapterName,
103         };
104
105         final Map JavaDoc<String JavaDoc,String JavaDoc> params = initParams( requiredParams, optional );
106
107         final ObjectName JavaDoc amxName = createNamedChild( resourceAdapterName, params );
108
109         return( amxName );
110     }
111     
112     
113         protected void
114     removeByName( final String JavaDoc name )
115     {
116         getOldResourcesMBean().deleteResourceAdapterConfig( name, null);
117     }
118
119 }
120
121
Popular Tags