ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.editor
Class AbleClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended bycom.ibm.able.editor.AbleClassLoader

public class AbleClassLoader
extends java.lang.ClassLoader

A class loader that is used by the JarLoader to load the classes and resources.

Class instances are given an cookie string to identify their resources but our client code creates a single instance only. This is because it is impossible in general to pass values across from classes in one classloader to another.

This class loader can load from:


Field Summary
static AbleClassLoader ourLoader
          The only SimpleClassLoader we actually instantiate
static java.lang.String urlPrefix
           
 
Method Summary
 boolean applyDefinitions(java.util.Vector classList)
          Define a class from the bytecodes that were collected early...
static AbleClassLoader createLoader(java.lang.String cookie, java.lang.String dir)
          Returns an InputStream on the resource
 void defineClassFromBytes(java.lang.String name, byte[] buf)
          Set some bytecodes as a definition for a class.
 java.net.URL getLocalResource(java.lang.String name)
          Return a URL to the desired resource.
static java.lang.Object getLocalResource(java.lang.String cookie, java.lang.String name)
          get the local resource object...
static java.io.InputStream getLocalResourceAsStream(java.lang.String cookie, java.lang.String name)
           
 java.net.URL getResource(java.lang.String name)
           
 java.io.InputStream getResourceAsStream(java.lang.String name)
           
 java.lang.Object instantiate(java.lang.String name, AbleInputStreamProducer isp)
          Interface to Beans.instantiate.
 java.lang.Class loadClass(java.lang.String name)
          Load a class from this class loader.
protected  java.lang.Class loadClass(java.lang.String name, boolean resolve)
          This is the main method for ClassLoaders, that is being redefined
 java.lang.Class loadClassFromFile(java.lang.String fileName)
          Helper function; load a class from a file
 void setLocalResourceSource(java.lang.String name, AbleInputStreamProducer isp)
          Assign an InputStream as the source for a given property name This value comes first after the system resources
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

urlPrefix

public static final java.lang.String urlPrefix
See Also:
Constant Field Values

ourLoader

public static AbleClassLoader ourLoader
The only SimpleClassLoader we actually instantiate

Method Detail

defineClassFromBytes

public void defineClassFromBytes(java.lang.String name,
                                 byte[] buf)
Set some bytecodes as a definition for a class. Do not actually define the class until later


loadClassFromFile

public java.lang.Class loadClassFromFile(java.lang.String fileName)
                                  throws java.lang.ClassNotFoundException
Helper function; load a class from a file

Throws:
java.lang.ClassNotFoundException - if class cannot be found

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Load a class from this class loader.

Throws:
java.lang.ClassNotFoundException - if the class could not be found.

loadClass

protected java.lang.Class loadClass(java.lang.String name,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException
This is the main method for ClassLoaders, that is being redefined

Throws:
java.lang.ClassNotFoundException - if the class could not be found.

instantiate

public java.lang.Object instantiate(java.lang.String name,
                                    AbleInputStreamProducer isp)
                             throws java.lang.ClassNotFoundException,
                                    java.io.IOException
Interface to Beans.instantiate. Name is that of the bean. The stream producer provides the serialized representation of the bean

Throws:
java.lang.ClassNotFoundException - if class file not found
java.io.IOException

setLocalResourceSource

public void setLocalResourceSource(java.lang.String name,
                                   AbleInputStreamProducer isp)
Assign an InputStream as the source for a given property name This value comes first after the system resources


getResource

public java.net.URL getResource(java.lang.String name)

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name)

getLocalResource

public java.net.URL getLocalResource(java.lang.String name)
Return a URL to the desired resource.


createLoader

public static AbleClassLoader createLoader(java.lang.String cookie,
                                           java.lang.String dir)
Returns an InputStream on the resource


getLocalResource

public static java.lang.Object getLocalResource(java.lang.String cookie,
                                                java.lang.String name)
get the local resource object...


getLocalResourceAsStream

public static java.io.InputStream getLocalResourceAsStream(java.lang.String cookie,
                                                           java.lang.String name)

applyDefinitions

public boolean applyDefinitions(java.util.Vector classList)
Define a class from the bytecodes that were collected early... Will return false if there were problems applying the definitions This is only invoked if we are defining classes up front. Code will be removed if we don't discover any problems in testing.


ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005