org.nanocontainer.script
Class ScriptedContainerBuilderFactory

java.lang.Object
  extended byorg.nanocontainer.script.ScriptedContainerBuilderFactory

public class ScriptedContainerBuilderFactory
extends java.lang.Object

The main class for configuration of PicoContainer with various scripting languages. When using the constructors taking a file, the extensions must be one of the following:

-And the content of the file likewise. See NanoContainer documentation for details.

Author:
Paul Hammant, Aslak Helles&oslah;y, Obie Fernandez, Michael Rimov

Field Summary
static java.lang.String BEANSHELL
          Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.BEANSHELL instead.
static java.lang.String GROOVY
          Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.GROOVY instead.
static java.lang.String JAVASCRIPT
          Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.JAVASCRIPT instead.
static java.lang.String JYTHON
          Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.JYTHON instead.
static java.lang.String XML
          Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.XML instead.
 
Constructor Summary
ScriptedContainerBuilderFactory(java.io.File compositionFile)
           
ScriptedContainerBuilderFactory(java.io.File compositionFile, java.lang.ClassLoader classLoader)
           
ScriptedContainerBuilderFactory(java.io.File compositionFile, java.lang.ClassLoader classLoader, ScriptBuilderResolver builderClassResolver)
          Added since Nano RC-2.
ScriptedContainerBuilderFactory(java.io.Reader composition, java.lang.String builderClass)
           
ScriptedContainerBuilderFactory(java.io.Reader composition, java.lang.String builderClass, java.lang.ClassLoader classLoader)
          Allows you to create a factory that isntantiats the builder class you desire.
ScriptedContainerBuilderFactory(java.net.URL compositionURL)
           
ScriptedContainerBuilderFactory(java.net.URL compositionURL, java.lang.ClassLoader classLoader, ScriptBuilderResolver builderClassResolver)
          Added since Nano RC-2.
ScriptedContainerBuilderFactory(java.net.URL compositionURL, java.lang.String builderClassName, java.lang.ClassLoader contextClassLoader)
           
 
Method Summary
static java.lang.String getBuilderClassName(java.lang.String extension)
          Deprecated. Since NanoContainer 1.0 RC-2. Use the class ScriptBuilderResolver for this functionality.
 ScriptedContainerBuilder getContainerBuilder()
          Retrieve the created container builder instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROOVY

public static final java.lang.String GROOVY
Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.GROOVY instead.

See Also:
Constant Field Values

BEANSHELL

public static final java.lang.String BEANSHELL
Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.BEANSHELL instead.

See Also:
Constant Field Values

JAVASCRIPT

public static final java.lang.String JAVASCRIPT
Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.JAVASCRIPT instead.

See Also:
Constant Field Values

JYTHON

public static final java.lang.String JYTHON
Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.JYTHON instead.

See Also:
Constant Field Values

XML

public static final java.lang.String XML
Deprecated. Since NanoContainer RC-2. (14-Dec-2005). Use ScriptBuilderResolver.XML instead.

See Also:
Constant Field Values
Constructor Detail

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.io.File compositionFile,
                                       java.lang.ClassLoader classLoader)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.io.File compositionFile,
                                       java.lang.ClassLoader classLoader,
                                       ScriptBuilderResolver builderClassResolver)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException,
                                       UnsupportedScriptTypeException
Added since Nano RC-2. This allows you to add/modify registered builders to replace script handling or add new extensions by modifying a constructed ScriptBuilderResolver before constructing this object.

Parameters:
compositionFile - File The script file.
classLoader - ClassLoader for class resolution once we resolve what the name of the builder should be..
builderClassResolver - ScriptBuilderResolver the resolver for figuring out file names to container builder class names.
Throws:
java.io.IOException - upon java.io.File name resolution error.
java.lang.ClassNotFoundException - If there is an error loading the specified builder using the specified classloader.
UnsupportedScriptTypeException - if the extension of the file does not match that of any known script.

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.io.File compositionFile)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.net.URL compositionURL)
                                throws java.lang.ClassNotFoundException

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.net.URL compositionURL,
                                       java.lang.ClassLoader classLoader,
                                       ScriptBuilderResolver builderClassResolver)
                                throws java.lang.ClassNotFoundException,
                                       UnsupportedScriptTypeException
Added since Nano RC-2. This allows you to add/modify registered builders to replace script handling or add new extensions by modifying a constructed ScriptBuilderResolver before constructing this object.

Parameters:
compositionURL - The script URL.
builderClassResolver - ScriptBuilderResolver the resolver for figuring out file names to container builder class names.
classLoader - ClassLoader for class resolution once we resolve what the name of the builder should be..
Throws:
java.lang.ClassNotFoundException - If there is an error loading the specified builder using the specified classloader.
UnsupportedScriptTypeException - if the extension of the file does not match that of any known script.

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.net.URL compositionURL,
                                       java.lang.String builderClassName,
                                       java.lang.ClassLoader contextClassLoader)
                                throws java.lang.ClassNotFoundException

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.io.Reader composition,
                                       java.lang.String builderClass)
                                throws java.lang.ClassNotFoundException

ScriptedContainerBuilderFactory

public ScriptedContainerBuilderFactory(java.io.Reader composition,
                                       java.lang.String builderClass,
                                       java.lang.ClassLoader classLoader)
                                throws java.lang.ClassNotFoundException
Allows you to create a factory that isntantiats the builder class you desire.

Parameters:
composition - Reader the script you wish to create the builder for.
builderClass - String the builder class that instantiate.
classLoader - ClassLoader the classloader to use for instantiation.
Throws:
java.lang.ClassNotFoundException - if the specified class cannot be found.
Method Detail

getBuilderClassName

public static java.lang.String getBuilderClassName(java.lang.String extension)
Deprecated. Since NanoContainer 1.0 RC-2. Use the class ScriptBuilderResolver for this functionality.

This function does not support custom file type resolving -- for backwards compatibility, it uses a fresh instance of ScriptBuilderResolver for each invocation. Use ScriptBuilderResolver instead.

Parameters:
extension - String the file extension to res
Returns:
String the classname to use for the specified extension.

getContainerBuilder

public ScriptedContainerBuilder getContainerBuilder()
Retrieve the created container builder instance.

Returns:
ScriptedContainerBuilder instance, never null.


Copyright © 2003-2007 Codehaus. All Rights Reserved.