net.sf.fikin.classmarshaling
Class MarshaledClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by net.sf.fikin.classmarshaling.MarshaledClassLoader

public class MarshaledClassLoader
extends java.lang.ClassLoader

Class loader used to resolve required classes during de-serialization.

It supports class lookup from an internal map with classes and their bytecodes.

It does class lookup through a given class loader and if the class is not found, it will look into supplied map of classes.

The map contains the class name as key and class bytecode (byte[]) as value. created on Aug 2, 2005

Since:
Version:
$Revision: 1.1 $
Author:
fiykov

Constructor Summary
MarshaledClassLoader(java.util.Map _classMap)
          Initialize the classloader with a map with class bytecodes The the parent classloader will be defined by Classloader.getSystemClassLoader().
MarshaledClassLoader(java.util.Map _classMap, java.lang.ClassLoader parent)
          initialize the classloader with the given map with class bytecodes and specified classloader as parent
 
Method Summary
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
          attempts to load the class via parent 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, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarshaledClassLoader

public MarshaledClassLoader(java.util.Map _classMap)
Initialize the classloader with a map with class bytecodes

The the parent classloader will be defined by Classloader.getSystemClassLoader().

Parameters:
_classMap - to be used

MarshaledClassLoader

public MarshaledClassLoader(java.util.Map _classMap,
                            java.lang.ClassLoader parent)
initialize the classloader with the given map with class bytecodes and specified classloader as parent

Parameters:
_classMap - to be used
parent - parent classloader
Method Detail

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
attempts to load the class via parent class loader.

If this fails it tries to locate the class in the supplied map with classes.

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - The binary name of the class
resolve - If true then resolve the class
Returns:
The resulting Class object
Throws:
java.lang.ClassNotFoundException - if the class could not be found by the parent classloader is not present in the internal map


Copyright © 2007 Nikolay Fiykov. All Rights Reserved.