org.apache.derby.impl.sql.execute
Class JarUtil

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.JarUtil

public class JarUtil
extends java.lang.Object


Field Summary
static java.lang.String ADD_JAR_DDL
           
private  DataDictionary dd
           
private  DataDescriptorGenerator ddg
           
static java.lang.String DROP_JAR_DDL
           
private  FileResource fr
           
private  UUID id
           
private  LanguageConnectionContext lcc
           
static java.lang.String READ_JAR
           
static java.lang.String REPLACE_JAR_DDL
           
private  java.lang.String schemaName
           
private  java.lang.String sqlName
           
 
Constructor Summary
JarUtil(UUID id, java.lang.String schemaName, java.lang.String sqlName)
           
 
Method Summary
 long add(java.io.InputStream is)
          Add a jar file to the current connection's database.
static long add(UUID id, java.lang.String schemaName, java.lang.String sqlName, java.lang.String externalPath)
          Add a jar file to the current connection's database.
 void drop(boolean purgeOnCommit)
          Drop a jar file from the current connection's database.
static void drop(UUID id, java.lang.String schemaName, java.lang.String sqlName, boolean purgeOnCommit)
          Drop a jar file from the current connection's database.
private  StorageFile getAsFile(long generationId)
           
static java.lang.Object getAsObject(java.lang.String schemaName, java.lang.String sqlName)
           
private  java.io.InputStream getAsStream(long generationId)
           
static java.io.InputStream getAsStream(java.lang.String schemaName, java.lang.String sqlName, long generationId)
           
private  FileInfoDescriptor getInfo()
          Get the FileInfoDescriptor for the Jar file or null if it does not exist.
static FileInfoDescriptor getInfo(java.lang.String schemaName, java.lang.String sqlName, java.lang.String statementType)
          Get the FileInfoDescriptor for a jar file from the current connection's database or null if it does not exist.
private  void notifyLoader(boolean reload)
           
 long replace(java.io.InputStream is, boolean purgeOnCommit)
          Replace a jar file in the current connection's database with the content of an external file.
static long replace(UUID id, java.lang.String schemaName, java.lang.String sqlName, java.lang.String externalPath, boolean purgeOnCommit)
          Replace a jar file from the current connection's database with the content of an external file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_JAR_DDL

public static final java.lang.String ADD_JAR_DDL
See Also:
Constant Field Values

DROP_JAR_DDL

public static final java.lang.String DROP_JAR_DDL
See Also:
Constant Field Values

REPLACE_JAR_DDL

public static final java.lang.String REPLACE_JAR_DDL
See Also:
Constant Field Values

READ_JAR

public static final java.lang.String READ_JAR
See Also:
Constant Field Values

id

private UUID id

schemaName

private java.lang.String schemaName

sqlName

private java.lang.String sqlName

lcc

private LanguageConnectionContext lcc

fr

private FileResource fr

dd

private DataDictionary dd

ddg

private DataDescriptorGenerator ddg
Constructor Detail

JarUtil

public JarUtil(UUID id,
               java.lang.String schemaName,
               java.lang.String sqlName)
        throws StandardException
Method Detail

add

public static long add(UUID id,
                       java.lang.String schemaName,
                       java.lang.String sqlName,
                       java.lang.String externalPath)
                throws StandardException
Add a jar file to the current connection's database.

Parameters:
id - The id for the jar file we add. If null this makes up a new id.
schemaName - the name for the schema that holds the jar file.
sqlName - the sql name for the jar file.
externalPath - the path for the jar file to add.
Returns:
The generationId for the jar file we add.
Throws:
StandardException - Opps

add

public long add(java.io.InputStream is)
         throws StandardException
Add a jar file to the current connection's database.

The reason for adding the jar file in this private instance method is that it allows us to share set up logic with drop and replace.

Parameters:
is - A stream for reading the content of the file to add.
Throws:
StandardException - Opps

drop

public static void drop(UUID id,
                        java.lang.String schemaName,
                        java.lang.String sqlName,
                        boolean purgeOnCommit)
                 throws StandardException
Drop a jar file from the current connection's database.

Parameters:
id - The id for the jar file we drop. Ignored if null.
schemaName - the name for the schema that holds the jar file.
sqlName - the sql name for the jar file.
purgeOnCommit - True means purge the old jar file on commit. False means leave it around for use by replication.
Throws:
StandardException - Opps

drop

public void drop(boolean purgeOnCommit)
          throws StandardException
Drop a jar file from the current connection's database.

The reason for dropping the jar file in this private instance method is that it allows us to share set up logic with add and replace.

Parameters:
purgeOnCommit - True means purge the old jar file on commit. False means leave it around for use by replication.
Throws:
StandardException - Opps

replace

public static long replace(UUID id,
                           java.lang.String schemaName,
                           java.lang.String sqlName,
                           java.lang.String externalPath,
                           boolean purgeOnCommit)
                    throws StandardException
Replace a jar file from the current connection's database with the content of an external file.

Parameters:
id - The id for the jar file we add. Ignored if null.
schemaName - the name for the schema that holds the jar file.
sqlName - the sql name for the jar file.
externalPath - the path for the jar file to add.
purgeOnCommit - True means purge the old jar file on commit. False means leave it around for use by replication.
Returns:
The new generationId for the jar file we replace.
Throws:
StandardException - Opps

replace

public long replace(java.io.InputStream is,
                    boolean purgeOnCommit)
             throws StandardException
Replace a jar file in the current connection's database with the content of an external file.

The reason for adding the jar file in this private instance method is that it allows us to share set up logic with add and drop.

Parameters:
is - An input stream for reading the new content of the jar file.
purgeOnCommit - True means purge the old jar file on commit. False means leave it around for use by replication.
Throws:
StandardException - Opps

getInfo

public static FileInfoDescriptor getInfo(java.lang.String schemaName,
                                         java.lang.String sqlName,
                                         java.lang.String statementType)
                                  throws StandardException
Get the FileInfoDescriptor for a jar file from the current connection's database or null if it does not exist.

Parameters:
schemaName - the name for the schema that holds the jar file.
sqlName - the sql name for the jar file.
Returns:
The FileInfoDescriptor.
Throws:
StandardException - Opps

getInfo

private FileInfoDescriptor getInfo()
                            throws StandardException
Get the FileInfoDescriptor for the Jar file or null if it does not exist.

Throws:
StandardException - Ooops

getAsObject

public static java.lang.Object getAsObject(java.lang.String schemaName,
                                           java.lang.String sqlName)
                                    throws StandardException
Throws:
StandardException

getAsFile

private StorageFile getAsFile(long generationId)

getAsStream

public static java.io.InputStream getAsStream(java.lang.String schemaName,
                                              java.lang.String sqlName,
                                              long generationId)
                                       throws StandardException
Throws:
StandardException

getAsStream

private java.io.InputStream getAsStream(long generationId)
                                 throws StandardException
Throws:
StandardException

notifyLoader

private void notifyLoader(boolean reload)
                   throws StandardException
Throws:
StandardException

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.