KickJava   Java API By Example, From Geeks To Geeks.

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


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 //Config imports
27
import com.sun.enterprise.config.ConfigException;
28 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
29 import com.sun.enterprise.config.serverbeans.ServerTags;
30 import com.sun.enterprise.config.serverbeans.J2eeApplication;
31 //JMX imports
32
import javax.management.Attribute JavaDoc;
33
34 //Admin Imports
35
import com.sun.enterprise.admin.common.ObjectNames;
36 import com.sun.enterprise.admin.common.EntityStatus;
37 import com.sun.enterprise.admin.common.constant.ConfigAttributeName;
38 import com.sun.enterprise.admin.common.exception.J2EEApplicationException;
39 import com.sun.enterprise.admin.common.exception.AFException;
40 import com.sun.enterprise.admin.common.exception.MBeanConfigException;
41
42
43 /**
44     A class that represents LifecycleModule.
45     It extends ConfigMBeanBase class which provides get/set attribute(s) and getMBeanInfo services according to text descriptions.
46     ObjectName of this MBean is:
47         ias:type=J2EEApplication, name=<appName>, InstanceName=<instanceName>
48 */

49
50 public class ManagedLifecycleModule extends ConfigMBeanBase implements ConfigAttributeName.LifecycleModule
51 {
52     private static final String JavaDoc[][] MAPLIST =
53     {
54         {kName , ATTRIBUTE + ServerTags.NAME},
55 //ms1 {kEnabled , ATTRIBUTE + ServerTags.ENABLED},
56
{kClassName , ATTRIBUTE + ServerTags.CLASS_NAME},
57         {kClasspath , ATTRIBUTE + ServerTags.CLASSPATH},
58         {kLoadOrder , ATTRIBUTE + ServerTags.LOAD_ORDER},
59         {kIsFailureFatal , ATTRIBUTE + ServerTags.IS_FAILURE_FATAL},
60         {kDescription , ATTRIBUTE + PSEUDO_ATTR_DESCRIPTION},
61     };
62     private static final String JavaDoc[] ATTRIBUTES =
63     {
64         kName + ", String, R" ,
65 //ms1 kEnabled + ", boolean, RW" ,
66
kClassName + ", String, RW" ,
67         kClasspath + ", String, RW" ,
68         kLoadOrder + ", String, RW" ,
69         kIsFailureFatal + ", boolean, RW" ,
70         kDescription + ", String, RW" ,
71     };
72     
73
74     private static final String JavaDoc[] OPERATIONS =
75     {
76         "enable(), ACTION",
77         "disable(), ACTION"
78     };
79
80
81     /**
82         Default constructor sets MBean description tables
83     */

84     public ManagedLifecycleModule() throws MBeanConfigException
85     {
86         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
87     }
88
89     /**
90         Constructs Config MBean for lifecycle module.
91         @param instanceName The server instance name.
92         @param appName
93     */

94     public ManagedLifecycleModule(String JavaDoc instanceName, String JavaDoc appName)
95         throws MBeanConfigException
96     {
97         this(); //set description tables
98
initialize(ObjectNames.kLifecycleModule, new String JavaDoc[]{instanceName, appName});
99
100     }
101
102     /**
103      * Disables this module.
104      * @throws Exception if there is some error during
105      * disabling.
106     */

107     public void disable() throws AFException
108     {
109             return; //FIXME: for RI only
110
/* try{
111             this.setAttribute(new Attribute(kEnabled, new Boolean(false)));
112             super.getConfigContext().flush();
113         }catch(Exception e){
114             throw new AFException(e.getMessage());
115         }
116 */

117     }
118     
119     /**
120      * Enables this module.
121      * @throws Exception if there is some error during
122      * enablement.
123     */

124     public void enable() throws AFException
125     {
126         return; //FIXME: for RI only
127
/* try{
128             this.setAttribute(new Attribute(kEnabled, new Boolean(true)));
129             super.getConfigContext().flush();
130         }catch(Exception e){
131             throw new AFException(e.getMessage());
132         }
133 */

134     }
135     
136
137 }
138
Popular Tags