01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.kernel.management;
17:
18: /**
19: * A Java interface the meets the J2EE Management specification for a state manageable object.
20: *
21: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
22: */
23: public interface StateManageable {
24: /**
25: * Gets the state of this component as an int.
26: * The int return is required by the JSR77 specification.
27: *
28: * @return the current state of this component
29: * @see #getStateInstance to obtain the State instance
30: */
31: int getState();
32:
33: /**
34: * Gets the state of this component as a State instance.
35: *
36: * @return the current state of this component
37: */
38: State getStateInstance();
39:
40: /**
41: * Gets the start time of this component
42: *
43: * @return time in milliseonds since epoch that this component was started.
44: */
45: long getStartTime();
46:
47: /**
48: * Transitions the component to the starting state. This method has access to the
49: * container.
50: * <p/>
51: * Normally a component uses this to cache data from other components. The other components will
52: * have been created at this stage, but not necessairly started and may not be ready to have methods
53: * invoked on them.
54: *
55: * @throws Exception if a problem occurs during the transition
56: * @throws IllegalStateException if this interceptor is not in the stopped or failed state
57: */
58: void start() throws Exception, IllegalStateException;
59:
60: /**
61: * Transitions the component to the starting state. This method has access to the
62: * container.
63: * <p/>
64: * If this Component is a Container, then startRecursive is called on all child Components
65: * that are in the STOPPED or FAILED state.
66: * Normally a component uses this to cache data from other components. The other components will
67: * have been created at this stage, but not necessairly started and may not be ready to have methods
68: * invoked on them.
69: *
70: * @throws Exception if a problem occurs during the transition
71: * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
72: */
73: void startRecursive() throws Exception, IllegalStateException;
74:
75: /**
76: * Transitions the component to the stopping state. This method has access to the
77: * container.
78: * <p/>
79: * If this is Component is a Container, then all its child components must be in the
80: * STOPPED or FAILED State.
81: * <p/>
82: * Normally a component uses this to drop references to data cached in the start method.
83: * The other components will not necessairly have been stopped at this stage and may not be ready
84: * to have methods invoked on them.
85: *
86: * @throws Exception if a problem occurs during the transition
87: * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
88: */
89: void stop() throws Exception, IllegalStateException;
90:
91: }
|