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     */
017    package javax.jbi.management;
018    
019    import javax.jbi.JBIException;
020    
021    /**
022     * LifeCycleMBean is a base interface that defines standard life cycle controls
023     * for JBI implementation services (which are implementation-specific), and JBI
024     * components (bindings and engines).
025     *
026     * @author JSR208 Expert Group
027     */
028    public interface LifeCycleMBean {
029    
030        /** Value returned by {@link #getCurrentState()} for a shutdown component. */
031        String SHUTDOWN = "Shutdown";
032    
033        /** Value returned by {@link #getCurrentState()} for a stopped component. */
034        String STOPPED = "Stopped";
035    
036        /** Value returned by {@link #getCurrentState()} for a running component. */
037         String STARTED = "Started";
038    
039        /** Value returned by {@link #getCurrentState()} for a component in an unknown state. */
040        String UNKNOWN = "Unknown";
041    
042        /**
043         * Start the item.
044         *
045         * @exception javax.jbi.JBIException if the item fails to start.
046         */
047        void start() throws JBIException;
048    
049        /**
050         * Stop the item. This suspends current messaging activities.
051         *
052         * @exception javax.jbi.JBIException if the item fails to stop.
053         */
054        void stop() throws JBIException;
055    
056        /**
057         * Shut down the item. This releases resources and returns the item
058         * to an uninitialized state.
059         *
060         * @exception javax.jbi.JBIException if the item fails to shut down.
061         */
062        void shutDown() throws JBIException;
063    
064        /**
065         * Get the current state of this managed compononent.
066         *
067         * @return the current state of this managed component (must be one of the
068         *         string constants defined by this interface)
069         */
070         String getCurrentState();
071    
072    }