001/*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved.            *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD      *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file.                                                     *
007 *****************************************************************************/
008package org.picocontainer.lifecycle;
009
010/**
011 * Current lifecycle state of the container.
012 * @author Michael Rimov
013 * @author Paul Hammant
014 */
015public interface LifecycleState {
016
017        /**
018         * Lifecycle state for when a component is being removed.
019         */
020    void removingComponent();
021
022        /**
023         * Start is normally allowed if the object is constructed or
024         * already stopped.  It is not allowed if the system is already
025         * started or disposed.
026         * @return true if start lifecycle methods should be allowed.
027         */
028    void starting();
029
030    /**
031     * Lifecycle state for when the container is being stopped.  (Ie, right after Picocontainer.stop()
032     * has been called, but before any components are stopped.
033     */
034    void stopping();
035
036    /**
037     * Lifecycle state for when stop has been completed.
038     */
039    void stopped();
040
041    /**
042     * Checks if current lifecycle is started.
043     * @return true if the current container state is STARTED.
044     */
045    boolean isStarted();
046
047    /**
048     * Turns the lifecycle state to indicate that the dispose() process is being
049     * executed on the container.
050     */
051    void disposing();
052
053    /**
054     * Turns the lifecycle state to completely disposed.  Internally called after PicoContainer.dispose()
055     * is finished.
056     */
057    void disposed();
058    
059    /**
060     * Checks if the current lifecycle is disposed.
061     * @return true if the current state is DISPOSED.
062     */
063    boolean isDisposed();
064    
065    /**
066     * Checks if the current lifecyle is stopped.
067     * @return true if the current state is STOPPED;
068     * @return
069     */
070    boolean isStopped();
071}