001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.kernel.proxy;
017:
018: import org.apache.geronimo.kernel.management.State;
019:
020: /**
021: * Interface provided by proxies generated by the Geronimo proxy managers.
022: * This lets a client call any of these methods on a proxy representing
023: * any Geronimo GBean. However, this should not be used on any arbitrary
024: * GBean reference, as it might not be a proxy generated by Geronimo (for
025: * example, if you're running the GBean in Spring).
026: *
027: * Note that this includes the content of the JSR-77 StateManageable type,
028: * as well as getObjectName from the JSR-77 J2EEManagedObject type.
029: * However, it is not explicitly related to JSR-77 as that is not required
030: * in order to use the Geronimo kernel.
031: *
032: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
033: */
034: public interface GeronimoManagedBean {
035: /**
036: * Gets the unique name of this object. The object name must comply with the ObjectName specification
037: * in the JMX specification and the restrictions in the J2EEManagementInterface.
038: *
039: * @return the unique name of this object within the server
040: */
041: String getObjectName();
042:
043: /**
044: * Gets the state of this component as an int.
045: * The int return is required by the JSR77 specification.
046: *
047: * @return the current state of this component
048: * @see #getStateInstance to obtain the State instance
049: */
050: int getState();
051:
052: /**
053: * Gets the state of this component as a State instance.
054: *
055: * @return the current state of this component
056: */
057: State getStateInstance();
058:
059: /**
060: * Gets the start time of this component
061: *
062: * @return time in milliseonds since epoch that this component was started.
063: */
064: long getStartTime();
065:
066: /**
067: * Transitions the component to the starting state. This method has access to the
068: * container.
069: * <p/>
070: * Normally a component uses this to cache data from other components. The other components will
071: * have been created at this stage, but not necessairly started and may not be ready to have methods
072: * invoked on them.
073: *
074: * @throws Exception if a problem occurs during the transition
075: * @throws IllegalStateException if this interceptor is not in the stopped or failed state
076: */
077: void start() throws Exception, IllegalStateException;
078:
079: /**
080: * Transitions the component to the starting state. This method has access to the
081: * container.
082: * <p/>
083: * If this Component is a Container, then startRecursive is called on all child Components
084: * that are in the STOPPED or FAILED state.
085: * Normally a component uses this to cache data from other components. The other components will
086: * have been created at this stage, but not necessairly started and may not be ready to have methods
087: * invoked on them.
088: *
089: * @throws Exception if a problem occurs during the transition
090: * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
091: */
092: void startRecursive() throws Exception, IllegalStateException;
093:
094: /**
095: * Transitions the component to the stopping state. This method has access to the
096: * container.
097: * <p/>
098: * If this is Component is a Container, then all its child components must be in the
099: * STOPPED or FAILED State.
100: * <p/>
101: * Normally a component uses this to drop references to data cached in the start method.
102: * The other components will not necessairly have been stopped at this stage and may not be ready
103: * to have methods invoked on them.
104: *
105: * @throws Exception if a problem occurs during the transition
106: * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state
107: */
108: void stop() throws Exception, IllegalStateException;
109: }
|