KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > ondemand > SystemAppLoader


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.server.ondemand;
25
26 import java.util.*;
27 import java.util.logging.*;
28 import com.sun.logging.LogDomains;
29 import com.sun.enterprise.server.ondemand.entry.*;
30 import com.sun.enterprise.server.*;
31 import com.sun.enterprise.config.ConfigException;
32
33
34 /**
35  * System apps are loaded by this class. ServiceGroups use this
36  * class to load system apps that belong to them
37  *
38  * @author Binod PG
39  * @see ServiceGroup
40  */

41 public class SystemAppLoader {
42
43     private Hashtable apps = new Hashtable();
44
45     private ApplicationManager appsMgr = ManagerFactory.getApplicationManager();
46     private StandAloneEJBModulesManager ejbMgr = ManagerFactory.getSAEJBModulesManager();
47     //private DummyWebModulesManager webMgr = ManagerFactory.getSAWebModulesManager();
48

49     static Logger _logger = LogDomains.getLogger(LogDomains.CORE_LOGGER);
50
51     final Object JavaDoc [][] ejbSGApps = {
52                            {"MEjbApp", appsMgr},
53                            {"__ejb_container_timer_app", appsMgr}
54                          };
55     // All web system apps, except webstart app,
56
// are loaded by PEWebContainer, when it starts.
57
// So, ondemand code does not need to worry about that.
58
final Object JavaDoc[][] webSGApps = {
59                           // {"adminapp",null},
60
// {"com_sun_web_ui", null},
61
// {"admingui", null},
62
{"__JWSappclients", appsMgr}
63                          };
64   
65     /**
66      * Constructs a datastructure that holds all system app info.
67      */

68     public SystemAppLoader() throws ConfigException {
69
70         for (int i=0; i < ejbSGApps.length; i++) {
71             apps.put(ejbSGApps[i][0], ejbSGApps[i][1]);
72         }
73
74         for (int i=0; i < webSGApps.length; i++) {
75             apps.put(webSGApps[i][0], webSGApps[i][1]);
76         }
77
78     }
79
80     public ArrayList getEjbServiceGroupSystemApps() {
81         return createArrayList(ejbSGApps);
82     }
83
84     public ArrayList getWebServiceGroupSystemApps() {
85         return createArrayList(webSGApps);
86     }
87
88     public ArrayList getResourcesServiceGroupSystemApps() {
89         return null;
90     }
91
92     private ArrayList createArrayList(Object JavaDoc[][] objArray) {
93         ArrayList list = new ArrayList();
94         for (int i=0; i < objArray.length; i ++) {
95             list.add(objArray[i][0]);
96         }
97         return list;
98     }
99
100     public void loadSystemApps(ArrayList ids) {
101         Iterator it = ids.iterator();
102         while (it.hasNext()) {
103             Object JavaDoc appName = it.next();
104             if (_logger.isLoggable(Level.INFO)) {
105                 _logger.log(Level.INFO, "About to load the system app: " + appName);
106             }
107             if (apps.containsKey(appName)) {
108                 AbstractManager mgr = (AbstractManager) apps.get(appName);
109                 mgr.loadOneSystemApp((String JavaDoc) appName, true);
110             }
111         }
112     }
113
114 }
115
Popular Tags