jade.util
Class ObjectManager

java.lang.Object
  extended by jade.util.ObjectManager

public class ObjectManager
extends java.lang.Object

Utility class to manage instances of classes with attached properties i.e. classes specified in the form
foo.Bar[key1=value1;key2=value2...] This class allows registering "Loaders" for given types of objects (e.g. agents) and successively load such objects using them


Nested Class Summary
static interface ObjectManager.Loader
          The interface to be implemented by classes that can be registered to load objects of a given type
 
Field Summary
static java.lang.String AGENT_TYPE
          The constant representing the "agent" type
static java.lang.String CLASS_NAME
           
 
Constructor Summary
ObjectManager()
           
 
Method Summary
static void addLoader(java.lang.String type, ObjectManager.Loader loader)
          Register a Loader for a given type of object.
static java.lang.Object load(java.lang.String extendedClassName, java.lang.String type)
          Try to load an object of a given type by means of the loaders (if any) associated to that type.
static boolean removeLoader(java.lang.String type, ObjectManager.Loader loader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values

AGENT_TYPE

public static final java.lang.String AGENT_TYPE
The constant representing the "agent" type

See Also:
Constant Field Values
Constructor Detail

ObjectManager

public ObjectManager()
Method Detail

addLoader

public static void addLoader(java.lang.String type,
                             ObjectManager.Loader loader)
Register a Loader for a given type of object. Note that more than one Loader can be associated to a given type of object.

Parameters:
type - The type of object the registered Loader is associated to
loader - The Loader instance.

removeLoader

public static boolean removeLoader(java.lang.String type,
                                   ObjectManager.Loader loader)

load

public static java.lang.Object load(java.lang.String extendedClassName,
                                    java.lang.String type)
                             throws java.lang.ClassNotFoundException,
                                    java.lang.IllegalAccessException,
                                    java.lang.InstantiationException
Try to load an object of a given type by means of the loaders (if any) associated to that type.

Parameters:
extendedClassName - The class of the object to load in the form foo.Bar[key1=value1;key2=value2...]
type - The type of object to load
Returns:
The loaded object or null if no loader is suitable to load the object.
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException