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 * *
008 * Original code by Paul Hammant *
009 *****************************************************************************/
010
011 package org.picocontainer;
012
013 /**
014 * A manager for the lifecycle of a container's components.
015 * The lifecycle manager is implemented by the component adapters
016 * which will resolve the dependencies of the component instance and
017 * delegate the implementation of the lifecycle control to the
018 * {@link org.picocontainer.defaults.LifecycleStrategy lifecycle strategy}.
019 *
020 * @author Paul Hammant
021 * @author Jörg Schaible
022 * @author Mauro Talevi
023 * @version $Revision: 2631 $
024 * @see org.picocontainer.defaults.LifecycleStrategy
025 * @since 1.2
026 */
027 public interface LifecycleManager {
028
029 /**
030 * Invoke the "start" method on the container's components.
031 * @param container the container to "start" its components' lifecycle
032 */
033 void start(PicoContainer container);
034
035 /**
036 * Invoke the "stop" method on the container's components.
037 * @param container the container to "stop" its components' lifecycle
038 */
039 void stop(PicoContainer container);
040
041 /**
042 * Invoke the "dispose" method on the container's components.
043 * @param container the container to "dispose" its components' lifecycle
044 */
045 void dispose(PicoContainer container);
046
047 /**
048 * Test if a container's component has a lifecycle.
049 * @return <code>true</code> if the component has a lifecycle
050 */
051 boolean hasLifecycle();
052 }