KickJava   Java API By Example, From Geeks To Geeks.

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


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.Collections JavaDoc;
27
28 import javax.management.ObjectName JavaDoc;
29
30 import com.sun.appserv.management.base.Util;
31 import com.sun.appserv.management.config.Description;
32
33 import com.sun.appserv.management.util.misc.GSetUtil;
34
35 import com.sun.appserv.management.config.ResourceConfigKeys;
36 import com.sun.appserv.management.config.ResourceRefConfig;
37 import com.sun.appserv.management.config.ResourceRefConfigReferent;
38
39 import com.sun.appserv.management.helper.RefHelper;
40
41     
42 /**
43  */

44
45 abstract class ResourceFactoryImplBase extends ConfigFactory
46 {
47         public
48     ResourceFactoryImplBase( final ConfigFactoryCallback callbacks )
49     {
50         super( callbacks );
51     }
52     
53     
54     public static final String JavaDoc RESOURCE_TYPE_KEY = "ResType";
55     public static final String JavaDoc RESOURCE_ADAPTER_KEY = "ResAdapter";
56     
57     
58         public final void
59     internalRemove( final ObjectName JavaDoc objectName )
60     {
61         final String JavaDoc name = Util.getName( objectName );
62         removeByName( name );
63     }
64     
65     protected abstract void removeByName( final String JavaDoc name );
66
67
68     private final Set JavaDoc<String JavaDoc> RESOURCE_DEFAULT_LEGAL_OPTIONAL_KEYS =
69         GSetUtil.newUnmodifiableStringSet(
70         Description.DESCRIPTION_KEY,
71         ResourceConfigKeys.ENABLED_KEY
72     );
73     
74     
75     /**
76           By default, assume there are no optional keys.
77      */

78         protected Set JavaDoc<String JavaDoc>
79     getLegalOptionalCreateKeys()
80     {
81         return( RESOURCE_DEFAULT_LEGAL_OPTIONAL_KEYS );
82     }
83     
84         protected Set JavaDoc<ResourceRefConfig>
85     findAllRefConfigs(
86         final String JavaDoc j2eeType,
87         final String JavaDoc name )
88     {
89         final ResourceRefConfigReferent item = (ResourceRefConfigReferent)
90             requireItem( j2eeType, name );
91         
92         return RefHelper.findAllRefConfigs( item );
93     }
94 }
95
96
Popular Tags