KickJava   Java API By Example, From Geeks To Geeks.

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


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 import com.sun.enterprise.admin.common.exception.J2EEWebModuleException;
27 import com.sun.enterprise.admin.common.constant.AdminConstants;
28 import com.sun.enterprise.admin.common.ObjectNames;
29 import com.sun.enterprise.admin.server.core.mbean.config.naming.ConfigMBeanNamingInfo;
30
31 //Config imports
32
import com.sun.enterprise.config.ConfigException;
33 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
34 import com.sun.enterprise.config.serverbeans.J2eeApplication;
35
36
37 //Admin Imports
38
import com.sun.enterprise.admin.common.exception.MBeanConfigException;
39
40 /**
41     Represents a managed Web Module. This is a part of a deployed application.
42     When a J2EE application is deployed, instances of this MBean are registered
43     in the MBeanServer.
44     <p>
45     There will be as many instances of this MBean as there are Web Modules (per
46     application).
47     <p>
48     ObjectName of this MBean is:
49         ias:type=J2EEWebModule, AppName= <appName>, ModuleName=<moduleName>
50 */

51 public class ManagedJ2EEWebModule extends ConfigMBeanBase
52 {
53     private static final String JavaDoc[][] MAPLIST = null;
54     private static final String JavaDoc[] ATTRIBUTES = null;
55     private static final String JavaDoc[] OPERATIONS =
56     {
57         "getServlets(), INFO",
58     };
59
60     
61     /**
62         Default constructor sets MBean description tables
63     */

64     public ManagedJ2EEWebModule() throws MBeanConfigException
65     {
66         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
67     }
68
69     public ManagedJ2EEWebModule(String JavaDoc instanceName, String JavaDoc applicationName, String JavaDoc moduleName)
70         throws MBeanConfigException
71     {
72         this(); //set description tables
73
initialize(ObjectNames.kWebModule, new String JavaDoc[]{instanceName, applicationName, moduleName});
74
75     }
76
77     public String JavaDoc[] getServlets() throws J2EEWebModuleException
78     {
79         ConfigMBeanNamingInfo namingInfo = this.getConfigMBeanNamingInfo();
80         String JavaDoc [] locParams = namingInfo.getLocationParams();
81         String JavaDoc applicationName = locParams[1];
82         String JavaDoc moduleName = locParams[2];
83
84         try
85         {
86             J2eeApplication app = (J2eeApplication) this.getConfigBeanByXPath(ServerXPathHelper.getAppIdXpathExpression(applicationName));
87             String JavaDoc location = app.getLocation();
88             return ModulesXMLHelper.getServletsForWebModule(location, moduleName);
89         }
90         catch (Exception JavaDoc e)
91         {
92             sLogger.throwing(getClass().getName(), "getServlets", e);
93             throw new J2EEWebModuleException(e.getMessage());
94         }
95     }
96
97     public String JavaDoc[] getJSPPages() throws J2EEWebModuleException
98     {
99         return ( null );
100     }
101
102
103     public int getModuleType()
104     {
105         return ( AdminConstants.kTypeWebModule );
106     }
107     //all the other ias-web.xml parameters that are exposed.
108
}
109
Popular Tags