|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.nanocontainer.deployer.NanoContainerDeployer
public class NanoContainerDeployer
This class is capable of deploying an application from any kind of file system supported by Jakarta VFS. (Like local files, zip files etc.) - following the ScriptedContainerBuilderFactory scripting model. The root folder to deploy must have the following file structure:
+-someapp/ +-META-INF/ | +-nanocontainer.[py|js|xml|bsh] +-com/ +-blablah/ +-Hip.class +-Hop.classFor those familiar with J2EE containers (or other containers for that matter), the META-INF/picocontainer script is the ScriptedContainerBuilderFactory composition script. It plays the same role as more classical "deployment descriptors", except that deploying via a full blown scripting language is a lot more powerful! A new class loader (which will be a child of parentClassLoader) will be created. This classloader will make the classes under the root folder available to the deployment script. IMPORTANT NOTE: The scripting engine (rhino, jython, groovy etc.) should be loaded by the same classLoader as the appliacation classes, i.e. the VFSClassLoader pointing to the app directory.
+-------------------+ | xxx | <-- parent app loader (must not contain classes from app builder classloader) +-------------------+ | +-------------------+ | someapp | <-- app classloader (must not contain classes from app builder classloader) +-------------------+ | +-------------------+ | picocontainer | | nanocontainer | <-- app builder classloader | rhino | | jython | | groovy | +-------------------+This means that these scripting engines should *not* be accessible by any of the app classloader, since this may prevent the scripting engine from seeing the classes loaded by the VFSClassLoader. In other words, the scripting engine classed may be loaded several times by different class loaders - once for each deployed application.
Constructor Summary | |
---|---|
NanoContainerDeployer()
Default constructor that makes sensible defaults. |
|
NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager)
Constructs a nanocontainer deployer with the specified file system manager. |
|
NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager,
org.nanocontainer.script.ScriptBuilderResolver builderResolver)
Constructs this object with both a VFS file system manager, and |
|
NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager,
java.lang.String baseFileName)
Constructs a nanocontainer deployer with the specified file system manager and specifies a 'base name' for the configuration file that will be loaded. |
Method Summary | |
---|---|
org.picocontainer.defaults.ObjectReference |
deploy(org.apache.commons.vfs.FileObject applicationFolder,
java.lang.ClassLoader parentClassLoader,
org.picocontainer.defaults.ObjectReference parentContainerRef)
Deploys an application. |
org.picocontainer.defaults.ObjectReference |
deploy(org.apache.commons.vfs.FileObject applicationFolder,
java.lang.ClassLoader parentClassLoader,
org.picocontainer.defaults.ObjectReference parentContainerRef,
java.lang.Object assemblyScope)
Deploys some sort of application folder. |
protected org.apache.commons.vfs.FileObject |
getDeploymentScript(org.apache.commons.vfs.FileObject applicationFolder)
Given the base application folder, return a file object that represents the nanocontainer configuration script. |
java.lang.String |
getFileBasename()
Retrieve the file base name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NanoContainerDeployer() throws org.apache.commons.vfs.FileSystemException
org.apache.commons.vfs.FileSystemException
public NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager)
fileSystemManager
- A VFS FileSystemManager.public NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager, org.nanocontainer.script.ScriptBuilderResolver builderResolver)
fileSystemManager
- FileSystemManagerbuilderResolver
- ScriptBuilderResolverpublic NanoContainerDeployer(org.apache.commons.vfs.FileSystemManager fileSystemManager, java.lang.String baseFileName)
fileSystemManager
- A VFS FileSystemManager.Method Detail |
---|
public org.picocontainer.defaults.ObjectReference deploy(org.apache.commons.vfs.FileObject applicationFolder, java.lang.ClassLoader parentClassLoader, org.picocontainer.defaults.ObjectReference parentContainerRef) throws org.apache.commons.vfs.FileSystemException, java.lang.ClassNotFoundException
deploy
in interface Deployer
applicationFolder
- the root applicationFolder of the application.parentClassLoader
- the classloader that loads the application classes.parentContainerRef
- reference to the parent container (can be used to lookup components form a parent container).
org.apache.commons.vfs.FileSystemException
- if the file structure was bad.
org.nanocontainer.integrationkit.PicoCompositionException
- if the deployment failed for some reason.
java.lang.ClassNotFoundException
- upon class instantiation error while running
the composition script.public org.picocontainer.defaults.ObjectReference deploy(org.apache.commons.vfs.FileObject applicationFolder, java.lang.ClassLoader parentClassLoader, org.picocontainer.defaults.ObjectReference parentContainerRef, java.lang.Object assemblyScope) throws org.apache.commons.vfs.FileSystemException, java.lang.ClassNotFoundException
Deployer
deploy
in interface Deployer
applicationFolder
- FileObject the base class of the 'archive'. By
archive, the format depends on the deployer instance, and it may even
apply to things such remote URLs. Must use Apache VFSparentClassLoader
- The parent classloader to attach this container to.parentContainerRef
- ObjectReference the parent container object reference.assemblyScope
- the assembly scope to use. This can be any object desired,
(null is allowed) and when coupled with things like NanoWAR, it allows conditional assembly
of different components in the script.
org.apache.commons.vfs.FileSystemException
- upon VFS-based errors.
java.lang.ClassNotFoundException
- upon class instantiation error while running
the composition script.protected org.apache.commons.vfs.FileObject getDeploymentScript(org.apache.commons.vfs.FileObject applicationFolder) throws org.apache.commons.vfs.FileSystemException
applicationFolder
- FileObject
org.apache.commons.vfs.FileSystemException
public java.lang.String getFileBasename()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |