KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > management > j2ee > StateManageable


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  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Sam
27  */

28
29
30 package com.caucho.management.j2ee;
31
32 /**
33  * Base class interface for managed objects that have lifecycle state management.
34  *
35  * {@link #getState()} returns an integer representing the current state.
36  *
37  * <table>
38  * <tr><th>name<th>value<th>description<th>transition operations allowed
39  * <tr><td>STARTING<td>0<td>the managed object is starting<td>
40  * <tr><td>RUNNING <td>1<td>the managed object is running<td>{@link #stop()}
41  * <tr><td>STOPPING<td>2<td>the managed object is stopping<td>
42  * <tr><td>STOPPEDG<td>3<td>the managed object is stoped<td>{@link #start()}
43  * <tr><td>FAILED <td>4<td>an attempt to start or stop the managed object failed<td>{@link #start()}, {@link #stop()}
44  * </table>
45  */

46 public interface StateManageable {
47   public static final int STARTING = 0;
48   public static final int RUNNING = 1;
49   public static final int STOPPING = 2;
50   public static final int STOPPED = 3;
51   public static final int FAILED = 4;
52
53   /**
54    * The time that the managed object was started and entered the {@link RUNNING}
55    * state. The value is the number of milliseconds since 00:00 January 1, 1970.
56    */

57   public long getStartTime();
58
59   /**
60    * Returns the current state of the managed object.
61    *
62    */

63   public int getState();
64
65   /**
66    * Start the managed object when it is in the {@link STOPPED} or {@link FAILED}
67    * state.
68    *
69    * If there are children of this managed object they are <i>not</i>
70    * started, see {@link #startRecursive()}.
71    *
72    * An {@link EventProvider} will issue a
73    * {@link NotificationTypes.J2EE_STATE_STARTING} notification, and then
74    * depending on the success of the start a
75    * {@link NotificationTypes.J2EE_STATE_RUNNING} or a
76    * {@link NotificationTypes.J2EE_STATE_FAILED} notification.
77    */

78   public void start();
79
80   /**
81    * Starts the managed object (See {@link #start()}, and then recursively
82    * starts any children.
83    */

84   public void startRecursive();
85
86   /**
87    * Stop the managed object when it is in the {@link RUNNING} or {@link FAILED}
88    * state.
89    *
90    * An {@link EventProvider} will issue a
91    * {@link NotificationTypes.J2EE_STATE_STARTING} notification, and then
92    * depending on the success of the start a
93    * {@link NotificationTypes.J2EE_STATE_RUNNING} or a
94    * {@link NotificationTypes.J2EE_STATE_FAILED} notification.
95    */

96   public void stop();
97
98 }
99
Popular Tags