edu.ucsb.adl.middleware
Class ObjectLoader

java.lang.Object
  |
  +--edu.ucsb.adl.middleware.ObjectLoader

public final class ObjectLoader
extends java.lang.Object

Provides the ability to create instances of dynamically loaded classes.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/ObjectLoader.java,v 1.5 2004/09/21 22:22:00 gjanee Exp $

$Log: ObjectLoader.java,v $ Revision 1.5 2004/09/21 22:22:00 gjanee
Rewrite to use class ExtendedProperties.

Revision 1.4 2004/03/02 23:33:01 gjanee
Added a version of loadObject that invokes a constructor that accepts three arguments, a Global, a File, and a String.

Revision 1.3 2001/08/11 03:34:33 gjanee
Added a version of loadObject that invokes a constructor that accepts two arguments, a File and a String.

Revision 1.2 2001/02/21 22:25:14 gjanee
Added a version of loadObject that invokes a constructor that accepts a single String argument.

Revision 1.1 2000/10/11 17:59:00 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
static java.lang.Object loadObject(java.lang.String className, java.lang.String methodName, edu.ucsb.adl.middleware.ExtendedProperties propertyList, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
static java.lang.Object loadObject(java.lang.String className, java.lang.String methodName, edu.ucsb.adl.middleware.ExtendedProperties propertyList, java.lang.String argument, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
static java.lang.Object loadObject(java.lang.String className, java.lang.String methodName, java.io.File file, java.lang.String argument, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
static java.lang.Object loadObject(java.lang.String className, java.lang.String methodName, edu.ucsb.adl.middleware.Global global, java.io.File file, java.lang.String argument, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
static java.lang.Object loadObject(java.lang.String className, java.lang.String argument, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
static java.lang.Object loadObject(java.lang.String className, java.lang.String methodName, java.lang.String argument, java.lang.String interfaceName)
          Dynamically loads a class and returns an instance of the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String methodName,
                                          edu.ucsb.adl.middleware.ExtendedProperties propertyList,
                                          java.lang.String argument,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If methodName is M, the instance is created by calling the method of the class having the profile:
public static Object M (ExtendedProperties, String)
It is checked that the returned object reference is non-null, and that the returned object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
methodName - The name of the class's instance-creating method, e.g., "createDriver".
propertyList - Passed to method methodName.
argument - Passed to method methodName.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String methodName,
                                          edu.ucsb.adl.middleware.ExtendedProperties propertyList,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If methodName is M, the instance is created by calling the method of the class having the profile:
public static Object M (ExtendedProperties)
It is checked that the returned object reference is non-null, and that the returned object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
methodName - The name of the class's instance-creating method, e.g., "createDriver".
propertyList - Passed to method methodName.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String methodName,
                                          java.lang.String argument,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If methodName is M, the instance is created by calling the method of the class having the profile:
public static Object M (String)
It is checked that the returned object reference is non-null, and that the returned object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
methodName - The name of the class's instance-creating method, e.g., "createDriver".
argument - Passed to method methodName.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String argument,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If className is C, the instance is created by calling the constructor having the profile:
public C (String)
It is checked that the created object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
argument - Passed to the constructor.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String methodName,
                                          java.io.File file,
                                          java.lang.String argument,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If methodName is M, the instance is created by calling the method of the class having the profile:
public static Object M (File, String)
It is checked that the returned object reference is non-null, and that the returned object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
methodName - The name of the class's instance-creating method, e.g., "createDriver".
file - Passed to method methodName.
argument - Passed to method methodName.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.

loadObject

public static java.lang.Object loadObject(java.lang.String className,
                                          java.lang.String methodName,
                                          edu.ucsb.adl.middleware.Global global,
                                          java.io.File file,
                                          java.lang.String argument,
                                          java.lang.String interfaceName)
                                   throws InternalErrorException
Dynamically loads a class and returns an instance of the class. If methodName is M, the instance is created by calling the method of the class having the profile:
public static Object M (Global, File, String)
It is checked that the returned object reference is non-null, and that the returned object is an instance of class/interface interfaceName.

Parameters:
className - The fully-qualified name of the class to load, e.g., "edu.bigmac.MyDriver".
methodName - The name of the class's instance-creating method, e.g., "createDriver".
global - Passed to method methodName.
file - Passed to method methodName.
argument - Passed to method methodName.
interfaceName - The fully-qualified name of the class or interface of which the returned object should be an instance, e.g., "edu.ucsb.adl.middleware.MetadataDriver".
Returns:
An instance of class or interface interfaceName.
Throws:
InternalErrorException - If any error is encountered.