org.objectweb.fractal.adl
Class BasicLoader

java.lang.Object
  extended byorg.objectweb.fractal.adl.BasicLoader
All Implemented Interfaces:
BindingController, Loader

public class BasicLoader
extends Object
implements Loader, BindingController

A Loader that loads type and template definitions from the class path. This loader loads a definition named 'foo.bar.abc' by looking for a file foo/bar/abc.fractal in the resources of the class loader of this class (with the getResourceAsStream method). If such a file is found, this loader parses the XML element it contains, which should be name 'foo.bar.abc', and returns it.


Field Summary
protected  LoggerFactory loggerFactory
          The optional logger factory used to get a logger for this component.
 
Constructor Summary
BasicLoader()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
          Binds the client interface whose name is given to a server interface.
 String[] listFc()
          Returns the names of the client interfaces of the component to which this interface belongs.
 XMLElement loadTemplateDescriptor(String name)
          Loads the template definition whose name is given.
 XMLElement loadTypeDescriptor(String name)
          Loads the type definition whose name is given.
 Object lookupFc(String clientItfName)
          Returns the interface to which the given client interface is bound.
 void unbindFc(String clientItfName)
          Unbinds the given client interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loggerFactory

protected LoggerFactory loggerFactory
The optional logger factory used to get a logger for this component.

Constructor Detail

BasicLoader

public BasicLoader()
Method Detail

listFc

public String[] listFc()
Description copied from interface: BindingController
Returns the names of the client interfaces of the component to which this interface belongs.

Specified by:
listFc in interface BindingController
Returns:
the names of the client interfaces of the component to which this interface belongs.

lookupFc

public Object lookupFc(String clientItfName)
Description copied from interface: BindingController
Returns the interface to which the given client interface is bound. More precisely, returns the server interface to which the client interface whose name is given is bound. This server interface is necessarily in the same address space as the client interface (see bindFc).

Specified by:
lookupFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
Returns:
the server interface to which the given interface is bound, or null if it is not bound.

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
Description copied from interface: BindingController
Binds the client interface whose name is given to a server interface. More precisely, binds the client interface of the component to which this interface belongs, and whose name is equal to the given name, to the given server interface. The given server interface must be in the same address space as the client interface.

Specified by:
bindFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
serverItf - a server interface.

unbindFc

public void unbindFc(String clientItfName)
Description copied from interface: BindingController
Unbinds the given client interface. More precisely, unbinds the client interface of the component to which this interface belongs, and whose name is equal to the given name.

Specified by:
unbindFc in interface BindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.

loadTypeDescriptor

public XMLElement loadTypeDescriptor(String name)
                              throws ParserException
Description copied from interface: Loader
Loads the type definition whose name is given. Depending on the implementation, this method can return or not a different object when it is called several times with the same argument.

Specified by:
loadTypeDescriptor in interface Loader
Parameters:
name - the name of a component type.
Returns:
the XML element corresponding to the type definition whose name is given. This XML element must not be modified.
Throws:
ParserException - if the type definition can not be found or is invalid.

loadTemplateDescriptor

public XMLElement loadTemplateDescriptor(String name)
                                  throws ParserException
Description copied from interface: Loader
Loads the template definition whose name is given. Depending on the implementation, this method can return or not a different object when it is called several times with the same argument.

Specified by:
loadTemplateDescriptor in interface Loader
Parameters:
name - the name of a component template.
Returns:
the XML element corresponding to the component template whose name is given. This XML element must not be modified.
Throws:
ParserException - if the component template can not be found or is invalid.