alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java EE 6 example source code file (build.xml)

This example Java EE 6 source code file (build.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Java EE 6 tags/keywords

all, copyright, create, create, deletes, deleting, deleting, microsystems, registering, registering, samplesjdbcpool, samplesjdbcpool, sun, utf-8

The Java EE 6 build.xml source code

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.-->
<project name="petstore-setup" basedir=".">

  <import file="../../../bp-project/main.xml" />

  <!-- sql scripts for creation/deletion of database -->
  <property name="db.create.src" value="./sql/create.sql"/>
  <property name="db.delete.src" value="./sql/delete.sql"/>

  <target name="setup" depends="create-jdbc-resource, create-db" />
  <target name="unsetup" depends="delete-jdbc-connection-pool, delete-db" />
  
  <target name="create-db" depends="delete-db"
	description="Create database tables and populate database." >
    <sql driver="${db.driver}"
         encoding="utf-8"
         url="${db.url}"
         userid="${db.user}"
         password="${db.password}"
         classpathref="db.classpath"
         delimiter="${db.delimiter}"
         autocommit="true"
         onerror="abort" >
    	<transaction src="${db.create.src}"/>
    </sql>
  </target>
  
  <target name="delete-db" description="Deletes the database tables." >
    <echo>driver=${db.driver}
    <echo>url=${db.url}
    <echo>user=${db.user}
    <echo>password=${db.password}
    <sql driver="${db.driver}"
         encoding="utf-8"
         url="${db.url}"
         userid="${db.user}"
         password="${db.password}"
         classpathref="db.classpath"
         delimiter="${db.delimiter}"
         autocommit="true"
         onerror="continue" >       
    	<transaction src="${db.delete.src}"/>
    </sql>
  </target>
  
  <target name="create-jdbc-connection-pool" depends="tools">
    <echo message="Registering jdbc-connection-pool SamplesJdbcPool."/>
    <echo>ds=${db.datasource}
    <antcall target="create-jdbc-connection-pool">
      <param name="pool.name"     value="SamplesJdbcPool" />
      <param name="db.serverName"   value="${javaee.server.name}" />
      <param name="ds.class"      value="${db.datasource}" />
    </antcall>
 </target>

 <target name="create-jdbc-resource" depends="tools,create-jdbc-connection-pool">
    <echo message="Registering jdbc resource jdbc/SamplesDB."/>
    <antcall target="create-jdbc-resource">
      <param name="pool.name"            value="SamplesJdbcPool" />
      <param name="jdbc.resource.name"   value="jdbc/SamplesDB" />
    </antcall>
 </target>

  <target name="delete-jdbc-resource" depends="tools" >
    <echo message="Deleting jdbc resource jdbc/SamplesDB"/>
    <antcall target="delete-jdbc-resource">
      <param name="jdbc.resource.name" value="jdbc/SamplesDB" />
    </antcall> 
 </target>

 <target name="delete-jdbc-iconnection-pool" depends="tools, delete-jdbc-resource">
    <echo message="Deleting jdbc-connection-pool SamplesJdbcPool."/>
    <antcall target="delete-jdbc-connection-pool">
      <param name="pool.name" value="SamplesJdbcPool" />
    </antcall>
 </target>

  <property environment="env" />
</project>

Other Java EE 6 examples (source code examples)

Here is a short list of links related to this Java EE 6 build.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.