KickJava   Java API By Example, From Geeks To Geeks.

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


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 import com.sun.enterprise.config.serverbeans.Profiler;
34
35
36 //Admin imports
37
import com.sun.enterprise.admin.common.ObjectNames;
38 import com.sun.enterprise.admin.common.exception.MBeanConfigException;
39 import com.sun.enterprise.admin.common.constant.ConfigAttributeName;
40
41 /**
42     This Config MBean represents a Profiler element.
43     It extends ConfigMBeanBase class which provides get/set attribute(s) and getMBeanInfo services according to text descriptions.
44     ObjectName of this MBean is:
45         ias: type=auth-db, instance-name=<instance-name>, class=<virtualServerClassId>, server=<virtualServerId> name=<AuthDb-id>
46 */

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

52     private static final String JavaDoc[][] MAPLIST =
53     {
54         {kName , ATTRIBUTE + ServerTags.NAME},
55         {kClasspath , ATTRIBUTE + ServerTags.CLASSPATH},
56         {kNativeLibraryPath , ATTRIBUTE + ServerTags.NATIVE_LIBRARY_PATH},
57         {kEnabled , ATTRIBUTE + ServerTags.ENABLED},
58     };
59     /**
60      * ATTRIBUTES array specifies attributes descriptions in format defined for MBeanEasyConfig
61      */

62     private static final String JavaDoc[] ATTRIBUTES =
63     {
64         kName + ", String, R" ,
65         kClasspath + ", String, RW" ,
66         kNativeLibraryPath + ", String, RW" ,
67         kEnabled + ", boolean, RW" ,
68     };
69     /**
70      * OPERATIONS array specifies operations descriptions in format defined for MBeanEasyConfig
71      */

72     private static final String JavaDoc[] OPERATIONS =
73     {
74         "getJvmOptions(), INFO",
75         "setJvmOptions(String[] options), ACTION",
76     };
77     
78     /**
79         Default constructor sets MBean description tables
80     */

81     public ManagedProfiler() throws MBeanConfigException
82     {
83         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
84     }
85
86     /**
87         Constructs Config MBean for Profiler.
88         @param instanceName The server instance name.
89     */

90     public ManagedProfiler(String JavaDoc instanceName) throws MBeanConfigException
91     {
92         this(); //set description tables
93
initialize(ObjectNames.kProfiler, new String JavaDoc[]{instanceName});
94     }
95     /**
96     This operation returns list of JvmOptions connected to this class.
97      */

98     public String JavaDoc[] getJvmOptions() throws ConfigException
99     {
100         Profiler profiler = (Profiler)getBaseConfigBean();
101         return profiler.getJvmOptions();
102     }
103
104     /**
105     This operation returns list of JvmOptions connected to this class.
106      */

107     public void setJvmOptions(String JavaDoc[] options) throws ConfigException
108     {
109         Profiler profiler = (Profiler)getBaseConfigBean();
110         profiler.setJvmOptions(options);
111         getConfigContext().flush();
112     }
113 }
114
Popular Tags