org.objectweb.fractal.julia.loader
Class DynamicLoader

java.lang.Object
  extended by org.objectweb.fractal.julia.loader.BasicLoader
      extended by org.objectweb.fractal.julia.loader.DynamicLoader
All Implemented Interfaces:
Loader

public class DynamicLoader
extends BasicLoader

Provides an implementation of the Loader interface that can generate classes on the fly.

Requirements


Constructor Summary
DynamicLoader()
           
 
Method Summary
protected  Class generateClass(String name, Tree classDescriptor, Object loader)
          Generates the class whose descriptor is given, with the given name.
 void init(Map context)
          Initializes this loader.
 Class loadClass(String name, Object loader)
          Loads the class whose name is given.
 
Methods inherited from class org.objectweb.fractal.julia.loader.BasicLoader
evalTree, loadClass, loadTree, newObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicLoader

public DynamicLoader()
Method Detail

init

public void init(Map context)
          throws Exception
Description copied from interface: Loader
Initializes this loader.

Specified by:
init in interface Loader
Overrides:
init in class BasicLoader
Parameters:
context - the initialization arguments.
Throws:
Exception - if the initialization fails.

loadClass

public Class loadClass(String name,
                       Object loader)
                throws ClassNotFoundException
Description copied from interface: Loader
Loads the class whose name is given.

Specified by:
loadClass in interface Loader
Overrides:
loadClass in class BasicLoader
Parameters:
name - the fully qualified name of the class to be returned.
loader - an optional class loader to load auxiliary classes.
Returns:
the class whose name is given.
Throws:
ClassNotFoundException - if the specified class is not found.

generateClass

protected Class generateClass(String name,
                              Tree classDescriptor,
                              Object loader)
                       throws ClassNotFoundException
Description copied from class: BasicLoader
Generates the class whose descriptor is given, with the given name. The generated class must implement the Generated interface, and its getFcGeneratorParameters method must return classDescriptor.toString(). The default implementation of this method throws an exception.

Overrides:
generateClass in class BasicLoader
Parameters:
name - the name of the class to be generated.
classDescriptor - the descriptor of the class to be generated. This descriptor must be of the form "(objectDescriptor arg1 ... argN)" (see loadClass).
loader - an optional class loader to load auxiliary classes.
Returns:
a class named name and whose content is described by the given class descriptor.
Throws:
ClassNotFoundException - if a problem occurs during the generation of the class.