de.ukn.hci.squidy.common.dynamiccode
Class DynamicCodeClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by de.ukn.hci.squidy.common.dynamiccode.DynamicCodeClassLoader

public class DynamicCodeClassLoader
extends ClassLoader

DynamicCode.

 Date: Mar 30, 2009
 Time: 7:19:03 PM
 

Since:
1.0.0
Version:
$Id: DynamicCodeClassLoader.java 141 2010-01-09 20:36:45Z zeitler $
Author:
Roman R&aumldle Roman .Raedle@uni-konstanz.de Human-Computer Interaction Group University of Konstanz

Field Summary
static DynamicCodeClassLoader DYNAMIC_CODE
           
static File DYNAMIC_CODE_REPOSITORY
           
 
Constructor Summary
DynamicCodeClassLoader()
           
DynamicCodeClassLoader(ClassLoader parentClassLoader)
           
DynamicCodeClassLoader(String compileClasspath, ClassLoader parentClassLoader)
           
 
Method Summary
 boolean addSourceDir(File srcDir)
          Add a directory that contains the source of dynamic java code.
 URL getResource(String resource)
          Get a resource from added source directories.
 InputStream getResourceAsStream(String resource)
          Get a resource stream from added source directories.
 Class<?> loadClass(String className)
          Returns the up-to-date dynamic class by name.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, 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
 

Field Detail

DYNAMIC_CODE_REPOSITORY

public static final File DYNAMIC_CODE_REPOSITORY

DYNAMIC_CODE

public static final DynamicCodeClassLoader DYNAMIC_CODE
Constructor Detail

DynamicCodeClassLoader

public DynamicCodeClassLoader()

DynamicCodeClassLoader

public DynamicCodeClassLoader(ClassLoader parentClassLoader)

DynamicCodeClassLoader

public DynamicCodeClassLoader(String compileClasspath,
                              ClassLoader parentClassLoader)
Parameters:
compileClasspath - used to compile dynamic classes
parentClassLoader - the parent of the class loader that loads all the dynamic classes
Method Detail

addSourceDir

public boolean addSourceDir(File srcDir)
Add a directory that contains the source of dynamic java code.

Parameters:
srcDir -
Returns:
true if the add is successful

loadClass

public Class<?> loadClass(String className)
                   throws ClassNotFoundException
Returns the up-to-date dynamic class by name.

Overrides:
loadClass in class ClassLoader
Parameters:
className -
Returns:
Throws:
ClassNotFoundException - if source file not found or compilation error

getResource

public URL getResource(String resource)
Get a resource from added source directories.

Overrides:
getResource in class ClassLoader
Parameters:
resource -
Returns:
the resource URL, or null if resource not found

getResourceAsStream

public InputStream getResourceAsStream(String resource)
Get a resource stream from added source directories.

Overrides:
getResourceAsStream in class ClassLoader
Parameters:
resource -
Returns:
the resource stream, or null if resource not found


Copyright © 2007-2010 Human-Computer-Interaction :: University of Konstanz. All Rights Reserved.