project35.system
Class ModelClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by project35.system.ModelClassLoader

public class ModelClassLoader
extends java.net.URLClassLoader

A class loader that looks in the model directory's "lib" directory for class files. Scans for *.class and *.jar files.


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)

Constructor Summary
ModelClassLoader()
          constructor
 
Method Summary
 java.lang.Object getInstance(java.lang.String className)
          convenience method to get an instance of a class by the given class name
static ModelClassLoader getModelClassLoader()
          instantiation is done through this method only, to ensure that only one instance of the class is created
 java.lang.Class loadClass(java.lang.String className)
           
 void loadModelClasses(java.net.URL libraryDirectoryURL)
          loads class and jar files found in the model directory "lib" folder eg: project35/dist/models/tutorial/lib
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, 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

ModelClassLoader

public ModelClassLoader()
constructor

Method Detail

getModelClassLoader

public static ModelClassLoader getModelClassLoader()
instantiation is done through this method only, to ensure that only one instance of the class is created


loadModelClasses

public void loadModelClasses(java.net.URL libraryDirectoryURL)
                      throws Project35Exception
loads class and jar files found in the model directory "lib" folder eg: project35/dist/models/tutorial/lib

Throws:
Project35Exception

loadClass

public java.lang.Class loadClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException
Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

getInstance

public java.lang.Object getInstance(java.lang.String className)
                             throws Project35Exception
convenience method to get an instance of a class by the given class name

Parameters:
className - the fully qualified class name
Returns:
an instance of the class
Throws:
Project35Exception