Websphere MQ Everyplace

com.ibm.mqe
Class MQeLoader

java.lang.Object
  |
  +--com.ibm.mqe.MQeLoader

public class MQeLoader
extends java.lang.Object

A base-class providing a way of plugging user-written class loaders into MQe.

MQe loads many classes dynamically using this MQeLoader class.

An MQeLoader object is statically constructed within the MQe class.

MQe configuration information often holds the name of a java class, which is loaded by name at run time.

To do so the loadClass and loadObject methods are used. Any calls to those methods cause the loader which is currently set into the MQe class, using the MQe.setLoader(com.ibm.mqe.MQeLoader) method, to be invoked on its loadClass or loadObject method.

The {com.ibm.mqe.MQe} class delegates all loading responsibilities to this class, or a subclass of this class.

This class can be treated as a base class, which can be subclassed by custom code. The custom subclass can then be used by MQe after it has been passed to the MQe.setLoader(com.ibm.mqe.MQeLoader) method,

Responsibilities of this class are:


Constructor Summary
MQeLoader()
          Constructor
 
Method Summary
 void addClass(java.lang.String className, java.lang.Class theClass)
          Adds a class to the loader
 java.lang.Class loadClass(java.lang.String className, boolean reserved)
          Loads and gets a reference to an instance of class Class representing the named class.
 java.lang.Object loadObject(java.lang.String className)
          Gets a new instance of the named class.
 void removeClass(java.lang.String className)
          Removes a class from the loader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MQeLoader

public MQeLoader()
Constructor

Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String className,
                                 boolean reserved)
                          throws java.lang.ClassNotFoundException
Loads and gets a reference to an instance of class Class representing the named class.

Classes loaded are cached so they don't have to be loaded in the future. Destroying and re-creating the loader will flush the cache.

This method should not be called directly from any code. It should be called only by the MQe class when the loadClass method is called.

Parameters:
className - A java.lang.String, holding either a valid class on the classpath, or an alias for a valid class on the classpath. If it has .class at the end, this is stripped off before the class name is used.
reserved - A boolean. Not used.Retained for backward compatability with previous releases.
Returns:
A reference to the class which has just been loaded.
java.lang.ClassNotFoundException

loadObject

public java.lang.Object loadObject(java.lang.String className)
                            throws java.lang.Exception
Gets a new instance of the named class.

The Class object containing the code for the class named is loaded using the loadClass(java.lang.String, boolean) method during this call.

The class specified must be loadable, and must have a default (no argument) constructor.

This method should not be called directly from any code. It should be called only by the MQe class when the MQe.loadObject(java.lang.String) method is called.

Parameters:
className - java.lang.String. A java class name. The class name for which a new instance is to be instantiated.It must be either a valid class on the classpath or an alias for a valid class on the classpath,
Returns:
an instance of the class specifid.
java.lang.Exception

addClass

public void addClass(java.lang.String className,
                     java.lang.Class theClass)
Adds a class to the loader

Parameters:
className - java.lang.String. A java class name. The class name for which the Class would be loaded.
theClass - java.lang.Class. The actual class that will be instantiated
Returns:
void

removeClass

public void removeClass(java.lang.String className)
Removes a class from the loader

Parameters:
className - java.lang.String. A java class name. The class name for which the Class would be loaded.
Returns:
void

Websphere MQ Everyplace