|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.fractal.julia.loader.BasicLoader
public class BasicLoader
Provides a basic implementation of the Loader
interface. This
implementation loads the required classes from the class path.
Requirements
Constructor Summary | |
---|---|
BasicLoader()
|
Method Summary | |
---|---|
Tree |
evalTree(Tree tree,
Map context)
Evaluates the given tree in the given context. |
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. |
Class |
loadClass(Tree classDescriptor,
Object loader)
Loads or generates the class whose descriptor is given. |
Tree |
loadTree(String name)
Loads the tree whose name is given. |
Object |
newObject(Tree objectDescriptor,
Object loader)
Creates and returns the object whose description is given. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicLoader()
Method Detail |
---|
public void init(Map context) throws Exception
Loader
init
in interface Loader
context
- the initialization arguments.
Exception
- if the initialization fails.public Tree loadTree(String name) throws Exception
Loader
loadTree
in interface Loader
name
- a tree name.
Exception
- if the tree is not found or cannot be loaded.public Tree evalTree(Tree tree, Map context) throws Exception
Loader
evalTree
in interface Loader
tree
- the tree to be evaluated.context
- a map associating names to trees.
Exception
- if a name is not found in the given context. The
exception's detail is equal to this name.public Object newObject(Tree objectDescriptor, Object loader) throws Exception
Loader
newObject
in interface Loader
objectDescriptor
- the descriptor of the object to be created. This
descriptor must be either of the form "className", or of the form
"(classDescriptor arg1 ... argN)". In the first case, "className"
must be the fully qualified name of a class. In the second case,
"classDescriptor" must be a valid class descriptor (see loadClass
). "arg1" ... "argN" can be arbitrary
trees.loader
- an optional class loader to load auxiliary classes.
loadClass
method, and a new
instance of this class is created (this class must have a default
public constructor). Then, if the arguments "arg1 ... argN" are not
empty, the initialize
method is used
to initialize the previous instance (in this case, the
"classDescriptor" class must implement the Initializable
interface; the initialize
method is
called with (arg1 ... argN) as parameter). Finally the
previously created object is returned.
Exception
- if the specified object cannot be created.public Class loadClass(String name, Object loader) throws ClassNotFoundException
Loader
loadClass
in interface Loader
name
- the fully qualified name of the class to be returned.loader
- an optional class loader to load auxiliary classes.
ClassNotFoundException
- if the specified class is not found.public Class loadClass(Tree classDescriptor, Object loader) throws ClassNotFoundException
Loader
loadClass
in interface Loader
classDescriptor
- the descriptor of the class to be loaded or
dynamically generated. This descriptor must be either of the form
"className", or of the form "(objectDescriptor arg1 ... argN)". In the
first case, "className" must be the fully qualified name of a class.
In the second case, "objectDescriptor" must be a valid object
descriptor (see newObject
), describing an object
that implements the ClassGenerator
interface.
"arg1" ... "argN" can be arbitrary trees.loader
- an optional class loader to load auxiliary classes.
newObject
method, and its generateClass
method is used to generate a class (this method is
called with classDescriptor as second argument), which is
finally returned.
ClassNotFoundException
- is the specified class cannot be loaded or
dynamically generated.protected Class generateClass(String name, Tree classDescriptor, Object loader) throws ClassNotFoundException
Generated
interface,
and its getFcGeneratorParameters
method must return classDescriptor.toString(). The default
implementation of this method throws an exception.
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.
ClassNotFoundException
- if a problem occurs during the generation
of the class.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |