KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > server > ServerLifecycle


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 /**
25  * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
26  *
27  * Copyright 2000-2001 by iPlanet/Sun Microsystems, Inc.,
28  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
29  * All rights reserved.
30  */

31
32 package com.sun.appserv.server;
33
34 import com.sun.enterprise.server.ServerContext;
35
36 /**
37  * ServerLifecycle interface:
38  * common lifecycle interface for application server and its subsystems.
39  *
40  * This interface is implemented by the ApplicationServer and its subsystems
41  * such as the web container or EJB container, in order to provide a consistent
42  * mechanism for server initialization-startup-shutdown-termination lifecycle.
43  */

44 public interface ServerLifecycle {
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     /**
62      * Server is starting up applications
63      *
64      * @param sc ServerContext the server runtime context.
65      *
66      * @exception ServerLifecycleException if this subsystem detects a fatal
67      * error that prevents this subsystem from being used
68      */

69     public void onStartup(ServerContext sc)
70                         throws ServerLifecycleException;
71
72     /**
73      * Server has complted loading the applications and is ready to serve requests.
74      *
75      * @param sc ServerContext the server runtime context.
76      *
77      * @exception ServerLifecycleException if this subsystem detects a fatal
78      * error that prevents this subsystem from being used
79      */

80     public void onReady(ServerContext sc) throws ServerLifecycleException;
81
82     /**
83      * Server is shutting down applications
84      *
85      * @exception ServerLifecycleException if this subsystem detects a fatal
86      * error that prevents this subsystem from being used
87      */

88     public void onShutdown()
89                         throws ServerLifecycleException;
90
91     /**
92      * Server is terminating the subsystems and the runtime environment.
93      * Gracefully terminate the active use of the public methods of this
94      * subsystem. This method should be the last one called on a given
95      * instance of this subsystem.
96      *
97      * @exception ServerLifecycleException if this subsystem detects a fatal
98      * error that prevents this subsystem from being used
99      */

100     public void onTermination()
101                         throws ServerLifecycleException;
102 }
103
Popular Tags