org.eclipse.amp.escape.ide
Class ProjectLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.eclipse.amp.escape.ide.ProjectLoader

public class ProjectLoader
extends java.net.URLClassLoader

Provides class loading for a project, with a fall back to the main class-loader for all other classes. Overriding a specific class loader seems to be the only model that works. Decorator pattern does not find new classes. Resources (such as the 'About this model' file displayed by InfoView) can be placed in the same folder as their class, or in a placed in a "res" source folder in the model project directory in a parallel directory path to the Java class package. For example, an about file for a model defined by the scape "edu.brook.norms.Norms" could be placed at "res/edu/brook/norms/AboutNorms.html".

Author:
milesparker

Constructor Summary
ProjectLoader(org.eclipse.core.resources.IProject project)
          Instantiates a new project loader.
 
Method Summary
 java.lang.Class<?> loadClass(java.lang.String name)
           
 void restore()
          Restore.
 
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

ProjectLoader

public ProjectLoader(org.eclipse.core.resources.IProject project)
              throws LoaderCreationException,
                     java.net.MalformedURLException
Instantiates a new project loader.

Parameters:
project - the project
Throws:
LoaderCreationException - the loader creation exception
java.net.MalformedURLException - if can't get URL to project resource dir
Method Detail

restore

public void restore()
Restore.


loadClass

public java.lang.Class<?> loadClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Overrides:
loadClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException