KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > server > deploy > DeployControllerStrategy


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.server.deploy;
31
32 /**
33  * DeployController controls the lifecycle of the DeployInstance.
34  *
35  * <h3>States</h3>
36  *
37  * <ul>
38  * <li>active - responds to requests normally
39  * <li>modified - active with a dependency change like a web.xml
40  * <li>active-idle - active idle state, which can be stopped on timeout
41  * <li>active-error - configuration error (before timeout)
42  * <li>error - configuration error (after timeout)
43  * <li>stop - admin stop, refuses requests with a 503
44  * <li>stop-lazy - lazy stop
45  * </ul>
46  *
47  * error-wait is equivalent to the active state. idle and inactive only
48  * applies to startup=lazy.
49  *
50  * <h3>events</h3>
51  *
52  * <ul>
53  * <li>startOnInit - called at startup time for automatic start
54  * <li>start - admin start
55  * <li>stop - admin stop
56  * <li>update - admin update/restart, ends up in initial state
57  * <li>request - top-level request
58  * <li>subrequest - include/forward
59  * <li>alarm - timeout
60  * <li>
61  */

62 public interface DeployControllerStrategy
63 {
64   /**
65    * Called at initialization time for automatic start.
66    *
67    * @param controller the owning controller
68    */

69   public<I extends DeployInstance>
70   void startOnInit(DeployController<I> controller);
71
72   /**
73    * Starts the instance from an admin command.
74    *
75    * @param controller the owning controller
76    */

77   public<I extends DeployInstance>
78   void start(DeployController<I> controller);
79
80   /**
81    * Stops the instance from an admin command.
82    *
83    * @param controller the owning controller
84    */

85   public<I extends DeployInstance>
86   void stop(DeployController<I> controller);
87
88   /**
89    * Checks for updates from an admin command. The target state will be the
90    * initial state, i.e. update will not start a lazy instance.
91    *
92    * @param controller the owning controller
93    */

94   public<I extends DeployInstance>
95   void update(DeployController<I> controller);
96
97   /**
98    * On a top-level request, returns the deploy instance, starting if necessary.
99    *
100    * @param controller the owning controller
101    * @return the active deploy instance or null if none are active
102    */

103   /* XXX: should request always return an instance? */
104   public<I extends DeployInstance>
105   I request(DeployController<I> controller);
106
107   /**
108    * On a sub-request, returns the deploy instance, starting if necessary.
109    *
110    * @param controller the owning controller
111    * @return the active deploy instance or null if none are active
112    */

113   /* XXX: should request always return an instance? */
114   public<I extends DeployInstance>
115   I subrequest(DeployController<I> controller);
116
117
118   /**
119    * On a timeout, update or restart as necessary.
120    *
121    * @param controller the owning controller
122    */

123   public<I extends DeployInstance>
124   void alarm(DeployController<I> controller);
125
126 }
127
Popular Tags