001 package org.nanocontainer.deployer;
002
003 import org.apache.commons.vfs.FileObject;
004 import org.apache.commons.vfs.FileSystemException;
005 import org.picocontainer.defaults.ObjectReference;
006
007 /**
008 * A deployer provides a method of loading some sort of "archive" with a soft-configuration
009 * system. The archive can be compressed zips, remote urls, or standard file folders.
010 * <p>It uses Apache Commons VFS for a unified resource model, but the actual
011 * format of the 'archive' will depend on the implementation of the deployer.
012 * See {@link org.nanocontainer.deployer.NanoContainerDeployer} for the default file format used.</p>
013 * <p>Typically, the archive is deployed in its own unique VFS-based classloader to
014 * provide independence of these archives. For those following development
015 * of the PicoContainer world, a deployer can be considered a bit of a mini-microcontainer.</p>
016 * @author Aslak Hellesøy
017 * @author Michael Rimov
018 * @version $Revision: 2947 $
019 */
020 public interface Deployer {
021
022
023 /**
024 * Deploys some sort of application folder. As far as NanoContainer deployment
025 * goes, there is a null assembly scope associated with this method.
026 * @param applicationFolder FileObject the base class of the 'archive'. By
027 * archive, the format depends on the deployer instance, and it may even
028 * apply to things such remote URLs. Must use Apache VFS
029 * @param parentClassLoader The parent classloader to attach this container to.
030 * @param parentContainerRef ObjectReference the parent container object reference.
031 * @return ObjectReference a new object reference that container the new
032 * container.
033 * @throws FileSystemException upon VFS-based errors.
034 * @throws ClassNotFoundException upon class instantiation error while running
035 * the composition script.
036 * @deprecated Since NanoContainer 1.2 (3/15/06). Use the version of this
037 * method with an assembly scope instead and pass in a null argument instead.
038 */
039 ObjectReference deploy(FileObject applicationFolder, ClassLoader parentClassLoader, ObjectReference parentContainerRef) throws FileSystemException, ClassNotFoundException;
040
041
042 /**
043 * Deploys some sort of application folder. As far as NanoContainer deployment
044 * goes, there is a null assembly scope associated with this method, and
045 * @param applicationFolder FileObject the base class of the 'archive'. By
046 * archive, the format depends on the deployer instance, and it may even
047 * apply to things such remote URLs. Must use Apache VFS
048 * @param parentClassLoader The parent classloader to attach this container to.
049 * @param parentContainerRef ObjectReference the parent container object reference.
050 * @param assemblyScope the assembly scope to use. This can be any object desired,
051 * (null is allowed) and when coupled with things like NanoWAR, it allows conditional assembly
052 * of different components in the script.
053 * @return ObjectReference a new object reference that container the new
054 * container.
055 * @throws FileSystemException upon VFS-based errors.
056 * @throws ClassNotFoundException upon class instantiation error while running
057 * the composition script.
058 */
059 ObjectReference deploy(FileObject applicationFolder, ClassLoader parentClassLoader, ObjectReference parentContainerRef, Object assemblyScope) throws FileSystemException, ClassNotFoundException;
060 }