net.firstpartners.rp.mid.loader
Class RPClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by net.firstpartners.rp.mid.loader.RPClassLoader

public class RPClassLoader
extends java.lang.ClassLoader


Field Summary
private  java.util.Hashtable m_classCache
           
private  java.util.Hashtable m_dataSet
           
private  java.lang.ClassLoader m_parent
           
 
Constructor Summary
RPClassLoader()
          Constructor of the class loader
RPClassLoader(java.lang.ClassLoader parent)
          Creates a new instance of the class loader.
 
Method Summary
 void addClassFile(java.io.File file)
          Load the data from the specified class
 void cleanup()
          This method resets this ClassLoader's state.
 boolean existsClass(java.lang.String classname)
          Test if the specify class is in tjava.lang.ClassLoader's defineClass method is final, so the its subclasses cannot override this method.
protected  void finalize()
          This method resets this ClassLoader's state and resets the references for garbage collection.
 java.io.InputStream getResourceAsStream(java.lang.String resourceName)
          this method return a Inputstream of Recourse
 java.lang.Class loadAppClass(java.lang.String className)
          Description of the Method
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
          Loading the class
private  byte[] loadClassData(java.lang.String classname)
          java.lang.ClassLoader's defineClass method is final, so the its subclasses cannot override this method.
static byte[] readFully(java.io.InputStream is)
          Read the stream and return the bytes readed from this stream
protected  void setParent(java.lang.ClassLoader parent)
          Sets the parent/delegate class loader.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_parent

private java.lang.ClassLoader m_parent

m_classCache

private java.util.Hashtable m_classCache

m_dataSet

private java.util.Hashtable m_dataSet
Constructor Detail

RPClassLoader

public RPClassLoader()
Constructor of the class loader


RPClassLoader

public RPClassLoader(java.lang.ClassLoader parent)
Creates a new instance of the class loader.

Parameters:
parent - Description of Parameter
Method Detail

readFully

public static byte[] readFully(java.io.InputStream is)
                        throws java.io.IOException
Read the stream and return the bytes readed from this stream

Parameters:
is - Description of Parameter
Returns:
byte[] Bytes readed from the stream
Throws:
java.io.IOException - Description of Exception

existsClass

public final boolean existsClass(java.lang.String classname)
Test if the specify class is in tjava.lang.ClassLoader's defineClass method is final, so the its subclasses cannot override this method. But, this class calls this method in the loadClass() instead.

Parameters:
classname - Description of Parameter
Returns:
True if the class is in the cache or false otherwise

loadAppClass

public final java.lang.Class loadAppClass(java.lang.String className)
                                   throws java.lang.ClassNotFoundException
Description of the Method

Parameters:
className - Description of Parameter
Returns:
Description of the Returned Value
Throws:
java.lang.ClassNotFoundException - Description of Exception

addClassFile

public final void addClassFile(java.io.File file)
Load the data from the specified class

Parameters:
data - The feature to be added to the Data attribute

cleanup

public final void cleanup()
This method resets this ClassLoader's state. It completely removes all the URLs and classes in this class loader cache.


setParent

protected final void setParent(java.lang.ClassLoader parent)
Sets the parent/delegate class loader.

Parameters:
parent - The new parent value

finalize

protected void finalize()
                 throws java.lang.Throwable
This method resets this ClassLoader's state and resets the references for garbage collection.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - Description of Exception

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
Loading the class

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - The class to be load
resolve - True/false if the class want to be resolved or not
Returns:
Description of the Returned Value
Throws:
java.lang.ClassNotFoundException - Description of Exception

loadClassData

private byte[] loadClassData(java.lang.String classname)
java.lang.ClassLoader's defineClass method is final, so the its subclasses cannot override this method. But, this class calls this method in the loadClass() instead.

Parameters:
classname - Description of Parameter
Returns:
The class data bytes.

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String resourceName)
this method return a Inputstream of Recourse

Overrides:
getResourceAsStream in class java.lang.ClassLoader
Parameters:
String - resourceName recouse name with path
Returns:
InputStream if recouce found else null