KickJava   Java API By Example, From Geeks To Geeks.

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


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.
35  *
36  * This class is intended for use in versions of the application server
37  * that *do not* have web-core as well as in versions that do. NSAPI
38  * specific functionality is implemented the NSAPIWebContainerLifecycle
39  * subclass in the <code>j2ee-plugin</code> component.
40  */

41 public class WebContainerLifecycle extends ServerLifecycleImpl {
42
43     // --------------------------------------------------------- Public Methods
44

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

58     public void onInitialization(ServerContext sc)
59                         throws ServerLifecycleException {
60     
61         // Setup Catalina's environment
62
InstanceEnvironment instance = sc.getInstanceEnvironment();
63         System.setProperty("catalina.home", instance.getInstancesRoot());
64         System.setProperty("catalina.base", instance.getInstancesRoot());
65         System.setProperty("catalina.useNaming", "false");
66         // initialize KeyTool
67
KeyTool.initProvider();
68     }
69
70 }
71
Popular Tags