1 /** 2 * 3 * Copyright 2003-2004 The Apache Software Foundation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * 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 */ 17 package org.apache.geronimo.kernel.proxy; 18 19 import org.apache.geronimo.kernel.management.State; 20 21 /** 22 * Interface provided by proxies generated by the Geronimo proxy managers. 23 * This lets a client call any of these methods on a proxy representing 24 * any Geronimo GBean. However, this should not be used on any arbitrary 25 * GBean reference, as it might not be a proxy generated by Geronimo (for 26 * example, if you're running the GBean in Spring). 27 * 28 * Note that this includes the content of the JSR-77 StateManageable type, 29 * as well as getObjectName from the JSR-77 J2EEManagedObject type. 30 * However, it is not explicitly related to JSR-77 as that is not required 31 * in order to use the Geronimo kernel. 32 * 33 * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $ 34 */ 35 public interface GeronimoManagedBean { 36 /** 37 * Gets the unique name of this object. The object name must comply with the ObjectName specification 38 * in the JMX specification and the restrictions in the J2EEManagementInterface. 39 * 40 * @return the unique name of this object within the server 41 */ 42 String getObjectName(); 43 44 /** 45 * Gets the state of this component as an int. 46 * The int return is required by the JSR77 specification. 47 * 48 * @return the current state of this component 49 * @see #getStateInstance to obtain the State instance 50 */ 51 int getState(); 52 53 /** 54 * Gets the state of this component as a State instance. 55 * 56 * @return the current state of this component 57 */ 58 State getStateInstance(); 59 60 /** 61 * Gets the start time of this component 62 * 63 * @return time in milliseonds since epoch that this component was started. 64 */ 65 long getStartTime(); 66 67 68 /** 69 * Transitions the component to the starting state. This method has access to the 70 * container. 71 * <p/> 72 * Normally a component uses this to cache data from other components. The other components will 73 * have been created at this stage, but not necessairly started and may not be ready to have methods 74 * invoked on them. 75 * 76 * @throws Exception if a problem occurs during the transition 77 * @throws IllegalStateException if this interceptor is not in the stopped or failed state 78 */ 79 void start() throws Exception, IllegalStateException; 80 81 /** 82 * Transitions the component to the starting state. This method has access to the 83 * container. 84 * <p/> 85 * If this Component is a Container, then startRecursive is called on all child Components 86 * that are in the STOPPED or FAILED state. 87 * Normally a component uses this to cache data from other components. The other components will 88 * have been created at this stage, but not necessairly started and may not be ready to have methods 89 * invoked on them. 90 * 91 * @throws Exception if a problem occurs during the transition 92 * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state 93 */ 94 void startRecursive() throws Exception, IllegalStateException; 95 96 /** 97 * Transitions the component to the stopping state. This method has access to the 98 * container. 99 * <p/> 100 * If this is Component is a Container, then all its child components must be in the 101 * STOPPED or FAILED State. 102 * <p/> 103 * Normally a component uses this to drop references to data cached in the start method. 104 * The other components will not necessairly have been stopped at this stage and may not be ready 105 * to have methods invoked on them. 106 * 107 * @throws Exception if a problem occurs during the transition 108 * @throws IllegalStateException if this interceptor is not in the STOPPED or FAILED state 109 */ 110 void stop() throws Exception, IllegalStateException; 111 }