Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/DBWS/DBWSBuilder using ANT and javac"

Line 86: Line 86:
 
dbws.builder.file=dbws-builder.xml
 
dbws.builder.file=dbws-builder.xml
 
</source>
 
</source>
 +
 +
= DBWSBuilder using javac =
 +
 +
This example illustrates how DBWSBuilder can be invoked using javac generating all of the required artifacts to the file system, compiling them, and finally packaging them in a web archive that can be deployed to an active WebLogic instance.
  
  
 
[[Category:EclipseLink/Example/DBWS|ANT Builder]]
 
[[Category:EclipseLink/Example/DBWS|ANT Builder]]

Revision as of 11:31, 10 August 2012

DBWSBuilder using ANT

This example illustrates how DBWSBuilder can be invoked from ANT generating all of the required artifacts to the file system, compiling them, and finally packaging them in a web archive that can be deployed to an active WebLogic instance.

File layout for this example:

   <example-root>
   |
   |  build.properties
   |  build.xml
   |  dbws-builder.xml
   | 
   \---jlib
   |
   |   eclipselink.jar
   |   eclipselink-dbwsutils.jar
   |   javax.servlet.jar
   |   javax.wsdl.jar
   |   ojdbc6.jar
   |   org.eclipse.persistence.oracleddlparser.jar
   |
   \---stage
   |
   |   (Artifacts will be generated here, most notably simpletable.war)
   |

To run the DBWS builder in this example, simply type ant in the example-root directory. The builder packages the generated artifacts into the web archive simpletable.war, which is placed the the stage directory. This .war file can then be deployed to WebLogic.

dbws-builder.xml

Following is the builder XML file used in this example:

<?xml version="1.0" encoding="UTF-8"?>
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <properties>
    <property name="projectName">simpletable</property>
    ... database properties
  </properties>
 
  <table
    schemaPattern="SCOTT"
    tableNamePattern="SIMPLETABLE"
  />
</dbws-builder>

build.xml

Following is the build XML file used for this example:

<?xml version="1.0"?>
<project name="simpletable" default="build">
  <property file="${basedir}/build.properties"/>
 
  <path id="build.path">
    <fileset
      dir="${jlib.dir}"
      includes="eclipselink.jar 
                eclipselink-dbwsutils.jar 
                org.eclipse.persistence.oracleddlparser.jar 
                javax.wsdl.jar 
                javax.servlet.jar 
                ojdbc6.jar"
      >
    </fileset>
  </path>
 
  <target name="build">
    <java
      classname="org.eclipse.persistence.tools.dbws.DBWSBuilder"
      fork="true"
      classpathRef="build.path"
      >
      <arg line="-builderFile ${dbws.builder.file} -stageDir ${stage.dir} -packageAs ${server.platform} ${ant.project.name}.war"/>
    </java>
  </target>
</project>

build.properties

Following is the build properties file used for this example:

custom = true
build.sysclasspath=ignore
 
stage.dir=${basedir}/stage
jlib.dir=${basedir}/jlib
server.platform=wls
dbws.builder.file=dbws-builder.xml

DBWSBuilder using javac

This example illustrates how DBWSBuilder can be invoked using javac generating all of the required artifacts to the file system, compiling them, and finally packaging them in a web archive that can be deployed to an active WebLogic instance.