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 with SQLJ.INSTALL_JAR.
Author:
Thomas Hallgren
  • Field Details

    • 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 meaningful setContextClassLoader argument).
  • Method Details

    • 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 named schemaName. Class paths are defined using the SQL procedure sqlj.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 type Oid to Java Class map that contains the Java UDT mappings for the given schema. 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 class ClassLoader
      Throws:
      ClassNotFoundException
    • findResource

      protected URL findResource(String name)
      Overrides:
      findResource in class ClassLoader
    • findResources

      protected Enumeration<URL> findResources(String name) throws IOException
      Overrides:
      findResources in class ClassLoader
      Throws:
      IOException