org.postgresql.pljava.management
Class Commands
java.lang.Object
org.postgresql.pljava.management.Commands
public class Commands
extends java.lang.Object
This methods of this class are implementations of SQLJ commands.
SQLJ functions
install_jar
The install_jar command loads a jar file from a location appointed by an URL
or a binary image that constitutes the contents of a jar file into the SQLJ
jar repository. It is an error if a jar with the given name already exists in
the repository.
Usage 1
SELECT sqlj.install_jar(<jar_url>, <jar_name>, <deploy>);
Parameters
jar_url | The URL that denotes the location of the jar that should be loaded |
jar_name | This is the name by which this jar can be referenced once it has been
loaded |
deploy | True if the jar should be deployed according to a deployment
descriptor , false otherwise |
Usage 2
SELECT sqlj.install_jar(<jar_image>, <jar_name>, <deploy>);
Parameters
jar_image | The byte array that constitutes the contents of the jar that should be
loaded |
jar_name | This is the name by which this jar can be referenced once it has been
loaded |
deploy | True if the jar should be deployed according to a deployment
descriptor , false otherwise |
replace_jar
The replace_jar will replace a loaded jar with another jar. Use this command
to update already loaded files. It's an error if the jar is not found.
Usage 1
SELECT sqlj.replace_jar(<jar_url>, <jar_name>, <redeploy>);
Parameters
jar_url | The URL that denotes the location of the jar that should be loaded |
jar_name | The name of the jar to be replaced |
redeploy | True if the old and new jar should be undeployed and deployed according
to their respective deployment
descriptors , false otherwise |
Usage 2
SELECT sqlj.replace_jar(<jar_image>, <jar_name>, <redeploy>);
Parameters
jar_image | The byte array that constitutes the contents of the jar that should be
loaded |
jar_name | The name of the jar to be replaced |
redeploy | True if the old and new jar should be undeployed and deployed according
to their respective deployment
descriptors , false otherwise |
remove_jar
The remove_jar will drop the jar from the jar repository. Any classpath that
references this jar will be updated accordingly. It's an error if the jar is
not found.
Usage
SELECT sqlj.remove_jar(<jar_name>, <undeploy>);
Parameters
jar_name | The name of the jar to be removed |
undeploy | True if the jar should be undeployed according to its deployment
descriptor , false otherwise |
get_classpath
The get_classpath will return the classpath that has been defined for the
given schema or NULL if the schema has no classpath. It's an error if the
given schema does not exist.
Usage
SELECT sqlj.get_classpath(<schema>);
Parameters
schema | The name of the schema |
set_classpath
The set_classpath will define a classpath for the given schema. A classpath
consists of a colon separated list of jar names. It's an error if the given
schema does not exist or if one or more jar names references non existent
jars.
Usage
SELECT sqlj.set_classpath(<schema>, <classpath>);
Parameters
schema | The name of the schema |
classpath | The colon separated list of jar names |
add_type_mapping
The add_type_mapping defines the mapping between an SQL type and a Java
class.
Usage
SELECT sqlj.add_type_mapping(<sqlTypeName>, <className>);
Parameters
sqlTypeName | The name of the SQL type. The name can be qualified with a
schema (namespace). If the schema is omitted, it will be resolved according
to the current setting of the search_path. |
className | The name of the class. The class must be found in the classpath in
effect for the current schema |
drop_type_mapping
The drop_type_mapping removes the mapping between an SQL type and a Java
class.
Usage
SELECT sqlj.drop_type_mapping(<sqlTypeName>);
Parameters
sqlTypeName | The name of the SQL type. The name can be qualified with a
schema (namespace). If the schema is omitted, it will be resolved according
to the current setting of the search_path. |
static void | addClassImages(int jarId, InputStream urlStream) - Reads the jar found at the specified URL and stores the entries in the
jar_entry table.
|
static void | addTypeMapping(String sqlTypeName, String javaClassName) - Defines the mapping between an SQL type and a Java class.
|
static void | dropTypeMapping(String sqlTypeName) - Drops the mapping between an SQL type and a Java class.
|
static String | getClassPath(String schemaName) - Return the classpath that has been defined for the schema named
schemaName This method is exposed in SQL as
sqlj.get_classpath(VARCHAR) .
|
static String | getCurrentSchema()
|
static void | installJar(String urlString, String jarName, boolean deploy) - Installs a new Jar in the database jar repository under name
jarName .
|
static void | installJar(byte[] image, String jarName, boolean deploy) - Installs a new Jar in the database jar repository under name
jarName .
|
static void | removeJar(String jarName, boolean undeploy) - Removes the jar named
jarName from the database jar
repository.
|
static void | replaceJar(String urlString, String jarName, boolean redeploy) - Replaces the image of jar named
jarName in the database
jar repository.
|
static void | replaceJar(byte[] jarImage, String jarName, boolean redeploy) - Replaces the image of jar named
jarName in the database
jar repository.
|
static void | setClassPath(String schemaName, String path) - Define the class path to use for Java functions, triggers, and procedures
that are created in the schema named
schemaName This
method is exposed in SQL as
sqlj.set_classpath(VARCHAR, VARCHAR) .
|
addClassImages
public static void addClassImages(int jarId,
InputStream urlStream)
throws SQLException
Reads the jar found at the specified URL and stores the entries in the
jar_entry table.
jarId
- The id used for the foreign key to the jar_repository tableurlStream
- The URL
addTypeMapping
public static void addTypeMapping(String sqlTypeName,
String javaClassName)
throws SQLException
Defines the mapping between an SQL type and a Java class.
sqlTypeName
- The name of the SQL type. The name can be
qualified with a schema (namespace). If the schema is omitted,
it will be resolved according to the current setting of the
search_path
.javaClassName
- The name of the class. The class must be found in
the classpath in effect for the current schema
dropTypeMapping
public static void dropTypeMapping(String sqlTypeName)
throws SQLException
Drops the mapping between an SQL type and a Java class.
sqlTypeName
- The name of the SQL type. The name can be
qualified with a schema (namespace). If the schema is omitted,
it will be resolved according to the current setting of the
search_path
.
getClassPath
public static String getClassPath(String schemaName)
throws SQLException
Return the classpath that has been defined for the schema named
schemaName
This method is exposed in SQL as
sqlj.get_classpath(VARCHAR)
.
schemaName
- Name of the schema for which this path is valid.
- The defined classpath or
null
if this schema has
no classpath.
getCurrentSchema
public static String getCurrentSchema()
throws SQLException
installJar
public static void installJar(String urlString,
String jarName,
boolean deploy)
throws SQLException
Installs a new Jar in the database jar repository under name
jarName
. Once installed classpaths can be defined that
refrences this jar. This method is exposed in SQL as
sqlj.install_jar(VARCHAR, VARCHAR, BOOLEAN)
.
urlString
- The location of the jar that will be installed.jarName
- The name by which the system will refer to this jar.deploy
- If set, execute install commands found in the deployment
descriptor.
installJar
public static void installJar(byte[] image,
String jarName,
boolean deploy)
throws SQLException
Installs a new Jar in the database jar repository under name
jarName
. Once installed classpaths can be defined that
refrences this jar. This method is exposed in SQL as
sqlj.install_jar(BYTEA, VARCHAR, BOOLEAN)
.
image
- The byte array that constitutes the jar content.jarName
- The name by which the system will refer to this jar.deploy
- If set, execute install commands found in the deployment
descriptor.
removeJar
public static void removeJar(String jarName,
boolean undeploy)
throws SQLException
Removes the jar named jarName
from the database jar
repository. Class path entries that references this jar will also be
removed (just the entry, not the whole path). This method is exposed in
SQL as sqlj.remove_jar(VARCHAR, BOOLEAN)
.
jarName
- The name by which the system referes this jar.undeploy
- If set, execute remove commands found in the deployment
descriptor of the jar.
replaceJar
public static void replaceJar(String urlString,
String jarName,
boolean redeploy)
throws SQLException
Replaces the image of jar named jarName
in the database
jar repository. This method is exposed in SQL as
sqlj.replace_jar(VARCHAR, VARCHAR, BOOLEAN)
.
urlString
- The location of the jar that will be installed.jarName
- The name by which the system referes this jar.redeploy
- If set, execute remove commands found in the deployment
descriptor of the old jar and install commands found in the
deployment descriptor of the new jar.
replaceJar
public static void replaceJar(byte[] jarImage,
String jarName,
boolean redeploy)
throws SQLException
Replaces the image of jar named jarName
in the database
jar repository. This method is exposed in SQL as
sqlj.replace_jar(BYTEA, VARCHAR, BOOLEAN)
.
jarImage
- The byte array that constitutes the jar content.jarName
- The name by which the system referes this jar.redeploy
- If set, execute remove commands found in the deployment
descriptor of the old jar and install commands found in the
deployment descriptor of the new jar.
setClassPath
public static void setClassPath(String schemaName,
String path)
throws SQLException
Define the class path to use for Java functions, triggers, and procedures
that are created in the schema named schemaName
This
method is exposed in SQL as
sqlj.set_classpath(VARCHAR, VARCHAR)
.
schemaName
- Name of the schema for which this path is valid.path
- Colon separated list of names. Each name must denote the name
of a jar that is present in the jar repository.
Copyright (c) 2003, 2004, 2005 TADA AB - Taby Sweden. \
Distributed under the terms shown in COPYRIGHT