<?xml version="1.0"?>
<project name="Petstore" default="core">
<property name="application.name" value="petstore"/>
<!-- =================================================================== -->
<!-- Variables -->
<!-- =================================================================== -->
<property name="home.dir" value="."/>
<property name="barkbank.home" value="${home.dir}/BarkBank"/>
<property name="petex.home" value="${home.dir}/PetEx"/>
<!-- <property name="yaps.home" value="${home.dir}/Yaps"/>-->
<property name="yaps.home" value="${home.dir}"/>
<property name="env.GLASSFISH_HOME" location="/Users/oliviersaint-eve/Documents/glassfish"/>
<!--YAPS Properties-->
<property name="yaps.build.dir" value="${yaps.home}/build"/>
<property name="yaps.config.dir" value="${yaps.home}/config"/>
<property name="yaps.src.dir" value="${yaps.home}/src"/>
<property name="yaps.web.dir" value="${yaps.home}/resources"/>
<property name="yaps.web-inf.dir" value="${yaps.home}/WebContent/WEB-INF"/>
<property name="yaps.generated.src.dir" value="${yaps.home}/generated"/>
<property name="yaps.classes.dir" value="${yaps.home}/classes/production"/>
<property name="yaps.lib.dir" value="${yaps.home}/lib"/>
<!--BarkBank Properties-->
<property name="barkbank.build.dir" value="${barkbank.home}/build"/>
<property name="barkbank.src.dir" value="${barkbank.home}/src"/>
<property name="barkbank.web.dir" value="${barkbank.home}/resources"/>
<property name="barkbank.web-inf.dir" value="${barkbank.home}/WEB-INF"/>
<property name="barkbank.generated.src.dir" value="${barkbank.home}/generated"/>
<property name="barkbank.classes.dir" value="${barkbank.home}/classes/production"/>
<!--PetEx Properties-->
<property name="petex.build.dir" value="${petex.home}/build"/>
<property name="petex.src.dir" value="${petex.home}/src"/>
<property name="petex.web.dir" value="${petex.home}/resources"/>
<property name="petex.web-inf.dir" value="${petex.home}/WEB-INF"/>
<property name="petex.generated.src.dir" value="${petex.home}/generated"/>
<property name="petex.classes.dir" value="${petex.home}/classes/production"/>
<!-- =================================================================== -->
<!-- Fichier -->
<!-- =================================================================== -->
<!--YAPS Files-->
<property name="yaps.client.jar" value="${yaps.build.dir}/${application.name}.jar"/>
<property name="yaps.utility.jar" value="${yaps.build.dir}/lib/utility.jar"/>
<property name="yaps.ws.jar" value="${yaps.build.dir}/lib/ws-interface.jar"/>
<property name="yaps.entity.jar" value="${yaps.build.dir}/lib/entity.jar"/>
<property name="yaps.mdb.jar" value="${yaps.build.dir}/mdb.jar"/>
<property name="yaps.stateless.jar" value="${yaps.build.dir}/stateless.jar"/>
<property name="yaps.stateful.jar" value="${yaps.build.dir}/stateful.jar"/>
<property name="yaps.war" value="${yaps.build.dir}/${application.name}.war"/>
<property name="yaps.ear" value="${yaps.build.dir}/${application.name}.ear"/>
<!--BarkBank Files-->
<property name="barkbank.war" value="${barkbank.build.dir}/barkbank.war"/>
<!--PetEx Files-->
<property name="petex.war" value="${petex.build.dir}/petex.war"/>
<!-- =================================================================== -->
<!-- Utilitaires -->
<!-- =================================================================== -->
<property environment="env"/>
<property name="glassfish.home" value="${env.GLASSFISH_HOME}"/>
<property name="glassfish.lib" value="${glassfish.home}/lib"/>
<property name="derby.home" value="${glassfish.home}/javadb"/>
<property name="derby.lib" value="${derby.home}/lib"/>
<property name="asadmin" value="${glassfish.home}/bin/asadmin"/>
<property name="wsgen" value="${glassfish.home}/bin/wsgen"/>
<property name="wsimport" value="${glassfish.home}/bin/wsimport"/>
<property name="echo" value="true"/>
<property name="verifier" value="${glassfish.home}/bin/verifier"/>
<property name="verifier.dir" value="${home.dir}/verifier"/>
<!--Glassfish Properties-->
<property name="server.user.name" value="admin"/>
<property name="server.passwordfile" value="passwordfile"/>
<property name="server.host" value="127.0.0.1"/>
<property name="server.port" value="1081"/>
<property name="server.admin.port" value="1049"/>
<!--Database Properties-->
<property name="db.host" value="127.0.0.1"/>
<property name="db.sid" value="${application.name}DB"/>
<property name="db.user" value="dbuser"/>
<property name="db.password" value="dbpwd"/>
<!--Derby-->
<property name="db.port" value="1527"/>
<property name="db.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="db.url" value="jdbc:derby://${db.host}:${db.port}/${db.sid}"/>
<!--MySQL-->
<!--
<property name="db.port" value="3306"/>
<property name="db.driver" value="com.mysql.jdbc.Driver"/>
<property name="db.url" value="jdbc:mysql://${db.host}:${db.port}/${db.sid}"/>
-->
<!-- =================================================================== -->
<!-- Check variable -->
<!-- =================================================================== -->
<target name="check">
<fail unless="env.GLASSFISH_HOME">
####
#### You must install GlassFish V2 from
https://glassfish.dev.java.net/publi...oadsindex.html
#### And set the GLASSFISH_HOME variable
</fail>
</target>
<!-- =================================================================== -->
<!-- Classes et Jars utiliser pour compiler et executer l'application -->
<!-- =================================================================== -->
<path id="classpath">
<pathelement location="${glassfish.lib}/appserv-deployment-client.jar"/>
<pathelement location="${glassfish.lib}/appserv-rt.jar"/>
<pathelement location="${glassfish.lib}/webservices-rt.jar"/>
<pathelement location="${glassfish.lib}/appserv-admin.jar"/>
<pathelement location="${glassfish.lib}/javaee.jar"/>
<pathelement location="${glassfish.lib}/toplink-essentials-agent.jar"/>
<pathelement location="${glassfish.lib}/toplink-essentials.jar"/>
<pathelement location="${glassfish.lib}/install/applications/jmsra/imqjmsra.jar"/>
<pathelement location="${glassfish.lib}/jigloo.jar"/>
<!--Derby-->
<pathelement location="${derby.lib}/derbyclient.jar"/>
<!--MySQL-->
<!--
<pathelement location="${glassfish.lib}/mysql-connector-java-5.1.7-bin.jar"/>
-->
</path>
<pathconvert pathsep="${line.separator}" property="convert.classpath" refid="classpath"/>
<path id="yaps-classpath">
<pathelement location="${yaps.classes.dir}"/>
<pathelement location="${yaps.lib.dir}/vstm-xscore-0.5.0.jar"/>
<pathelement location="${yaps.lib.dir}/commons-lang-2.3.jar"/>
</path>
<pathconvert pathsep="${line.separator}" property="convert.yaps-classpath" refid="yaps-classpath"/>
<path id="barkbank-classpath">
<pathelement location="${barkbank.classes.dir}"/>
</path>
<pathconvert pathsep="${line.separator}" property="convert.barkbank-classpath" refid="barkbank-classpath"/>
<path id="petex-classpath">
<pathelement location="${petex.classes.dir}"/>
</path>
<pathconvert pathsep="${line.separator}" property="convert.petex-classpath" refid="petex-classpath"/>
<!-- =================================================================== -->
<!-- Suppression des repertoires de travail -->
<!-- =================================================================== -->=================================================================== -->
<!-- Compile le code source -->
<!-- =================================================================== -->
<target name="compile" depends="prepare">
<antcall target="yaps-compile"/>
<antcall target="barkbank-compile"/>
<antcall target="petex-compile"/>
</target>
<!-- Compile YAPS -->
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<target name="yaps-compile" depends="yaps-prepare">
<echo message="Compile the YAPS generated classes"/>
<echo message="${convert.classpath}"/>
<echo message="${convert.yaps-classpath}"/>
<javac srcdir="${yaps.generated.src.dir}"
destdir="${yaps.classes.dir}"
deprecation="on">
<classpath refid="classpath"/>
<classpath refid="yaps-classpath"/>
</javac>
<echo message="Compile the YAPS classes"/>
<javac srcdir="${yaps.src.dir}"
destdir="${yaps.classes.dir}"
deprecation="on">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="classpath"/>
<classpath refid="yaps-classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Build -->
<!-- =================================================================== -->
<target name="build" depends="compile">
<antcall target="yaps-build"/>
<antcall target="barkbank-build"/>
<antcall target="petex-build"/>
</target>
<!-- Build YAPS -->
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<target name="yaps-build"
depends="yaps-compile,yaps-build-client-jar,yaps-build-stateless-jar,yaps-build-stateful-jar,yaps-build-mdb-jar,yaps-build-entity-jar,yaps-build-utility-jar,yaps-build-ws-jar,yaps-build-war,yaps-build-ear"/>
<target name="yaps-build-client-jar">
<echo message="Creates the Client jar"/>
<jar jarfile="${yaps.client.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/client/**/*.class"/>
<include name="com/yaps/petstore/entity/**/*.class"/>
<include name="com/yaps/petstore/util/**/*.class"/>
<include name="com/yaps/petstore/exception/**/*.class"/>
<include name="com/yaps/petstore/stateless/**/*Remote.class"/>
<include name="org/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-stateless-jar">
<echo message="Creates the EJB Stateless jar"/>
<jar jarfile="${yaps.stateless.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/stateless/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-stateful-jar">
<echo message="Creates the EJB Stateful jar"/>
<jar jarfile="${yaps.stateful.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/stateful/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-mdb-jar">
<echo message="Creates the EJB MDB jar"/>
<jar jarfile="${yaps.mdb.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/mdb/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-entity-jar">
<echo message="Creates the EJB Entity jar"/>
<jar jarfile="${yaps.entity.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/entity/**/*.class"/>
</fileset>
<fileset dir="${yaps.config.dir}">
<include name="META-INF/persistence.xml"/>
</fileset>
</jar>
</target>
<target name="yaps-build-utility-jar">
<echo message="Creates the Utility jar"/>
<jar jarfile="${yaps.utility.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/util/**/*.class"/>
<include name="com/yaps/petstore/exception/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-ws-jar">
<echo message="Creates the WebService jar"/>
<jar jarfile="${yaps.ws.jar}">
<fileset dir="${yaps.classes.dir}">
<include name="com/barkbank/**/*.class"/>
<include name="com/petex/**/*.class"/>
</fileset>
</jar>
</target>
<target name="yaps-build-war">
<echo message="Creates the PetStore Web Application"/>
<war destfile="${yaps.war}" webxml="${yaps.web-inf.dir}/web.xml">
<fileset dir="${yaps.web.dir}">
<include name="**/*.jsp"/>
<include name="**/*.jspf"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.css"/>
</fileset>
<webinf dir="${yaps.web-inf.dir}">
<include name="faces-config.xml"/>
</webinf>
<classes dir="${yaps.classes.dir}">
<include name="com/yaps/petstore/jsf/**/*.class"/>
</classes>
</war>
</target>
<target name="yaps-build-ear">
<echo message="Creates the PetStore Enterprise Application"/>
<delete file="${yaps.ear}"/>
<jar jarfile="${yaps.ear}" basedir="${yaps.build.dir}" excludes="${application.name}.jar"/>
</target>
<target name="yaps-build-debug">
<delete dir="${yaps.build.dir}"/>
<mkdir dir="${yaps.build.dir}/lib"/>
<antcall target="yaps-build-client-jar"/>
<antcall target="yaps-build-stateless-jar"/>
<antcall target="yaps-build-stateful-jar"/>
<antcall target="yaps-build-mdb-jar"/>
<antcall target="yaps-build-entity-jar"/>
<antcall target="yaps-build-utility-jar"/>
<antcall target="yaps-build-ws-jar"/>
<antcall target="yaps-build-war"/>
<antcall target="yaps-build-ear"/>
</target>
<!-- =================================================================== -->
<!-- Deploiement des Application -->
<!-- =================================================================== -->
<target name="deploy">
<antcall target="barkbank-build"/>
<antcall target="barkbank-deploy"/>
<antcall target="barkbank-generate-client-artifacts"/>
<antcall target="petex-build"/>
<antcall target="petex-deploy"/>
<antcall target="petex-generate-client-artifacts"/>
<antcall target="yaps-build"/>
<antcall target="yaps-deploy"/>
</target>
<!-- Deploy YAPS -->
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<target name="yaps-deploy" depends="check">
<echo message="Deploys the YAPS application"/>
<exec executable="${asadmin}">
<arg line="deploy"/>
<arg line=" --echo=${echo}"/>
<arg line=" --user ${server.user.name}"/>
<arg line=" --passwordfile ${server.passwordfile}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.admin.port}"/>
<arg line=" ${yaps.ear}"/>
</exec>
<antcall target="db-insert-data"/>
</target>
<!-- =================================================================== -->
<!-- Undeploiement des Application -->
<!-- =================================================================== -->
<target name="undeploy">
<antcall target="yaps-undeploy"/>
<antcall target="barkbank-undeploy"/>
<antcall target="petex-undeploy"/>
</target>
<!-- Undeploy YAPS -->
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<target name="yaps-undeploy" depends="check">
<echo message="Undeploys the YAPS application"/>
<exec executable="${asadmin}">
<arg line="undeploy"/>
<arg line=" --echo=${echo}"/>
<arg line=" --user ${server.user.name}"/>
<arg line=" --passwordfile ${server.passwordfile}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.admin.port}"/>
<arg line=" ${application.name}"/>
</exec>
</target>
<!-- =================================================================== -->
<!-- Verifie les applications -->
<!-- =================================================================== -->
<target name="verify">
<antcall target="yaps-verify"/>
<antcall target="barkbank-verify"/>
<antcall target="petex-verify"/>
</target>
<!-- Verifies YAPS -->
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<target name="yaps-verify" depends="check">
<mkdir dir="${verifier.dir}"/>
<exec executable="${verifier}">
<arg line=" -d ${verifier.dir}"/>
<arg line=" ${yaps.ear}"/>
</exec>
</target>
<!-- =================================================================== -->
<!-- Autres -->
<!-- =================================================================== -->
<target name="show" depends="check">
<exec executable="${asadmin}">
<arg line="show-component-status"/>
<arg line=" --echo=${echo}"/>
<arg line=" --user ${server.user.name}"/>
<arg line=" --passwordfile ${server.passwordfile}"/>
<arg line=" --host ${server.host}"/>
<arg line=" --port ${server.admin.port}"/>
<arg line=" ${application.name}"/>
</exec>
</target>
<!-- =================================================================== -->
<!-- Execute l'application cliente -->
<!-- =================================================================== -->
<target name="run-client" depends="yaps-compile,yaps-build-client-jar">
<echo message="Runs the client application"/>
<java classname="com.yaps.petstore.client.ui.PetstoreFrame" fork="yes" dir=".">
<classpath>
<pathelement location="${yaps.client.jar}"/>
<path refid="classpath"/>
<path refid="yaps-classpath"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Insere des donnees dans la base -->
<!-- =================================================================== -->
<target name="db-insert-data">
<sql src="${yaps.config.dir}/data.sql"
driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.password}">
<classpath refid="classpath"/>
</sql>
</target>
<!-- =================================================================== -->
<!-- Main -->
<!-- =================================================================== -->
<target name="core" depends="clean,build"/>
</project>
Partager