Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

vrml
Class FWJavaScriptClassLoader  view FWJavaScriptClassLoader download FWJavaScriptClassLoader.java

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byvrml.FWJavaScriptClassLoader

public final class FWJavaScriptClassLoader
extends java.security.SecureClassLoader


Nested Class Summary
 
Nested classes inherited from class java.lang.ClassLoader
 
Field Summary
(package private)  java.net.URL baseURL
           
(package private)  java.security.CodeSource myCodeSource
           
private static java.lang.String[] props
           
 
Fields inherited from class java.security.SecureClassLoader
 
Fields inherited from class java.lang.ClassLoader
 
Constructor Summary
FWJavaScriptClassLoader(java.lang.String url)
           
 
Method Summary
protected  java.lang.Class findClass(java.lang.String name)
          Called for every class name that is needed but has not yet been defined by this classloader or one of its parents.
protected  java.net.URL findResource(java.lang.String name)
          Called whenever a resource is needed that could not be provided by one of the parents of this classloader.
protected  java.util.Enumeration findResources(java.lang.String name)
          Called whenever all locations of a named resource are needed.
protected  java.security.PermissionCollection getPermissions(java.security.CodeSource codesource)
          Returns a PermissionCollection for the specified CodeSource.
private  byte[] readFile(java.lang.String name)
           
 
Methods inherited from class java.security.SecureClassLoader
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, 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

baseURL

java.net.URL baseURL

myCodeSource

java.security.CodeSource myCodeSource

props

private static final java.lang.String[] props
Constructor Detail

FWJavaScriptClassLoader

public FWJavaScriptClassLoader(java.lang.String url)
Method Detail

findClass

protected java.lang.Class findClass(java.lang.String name)
                             throws java.lang.ClassNotFoundException
Description copied from class: java.lang.ClassLoader
Called for every class name that is needed but has not yet been defined by this classloader or one of its parents. It is called by loadClass() after both findLoadedClass() and parent.loadClass() couldn't provide the requested class.

The default implementation throws a ClassNotFoundException. Subclasses should override this method. An implementation of this method in a subclass should get the class bytes of the class (if it can find them), if the package of the requested class doesn't exist it should define the package and finally it should call define the actual class. It does not have to resolve the class. It should look something like the following:

 // Get the bytes that describe the requested class
 byte[] classBytes = classLoaderSpecificWayToFindClassBytes(name);
 // Get the package name
 int lastDot = name.lastIndexOf('.');
 if (lastDot != -1)
   {
     String packageName = name.substring(0, lastDot);
     // Look if the package already exists
     if (getPackage(packageName) == null)
       {
         // define the package
         definePackage(packageName, ...);
       }
   }
 // Define and return the class
  return defineClass(name, classBytes, 0, classBytes.length);
 

loadClass() makes sure that the Class returned by findClass() will later be returned by findLoadedClass() when the same class name is requested.


getPermissions

protected java.security.PermissionCollection getPermissions(java.security.CodeSource codesource)
Description copied from class: java.security.SecureClassLoader
Returns a PermissionCollection for the specified CodeSource. The default implementation invokes java.security.Policy.getPermissions. This method is called by defineClass that takes a CodeSource arguement to build a proper ProtectionDomain for the class being defined.


readFile

private byte[] readFile(java.lang.String name)
                 throws java.io.IOException

findResource

protected java.net.URL findResource(java.lang.String name)
Description copied from class: java.lang.ClassLoader
Called whenever a resource is needed that could not be provided by one of the parents of this classloader. It is called by getResource() after parent.getResource() couldn't provide the requested resource.

The default implementation always returns null. Subclasses should override this method when they can provide a way to return a URL to a named resource.


findResources

protected java.util.Enumeration findResources(java.lang.String name)
                                       throws java.io.IOException
Description copied from class: java.lang.ClassLoader
Called whenever all locations of a named resource are needed. It is called by getResources() after it has called parent.getResources(). The results are combined by the getResources() method.

The default implementation always returns an empty Enumeration. Subclasses should override it when they can provide an Enumeration of URLs (possibly just one element) to the named resource. The first URL of the Enumeration should be the same as the one returned by findResource.