001/*******************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved. 
003 * ---------------------------------------------------------------------------
004 * The software in this package is published under the terms of the BSD style
005 * license a copy of which has been included with this distribution in the
006 * LICENSE.txt file. 
007 ******************************************************************************/
008package org.picocontainer.classname;
009
010import org.picocontainer.MutablePicoContainer;
011import org.picocontainer.PicoContainer;
012import org.picocontainer.classname.ClassPathElement;
013
014import java.net.URL;
015
016/**
017 * A ClassLoadingPicoContainer extends PicoContainer with classloader juggling capability
018 * 
019 * @author Paul Hammant
020 * @author Aslak Hellesøy
021 */
022public interface ClassLoadingPicoContainer extends MutablePicoContainer {
023
024    /**
025     * Adds a new URL that will be used in classloading
026     * 
027     * @param url url of the jar to find components in.
028     * @return ClassPathElement to add permissions to (subject to security
029     *         policy)
030     */
031    ClassPathElement addClassLoaderURL(URL url);
032
033    /**
034     * Returns class loader that is the aggregate of the URLs added.
035     * 
036     * @return A ClassLoader
037     */
038    ClassLoader getComponentClassLoader();
039
040    /**
041     * Make a child container with a given name
042     * 
043     * @param name the container name
044     * @return The ScriptedPicoContainer
045     */
046    ClassLoadingPicoContainer makeChildContainer(String name);
047
048    /**
049     * Addes a child container with a given name
050     * 
051     * @param name the container name
052     * @param child the child PicoContainer
053     */
054    ClassLoadingPicoContainer addChildContainer(String name, PicoContainer child);
055
056}