Class UpdateLoader
java.lang.Object
org.apache.derby.impl.services.reflect.UpdateLoader
- All Implemented Interfaces:
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.
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
FieldsModifier and TypeFieldDescriptionprivate final ShExLockableprivate final CompatibilitySpaceprivate booleanprivate JarLoader[]private JarReaderprivate final LockFactoryprivate final ClassLoaderprivate booleanprivate booleanprivate DatabaseClassesprivate static final String[]List of packages that Derby will not support being loaded from an installed jar file.private Stringprivate intprivate HeaderPrintWriter -
Constructor Summary
ConstructorsConstructorDescriptionUpdateLoader(String classpath, DatabaseClasses parent, boolean verbose, boolean normalizeToUpper) -
Method Summary
Modifier and TypeMethodDescription(package private) ClasscheckLoaded(String className, boolean resolve) (package private) voidclose()(package private) intprivate Stringprivate static ContextgetContextOrNull(String contextID) Privileged lookup of a Context.(package private) JarReader(package private) InputStreamgetResourceAsStream(String name) private static ObjectgetServiceModule(Object serviceModule, String factoryInterface) Privileged module lookup.private voidinitializeFromClassPath(String classpath) private voidbooleanReturn true if this is a nested owner, e.g., a nested user transaction.(package private) ClassLoad the class from the class path.private booleanlockClassLoader(ShExQual qualifier) (package private) voidmodifyClasspath(String classpath) (package private) voidmodifyJar(boolean reload) (package private) voidbooleannestsUnder(LockOwner other) Return true if this owner nests under another owner.booleannoWait()Tell the lock manager that we don't want timed waits to time out immediately.private voidreload()
-
Field Details
-
RESTRICTED_PACKAGES
List of packages that Derby will not support being loaded from an installed jar file. -
jarList
-
vs
-
myLoader
-
initDone
private boolean initDone -
thisClasspath
-
lf
-
classLoaderLock
-
version
private int version -
normalizeToUpper
private boolean normalizeToUpper -
parent
-
compat
-
needReload
private boolean needReload -
jarReader
-
-
Constructor Details
-
UpdateLoader
UpdateLoader(String classpath, DatabaseClasses parent, boolean verbose, boolean normalizeToUpper) throws StandardException - Throws:
StandardException
-
-
Method Details
-
initializeFromClassPath
- Throws:
StandardException
-
loadClass
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:
- Do not allow classes in certain name spaces to be loaded from installed jars, see RESTRICTED_PACKAGES for the list.
- Referencing Derby's internal classes (those outside the public api) from installed is disallowed. This is to stop user defined routines bypassing security or taking advantage of security holes in Derby. E.g. allowing a routine to call a public method in derby would allow such routines to call public static methods for system procedures without having been granted permission on them, such as setting database properties.
- Throws:
ClassNotFoundException- Class can not be found or the installed jar is restricted from loading it.
-
getResourceAsStream
-
modifyClasspath
- Throws:
StandardException
-
modifyJar
- Throws:
StandardException
-
lockClassLoader
- Throws:
StandardException
-
checkLoaded
-
close
void close() -
initLoaders
private void initLoaders() -
getClassLoaderVersion
int getClassLoaderVersion() -
needReload
void needReload() -
reload
- Throws:
StandardException
-
getClasspath
- Throws:
StandardException
-
getJarReader
JarReader getJarReader() -
noWait
-
isNestedOwner
public boolean isNestedOwner()Description copied from interface:LockOwnerReturn true if this is a nested owner, e.g., a nested user transaction.
- Specified by:
isNestedOwnerin interfaceLockOwner
-
nestsUnder
Description copied from interface:LockOwnerReturn true if this owner nests under another owner.
- Specified by:
nestsUnderin interfaceLockOwner
-
getContextOrNull
-
getServiceModule
-