Project OracleLoadJavaAntTask Notes


Title:OracleLoadJava
Author:Nicholas Whitehead
Description:An Ant Custom Tool To Load Java & Resources Into Oracle JServer

OracleLoadJava

Requirements

This taks requires an Oracle 9i database to load the java classes and resources into and the following client resources:

Description

Invokes the Oracle loadjava process on a set of Java source files, class files, jar files and java resources.

loadjava deploys [and builds] Java source files, class files, jar files and java resources into the Oracle database where they can be run by Oracle's internal VM.

Parameters

Attribute Description Required
resolve Compiles and resolves external references in classes after all classes on the command line have been loaded. If the value is set to on, references will be resolved in a second pass. If the value is set to immediate, the classes will be resolved at load time. No
debug Turns on SQL logging in the loaded class. No
definer Will cause the invocation privileges of the Java bytecode to run with the privileges of the user that loaded the Java. Otherwise, it will run with the privileges of the invoker. No
enoding Identifies the source file encoding for the compiler. No
fileout Redirects all the output from the loadjava process to a file. No
force Forces a file to be loaded, evenif Oracle determines it is identical to one already loaded. No
grant Grants execute privileges to the listed users. Users should be listed in comma separated values with no blanks. No
jarasresource If set, resources in a loaded jar file will not be unpacked. No
noserverside Forces the access to server side objects to be accessed using the JDBC driver at the cost of performance. Benefits are unclear. No
noverify Classes will be loaded with no bytecode verification. No
oci | oci8 Instructs the loadjava process to use the OCI driver to communicate with the database. Yes (unless thin is specified)
resolver Specifies a resolving specificaion for newly loaded classes. No
schema Specifies the schema where the Java objects are loaded. No
stdout Sends stderr output to stdout. No
synonym Creates a PUBLIC synonym for loaded classes. No
tableschema Creates loadjava internal tables in the specified schema instead of the schema of the loading user. No
thin Instructs the loadjava process to use the thin driver to communicate with the database. Yes (unless oci is specified)
time Places a timestamp message on all output messages. No
unresolvedok If specified with resolve will ignore all unresolved errors. No
user Specifies a connect string.
eg. thin: SCOTT/TIGER@localhost:1521:NICKMAN
eg. oci: SCOTT/TIGER@LOCAL
Yes
verbose Prints detailed status messages to stdout. No

Nested elements

For specifying the Java source, class files, jar files, zip files or resource files to load into Oracle, specify a FileSet that encompasses the desired target files. See example below.

Example

<?xml version="1.0" encoding="UTF-8"?>
<project name="OracleLoadJavaExample" default="main" basedir=".">
	<taskdef name="OracleLoadJava" classname="org.apache.tools.ant.taskdefs.optional.oraclejava.OracleLoadJava"/>
	<target name="main">
		<patternset id="oracle.load.classes">
			<include name="props.class"/>
			<include name="Char.java"/>
			<include name="eyes.gif"/>
		</patternset>
		<OracleLoadJava thin="on" user="SCOTT/TIGER@localhost:1521:NICKMAN" resolve="immediate" debug="on" force="on" noverify="on" verbose="on" noserverside="on" schema="scott" synonym="on" time="on">
			<fileset dir="${class.dir}">
				<patternset refid="oracle.load.classes"/>
			</fileset>
			<grant name="sonic"/>
			<grant name="jnlp"/>
		</OracleLoadJava>
	</target>
</project>

This invokes the loadjava process and loads four files into the database specified in the user attribute of the the OracleLoadJava element. Execute privileges are granted to the users sonic and jnlp.

To Do List:

  1. Grants currently apply to all loaded classes. This needs to be more granular, as in the original command.

Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.