001    /*****************************************************************************
002     * Copyright (C) NanoContainer 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     *****************************************************************************/
009    package org.nanocontainer.integrationkit;
010    
011    import org.picocontainer.defaults.ObjectReference;
012    
013    /**
014     * The responsibility of a ContainerBuilder is to <em>instantiate</em> and <em>compose</em> containers.
015     * (Composition means assembly (registration) and configuration (setting primitive parameters) of
016     * components).
017     *
018     * @author <a href="mailto:joe@thoughtworks.net">Joe Walnes</a>
019     */
020    public interface ContainerBuilder {
021    
022        /**
023         * Create, assemble, init and start a new PicoContainer and store it
024         * at a given reference.
025         *
026         * @param containerRef       Where to store the new container.
027         * @param parentContainerRef reference to a container that may be used as a parent to the new container (may be null).
028         * @param compositionScope   Hint about the scope for composition.
029         */
030        void buildContainer(ObjectReference containerRef, ObjectReference parentContainerRef, Object compositionScope, boolean addChildToParent);
031    
032        /**
033         * Locate a container at the given reference so it can be stopped,
034         * destroyed and removed.
035         *
036         * @param containerRef Where the container is stored.
037         */
038        void killContainer(ObjectReference containerRef);
039    
040    }
041