org.apache.derby.impl.services.reflect
Class UpdateLoader

java.lang.Object
  extended by org.apache.derby.impl.services.reflect.UpdateLoader
All Implemented Interfaces:
LockOwner

final class UpdateLoader
extends java.lang.Object
implements LockOwner

UpdateLoader implements then functionality of derby.database.classpath. It manages the ClassLoaders (instances of JarLoader) for each installed jar file. Jar files are installed through the sqlj.install_jar procedure.
Each JarLoader delegates any request through standard mechanisms to load a class to this object, which will then ask each jarLoader in order of derby.database.classpath to load the class through an internal api. This means if the third jar in derby.database.classpath tries to load a class, say from the class for a procedure's method making some reference to it, then the request is delegated to UpdateLoader. UpdateLoader will then try to load the class from each of the jars in order of derby.database.classpath using the jar's installed JarLoader.


Field Summary
private  ShExLockable classLoaderLock
           
private  CompatibilitySpace compat
           
private  boolean initDone
           
private  JarLoader[] jarList
           
private  JarReader jarReader
           
private  LockFactory lf
           
private  java.lang.ClassLoader myLoader
           
private  boolean needReload
           
private  boolean normalizeToUpper
           
private  DatabaseClasses parent
           
private static java.lang.String[] RESTRICTED_PACKAGES
          List of packages that Derby will not support being loaded from an installed jar file.
private  java.lang.String thisClasspath
           
private  int version
           
private  HeaderPrintWriter vs
           
 
Constructor Summary
UpdateLoader(java.lang.String classpath, DatabaseClasses parent, boolean verbose, boolean normalizeToUpper)
           
 
Method Summary
(package private)  java.lang.Class checkLoaded(java.lang.String className, boolean resolve)
           
(package private)  void close()
           
(package private)  int getClassLoaderVersion()
           
private  java.lang.String getClasspath()
           
(package private)  JarReader getJarReader()
           
(package private)  java.io.InputStream getResourceAsStream(java.lang.String name)
           
private  void initializeFromClassPath(java.lang.String classpath)
           
private  void initLoaders()
           
(package private)  java.lang.Class loadClass(java.lang.String className, boolean resolve)
          Load the class from the class path.
private  boolean lockClassLoader(ShExQual qualifier)
           
(package private)  void modifyClasspath(java.lang.String classpath)
           
(package private)  void modifyJar(boolean reload)
           
(package private)  void needReload()
           
 boolean noWait()
          Tell the lock manager that we don't want timed waits to time out immediately.
private  void reload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESTRICTED_PACKAGES

private static final java.lang.String[] RESTRICTED_PACKAGES
List of packages that Derby will not support being loaded from an installed jar file.


jarList

private JarLoader[] jarList

vs

private HeaderPrintWriter vs

myLoader

private final java.lang.ClassLoader myLoader

initDone

private boolean initDone

thisClasspath

private java.lang.String thisClasspath

lf

private final LockFactory lf

classLoaderLock

private final ShExLockable classLoaderLock

version

private int version

normalizeToUpper

private boolean normalizeToUpper

parent

private DatabaseClasses parent

compat

private final CompatibilitySpace compat

needReload

private boolean needReload

jarReader

private JarReader jarReader
Constructor Detail

UpdateLoader

UpdateLoader(java.lang.String classpath,
             DatabaseClasses parent,
             boolean verbose,
             boolean normalizeToUpper)
       throws StandardException
Throws:
StandardException
Method Detail

initializeFromClassPath

private void initializeFromClassPath(java.lang.String classpath)
                              throws StandardException
Throws:
StandardException

loadClass

java.lang.Class loadClass(java.lang.String className,
                          boolean resolve)
                    throws java.lang.ClassNotFoundException
Load the class from the class path. Called by JarLoader when it has a request to load a class to fulfill the sematics of derby.database.classpath.

Enforces two restrictions:

Throws:
java.lang.ClassNotFoundException - Class can not be found or the installed jar is restricted from loading it.

getResourceAsStream

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

modifyClasspath

void modifyClasspath(java.lang.String classpath)
               throws StandardException
Throws:
StandardException

modifyJar

void modifyJar(boolean reload)
         throws StandardException
Throws:
StandardException

lockClassLoader

private boolean lockClassLoader(ShExQual qualifier)
                         throws StandardException
Throws:
StandardException

checkLoaded

java.lang.Class checkLoaded(java.lang.String className,
                            boolean resolve)

close

void close()

initLoaders

private void initLoaders()

getClassLoaderVersion

int getClassLoaderVersion()

needReload

void needReload()

reload

private void reload()
             throws StandardException
Throws:
StandardException

getClasspath

private java.lang.String getClasspath()
                               throws StandardException
Throws:
StandardException

getJarReader

JarReader getJarReader()

noWait

public boolean noWait()
Tell the lock manager that we don't want timed waits to time out immediately.

Specified by:
noWait in interface LockOwner
Returns:
false

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.