KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > PEWebContainerLifecycle


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.web;
25
26 import com.sun.enterprise.server.ServerContext;
27 import com.sun.appserv.server.ServerLifecycleImpl;
28 import com.sun.appserv.server.ServerLifecycleException;
29 import com.sun.enterprise.instance.InstanceEnvironment;
30 import com.sun.enterprise.security.KeyTool;
31
32 /**
33  * This class implements the lifecycle methods used by the web
34  * container subsystem for PE/RI.
35  */

36 public final class PEWebContainerLifecycle extends WebContainerLifecycle {
37
38     // --------------------------------------------------------- Public Methods
39

40     /**
41      * Server is initializing subsystems and setting up the runtime environment.
42      * Prepare for the beginning of active use of the public methods of this
43      * subsystem. This method is called before any of the public methods of
44      * this subsystem are utilized.
45      *
46      * @param sc ServerContext the server runtime context.
47      *
48      * @exception IllegalStateException if this subsystem has already been
49      * started
50      * @exception ServerLifecycleException if this subsystem detects a fatal
51      * error that prevents this subsystem from being used
52      */

53     public void onInitialization(ServerContext sc)
54                         throws ServerLifecycleException {
55     
56     super.onInitialization(sc);
57     //create an instance of the PE Web Container (Tomcat)
58
PEWebContainer.createInstance(sc);
59     }
60
61
62    /**
63      * Server is starting up applications
64      *
65      * @param sc ServerContext the server runtime context.
66      *
67      * @exception ServerLifecycleException if this subsystem detects a fatal
68      * error that prevents this subsystem from being used
69      */

70     public void onStartup(ServerContext sc)
71             throws ServerLifecycleException {
72     PEWebContainer.getPEWebContainer().startInstance();
73     }
74
75     /**
76      * Server is shutting down applications
77      *
78      * @exception ServerLifecycleException if this subsystem detects a fatal
79      * error that prevents this subsystem from being used
80      */

81     public void onShutdown() throws ServerLifecycleException {
82         if (PEWebContainer.getPEWebContainer() != null) {
83         PEWebContainer.getPEWebContainer().stopInstance();
84     } //else do nothing since PEWebContainer is not initialised
85
}
86
87     /**
88      * Server is terminating the subsystems and the runtime environment.
89      * Gracefully terminate the active use of the public methods of this
90      * subsystem. This method should be the last one called on a given
91      * instance of this subsystem.
92      *
93      * @exception ServerLifecycleException if this subsystem detects a fatal
94      * error that prevents this subsystem from being used
95      */

96     public void onTermination() throws ServerLifecycleException {
97     }
98
99 }
100
Popular Tags