- java.lang.Object
-
- java.lang.ClassLoader
-
- org.postgresql.pljava.sqlj.Loader
-
public class Loader extends ClassLoader
Class loader to load from jars installed in the database withSQLJ.INSTALL_JAR
.- Author:
- Thomas Hallgren
-
-
Field Summary
Fields Modifier and Type Field Description static ClassLoader
SENTINEL
A distinguished singleton instance to serve as a type-safe "sentinel" reference in context classloader management (as Java considers null to be a meaningfulsetContextClassLoader
argument).
-
Method Summary
Modifier and Type Method Description static void
clearSchemaLoaders()
Removes all cached schema loaders, functions, and type maps.protected Class<?>
findClass(String name)
protected URL
findResource(String name)
protected Enumeration<URL>
findResources(String name)
static ClassLoader
getCurrentLoader()
Obtains the loader that is in effect for the current schema (i.e.static ClassLoader
getSchemaLoader(Lexicals.Identifier.Simple schema)
Obtain a loader that has been configured for the class path of the schema namedschemaName
.static Map<Oid,Class<? extends SQLData>>
getTypeMap(Lexicals.Identifier.Simple schema)
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
SENTINEL
public static final ClassLoader SENTINEL
A distinguished singleton instance to serve as a type-safe "sentinel" reference in context classloader management (as Java considers null to be a meaningfulsetContextClassLoader
argument).
-
-
Method Detail
-
clearSchemaLoaders
public static void clearSchemaLoaders()
Removes all cached schema loaders, functions, and type maps. This method is called by the utility functions that manipulate the data that has been cached. It is not intended to be called from user code.
-
getCurrentLoader
public static ClassLoader getCurrentLoader() throws SQLException
Obtains the loader that is in effect for the current schema (i.e. the schema that is first in the search path).- Returns:
- A loader
- Throws:
SQLException
-
getSchemaLoader
public static ClassLoader getSchemaLoader(Lexicals.Identifier.Simple schema) throws SQLException
Obtain a loader that has been configured for the class path of the schema namedschemaName
. Class paths are defined using the SQL proceduresqlj.set_classpath
.- Parameters:
schema
- The name of the schema as an Identifier.Simple.- Returns:
- A loader.
- Throws:
SQLException
-
getTypeMap
public static Map<Oid,Class<? extends SQLData>> getTypeMap(Lexicals.Identifier.Simple schema) throws SQLException
Returns the SQL typeOid
to JavaClass
map that contains the Java UDT mappings for the givenschema
. This method is called by the function mapping mechanisms. Application code should never call this method.- Parameters:
schema
- The schema- Returns:
- The Map, possibly empty but never
null
. - Throws:
SQLException
-
findClass
protected Class<?> findClass(String name) throws ClassNotFoundException
- Overrides:
findClass
in classClassLoader
- Throws:
ClassNotFoundException
-
findResource
protected URL findResource(String name)
- Overrides:
findResource
in classClassLoader
-
findResources
protected Enumeration<URL> findResources(String name) throws IOException
- Overrides:
findResources
in classClassLoader
- Throws:
IOException
-
-