KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > mbean > config > ManagedJNDIResource


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
24 package com.sun.enterprise.admin.server.core.mbean.config;
25
26 //JMX imports
27
import javax.management.*;
28
29 //Config imports
30
import com.sun.enterprise.config.ConfigException;
31 import com.sun.enterprise.config.serverbeans.ServerTags;
32 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
33
34
35 //Admin imports
36
import com.sun.enterprise.admin.common.ObjectNames;
37 import com.sun.enterprise.admin.common.exception.MBeanConfigException;
38 import com.sun.enterprise.admin.common.constant.ConfigAttributeName;
39
40 /**
41     This Config MBean represents a a JNDI-resource.
42     It extends ConfigMBeanBase class which provides get/set attribute(s) and getMBeanInfo services according to text descriptions.
43     ObjectName of this MBean is:
44         ias: ctype=jndi, instance-name=<instance-name>
45 */

46 public class ManagedJNDIResource extends ConfigMBeanBase implements ConfigAttributeName.ExternalJndiResource
47 {
48     /**
49      * MAPLIST array defines mapping between "external" name and its location in XML relatively base node
50      */

51     private static final String JavaDoc[][] MAPLIST =
52     {
53         {kJndiName , ATTRIBUTE + ServerTags.JNDI_NAME},
54         {kJndiLookupName , ATTRIBUTE + ServerTags.JNDI_LOOKUP_NAME},
55         {kResType , ATTRIBUTE + ServerTags.RES_TYPE},
56         {kFactoryClass , ATTRIBUTE + ServerTags.FACTORY_CLASS},
57 //MS1 {kEnabled , ATTRIBUTE + ServerTags.ENABLED},
58
{kDescription , ATTRIBUTE + PSEUDO_ATTR_DESCRIPTION},
59     };
60     /**
61      * ATTRIBUTES array specifies attributes descriptions in format defined for MBeanEasyConfig
62      */

63     private static final String JavaDoc[] ATTRIBUTES =
64     {
65         kJndiName + ", String, R" ,
66         kJndiLookupName + ", String, RW" ,
67         kResType + ", String, RW" ,
68         kFactoryClass + ", String, RW" ,
69 //MS1 kEnabled + ", boolean, RW" ,
70
kDescription + ", String, RW" ,
71     };
72     /**
73      * OPERATIONS array specifies op;erations descriptions in format defined for MBeanEasyConfig
74      */

75     private static final String JavaDoc[] OPERATIONS = null;
76     
77     
78     /**
79         Default constructor sets MBean description tables
80     */

81     public ManagedJNDIResource() throws MBeanConfigException
82     {
83         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
84     }
85
86     /**
87      * Constructs Config MBean for JNDI Resource.
88      * @param instanceName The server instance name.
89      * @param jndiName JNDI name associated with resource
90      */

91     public ManagedJNDIResource(String JavaDoc instanceName, String JavaDoc jndiName) throws ConfigException,MBeanConfigException
92     {
93         this(); //set description tables
94
initialize(ObjectNames.kJndiResourceType, new String JavaDoc[]{instanceName, jndiName});
95     }
96 }
97
Popular Tags