[Yanel-commits] rev 38121 - in
public/yanel/trunk/src/build/targets: .
continuous-integration webapp
michi at wyona.com
michi at wyona.com
Tue Aug 19 16:26:56 CEST 2008
Author: michi
Date: 2008-08-19 16:26:55 +0200 (Tue, 19 Aug 2008)
New Revision: 38121
Added:
public/yanel/trunk/src/build/targets/clean.xml
public/yanel/trunk/src/build/targets/cmdl.xml
public/yanel/trunk/src/build/targets/config.xml
public/yanel/trunk/src/build/targets/continuous-integration/
public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.properties
public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.xml
public/yanel/trunk/src/build/targets/javadoc.xml
public/yanel/trunk/src/build/targets/realms.xml
public/yanel/trunk/src/build/targets/resources.xml
public/yanel/trunk/src/build/targets/test.xml
public/yanel/trunk/src/build/targets/webapp/
public/yanel/trunk/src/build/targets/webapp/cluster.xml
public/yanel/trunk/src/build/targets/webapp/webapp.xml
Log:
thanks to Simon build targets refactored into dedicated files
Added: public/yanel/trunk/src/build/targets/clean.xml
===================================================================
--- public/yanel/trunk/src/build/targets/clean.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/clean.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+
+<project name="clean" default="clean" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="clean" description="Clean build" depends="init, clean-resources, clean-realms">
+ <echo>INFO: Clean build</echo>
+ <delete includeemptydirs="true">
+ <fileset dir="${build.dir}" excludes="logs/**, javadoc/**"/>
+ </delete>
+
+ <!-- Jetty target -->
+ <delete dir="${yanel.source.home}/src/build/target"/>
+
+ <condition property="yes-delete-tomcat-cluster-node1">
+ <and>
+ <isset property="tomcat1.home.dir"/>
+ <available file="${tomcat1.webapps.dir}/${servlet.context.prefix}" type="dir"/>
+ <istrue value="${force-clean}"/>
+ </and>
+ </condition>
+ <antcall target="do-clean-tomcat-cluster-node1"/>
+
+ <condition property="property-tomcat-cluster-node1-is-set">
+ <and>
+ <isset property="tomcat1.home.dir"/>
+ <available file="${tomcat1.webapps.dir}/${servlet.context.prefix}" type="dir"/>
+ </and>
+ </condition>
+ <antcall target="ask-to-clean-tomcat-cluster-node1"/>
+
+
+ <condition property="yes-delete-tomcat-cluster-node2">
+ <and>
+ <isset property="tomcat1.home.dir"/>
+ <available file="${tomcat1.webapps.dir}/${servlet.context.prefix}" type="dir"/>
+ <istrue value="${force-clean}"/>
+ </and>
+ </condition>
+ <antcall target="do-clean-tomcat-cluster-node2"/>
+
+ <condition property="property-tomcat-cluster-node2-is-set">
+ <and>
+ <isset property="tomcat2.home.dir"/>
+ <available file="${tomcat2.webapps.dir}/${servlet.context.prefix}" type="dir"/>
+ </and>
+ </condition>
+ <antcall target="ask-to-clean-tomcat-cluster-node2"/>
+ </target>
+
+ <target name="clean-all" description="Clean All (including local configuration!)" depends="init, clean">
+ <delete dir="${build.dir}"/>
+ <delete dir="${yanel.source.home}/local"/>
+
+ <!-- Jetty target -->
+ <delete dir="${yanel.source.home}/src/build/target"/>
+
+ <condition property="local.build.properties.exists">
+ <available file="${yanel.source.home}/src/build/local.build.properties" type="file"/>
+ </condition>
+ <antcall target="ask-if-local-build-properties-shall-be-deleted"/>
+
+ <condition property="local.config.dir.exists">
+ <available file="${yanel.source.home}/${local.config.dir}" type="dir"/>
+ </condition>
+ <antcall target="ask-if-local-config-dir-shall-be-deleted"/>
+ </target>
+
+ <target name="clean-resources" description="Clean resources" depends="generate-resources-build">
+ <ant antfile="${yanel.source.home}/build/build-resource-types.xml" target="clean-resources"/>
+ </target>
+
+ <target name="clean-realms" description="Clean realms" depends="generate-realms-build">
+ <ant antfile="${yanel.source.home}/build/build-realms.xml" target="clean-realms"/>
+ </target>
+
+ <target name="ask-if-local-build-properties-shall-be-deleted" if="local.build.properties.exists">
+ <input message="Do you really want to delete local build.properties file '${yanel.source.home}/src/build/local.build.properties'? (yes/NO):" addproperty="answer"/>
+ <condition property="yes-delete-local-build-properties">
+ <equals arg1="yes" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-delete-local-build-properties"/>
+ </target>
+
+ <target name="do-delete-local-build-properties" if="yes-delete-local-build-properties">
+ <delete file="${yanel.source.home}/src/build/local.build.properties"/>
+ </target>
+
+ <target name="ask-if-local-config-dir-shall-be-deleted" if="local.config.dir.exists">
+ <input message="Do you really want to delete local config dir '${yanel.source.home}/${local.config.dir}'? (yes/NO):" addproperty="answer"/>
+ <condition property="yes-delete-local-config-dir">
+ <equals arg1="yes" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-delete-local-config-dir"/>
+ </target>
+
+ <target name="do-delete-local-config-dir" if="yes-delete-local-config-dir">
+ <delete dir="${yanel.source.home}/${local.config.dir}"/>
+ </target>
+
+</project>
Added: public/yanel/trunk/src/build/targets/cmdl.xml
===================================================================
--- public/yanel/trunk/src/build/targets/cmdl.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/cmdl.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+
+<project name="cmdl" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="run-yanel-cmdl" description="Run command line tool" depends="init-runtime">
+ <echo>Yanel Path: ${yanel.path}</echo>
+ <!--
+ <exec executable="java">
+ <arg line="-classpath ${run.cp} org.wyona.yanel.cmdl.YanelCommandLine"/>
+ </exec>
+ -->
+ <java classname="org.wyona.yanel.cmdl.YanelCommandLine">
+ <classpath refid="classpath.run.cmdl"/>
+ <arg value="${yanel.path}"/>
+ <!-- On Linux, Java 1.4.2 needs this sysproperty whereas on Mac OS X it doesn't seem to be necessary -->
+ <sysproperty key="org.xml.sax.driver" value="org.apache.xerces.parsers.SAXParser"/>
+ </java>
+ </target>
+
+ <target name="init-runtime" description="Initialize all parameters and other settings for runtime" depends="init, dependencies">
+<!--
+ <target name="init-runtime" description="Initialize all parameters and other settings for runtime" depends="webapp">
+-->
+
+ <path id="classpath.run.cmdl">
+ <!-- Properties files -->
+ <pathelement path="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/classes"/>
+
+ <!-- All from source generated libs -->
+ <fileset dir="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib">
+ <include name="*.jar"/>
+ </fileset>
+
+ <!-- All external dependencies -->
+ <pathelement path="${maven2.cp}"/>
+ <pathelement path="${maven2.compile.cp}"/>
+ </path>
+ <property name="run.cp" refid="classpath.run.cmdl"/>
+<!--
+ <echo>Classpath to run yanel cmdl: ${run.cp}</echo>
+-->
+ </target>
+
+ <target name="compile-cmdl" description="Compile Java classes of Yanel command line" depends="init, compile-core, set-cmdl-classpath">
+ <!--
+ TODO: This target is never called
+ -->
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${yanel.source.home}/src/core/java/org/wyona/yanel/cmdl" destdir="${classes.dir}"
+ debug="true"
+ classpathref="classpath.cmdl"
+ />
+ <mkdir dir="${yanel.source.home}/build/lib"/>
+ <jar destfile="${yanel.source.home}/build/lib/yanel-cmdl-${yanel.version}-r${yanel.revision}.jar"
+ basedir="${classes.dir}"
+ includes="org/wyona/yanel/cmdl/**"/>
+ <copy file="${yanel.source.home}/src/build/pom-cmdl.xml" tofile="${yanel.source.home}/build/lib/pom-cmdl.xml"/>
+ <replace file="${yanel.source.home}/build/lib/pom-cmdl.xml" value="${yanel.version}-r${yanel.revision}">
+ <replacetoken>@VERSION@</replacetoken>
+ </replace>
+
+ <artifact:pom id="cmdl.project" file="${yanel.source.home}/build/lib/pom-cmdl.xml"/>
+ <artifact:install file="${yanel.source.home}/build/lib/yanel-cmdl-${yanel.version}-r${yanel.revision}.jar">
+ <pom refid="cmdl.project"/>
+ </artifact:install>
+ </target>
+
+ <target name="set-cmdl-classpath" description="Set classpath" depends="init, dependencies">
+ <echo>INFO: Set classpath ...</echo>
+
+ <path id="classpath.cmdl">
+ <pathelement path="${maven2.cp}"/>
+ <pathelement path="${maven2.compile.cp}"/>
+ </path>
+ </target>
+
+</project>
\ No newline at end of file
Added: public/yanel/trunk/src/build/targets/config.xml
===================================================================
--- public/yanel/trunk/src/build/targets/config.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/config.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+
+<project name="config" default="config" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="config" description="Initialize all local properties files" depends="init">
+ <condition property="local.build.properties.does.not.exist.yet">
+ <not>
+ <available file="local.build.properties" type="file"/>
+ </not>
+ </condition>
+ <antcall target="create-local-build-properties"/>
+
+ <!-- Reload local.build.properties -->
+ <property file="local.build.properties"/>
+
+ <fail message="No such directory: ${tomcat1.home.dir}! You might have to delete src/build/local.build.properties and re-run configure.">
+ <condition>
+ <and>
+ <isset property="tomcat1.home.dir"/>
+ <not><available file="${tomcat1.home.dir}" type="dir"/></not>
+ </and>
+ </condition>
+ </fail>
+
+<!--
+ <echo>Tomcat Ports: ${tomcat1.ssl.port}, ${tomcat1.http.port}</echo>
+-->
+
+ <condition property="isTomcat1PortsSet">
+ <and>
+ <isset property="tomcat1.ssl.port"/>
+ <isset property="tomcat1.http.port"/>
+ </and>
+ </condition>
+ <antcall target="ask-to-reconfigure-tomcat-cluster-node1"/>
+
+ <condition property="isTomcat2HomeSet">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <antcall target="ask-to-reconfigure-tomcat-cluster-node2"/>
+
+ <antcall target="first-time-user-configuration-message"/>
+ <input message="Do you want to continue the configuration nevertheless? (yes/NO)" addproperty="answer" defaultvalue="NO"/>
+
+ <condition property="yes.continue">
+ <equals arg1="yes" arg2="${answer}"/>
+ </condition>
+ <antcall target="configure-local"/>
+ </target>
+
+ <target name="first-time-user-configuration-message">
+ <echo>#################################################################################</echo>
+ <echo># As a first time user one does NOT have to configure anything any further, but #</echo>
+ <echo># rather exit here and just run build.sh on UNIX resp. build.bat on Windows! #</echo>
+ <echo>#################################################################################</echo>
+ </target>
+
+ <target name="create-local-build-properties" if="local.build.properties.does.not.exist.yet" depends="init">
+ <echo>Build configuration ${yanel.source.home}/local.build.properties does not exist yet!</echo>
+
+ <input message="Do you have an existing Tomcat instance which you want to use as servlet engine for Yanel? If so, please enter the path of your Tomcat instance (e.g. /home/yanel/jakarta-tomcat-5.0.30). IMPORTANT NOTE (especially for Windows): Please use '/' instead of '\' in the Tomcat path. Otherwise just hit return (recommended to first time users :-) and Tomcat ${tomcat.version} will be installed at ${default.tomcat.home.dir}. (You will always be able to change this setting at some later time within src/build/local.build.properties): " defaultvalue="${default.tomcat.home.dir.forward.slashes}" addproperty="pathOfUserSpecificTomcat"/>
+
+ <echo>User specific Tomcat: ${pathOfUserSpecificTomcat}</echo>
+
+ <copy file="${yanel.source.home}/src/build/build.properties" tofile="${yanel.source.home}/src/build/local.build.properties" overwrite="false"/>
+ <replace file="${yanel.source.home}/src/build/local.build.properties" value="tomcat1.home.dir=${pathOfUserSpecificTomcat}">
+ <replacetoken>#tomcat1.home.dir=../tomcat-cluster/build/jakarta-tomcat-5.0.30-cnode1</replacetoken>
+ </replace>
+
+ <condition property="yes.install.default.tomcat">
+ <equals arg1="${pathOfUserSpecificTomcat}" arg2="${default.tomcat.home.dir.forward.slashes}"/>
+ </condition>
+
+ <antcall target="install-default-tomcat"/>
+ </target>
+
+ <target name="configure-local" if="yes.continue">
+ <echo>Will now create local properties files if these do not exist.</echo>
+
+ <mkdir dir="${yanel.source.home}/${local.config.dir}"/>
+
+ <copy file="${yanel.source.home}/conf/yanel.xml" tofile="${yanel.source.home}/${local.config.dir}/local.yanel.xml" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/realms.xml" tofile="${yanel.source.home}/${local.config.dir}/local.realms.xml" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/resource-types.xml" tofile="${yanel.source.home}/${local.config.dir}/local.resource-types.xml" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/log4j.properties" tofile="${yanel.source.home}/${local.config.dir}/local.log4j.properties" overwrite="false"/>
+
+ <echo>Customize the ${local.config.dir}/local.* files and run build.sh OR run build.sh first and then customize the config files within build/webapps/yanel/WEB-INF/classes</echo>
+ </target>
+
+</project>
Added: public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.properties
===================================================================
--- public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.properties (rev 0)
+++ public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.properties 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,8 @@
+#tomcat ip
+tomcat.ip=127.0.0.1
+
+#tomcat port
+tomcat.port=8080
+
+#DOCUMENT ROOT of apache http to serve a page if tomcat is stoped while cruiscontrol is building
+document.root=/var/www
Added: public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.xml
===================================================================
--- public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/continuous-integration/continuous-integration.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+
+<project name="yanel-continuous-integration" default="continuous-integration" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+ <description>Yanel Build for Continuous Integration</description>
+
+ <!-- This is file is imported by ../../build.xml and hence resolved relative to ../../build.xml -->
+ <property file="targets/continuous-integration/local.continuous-integration.properties"/>
+ <property file="targets/continuous-integration/continuous-integration.properties"/>
+
+ <target name="continuous-integration">
+ <echo>Cleaning Yanel</echo>
+ <antcall target="clean"/>
+ <echo>Deploying Yanel</echo>
+ <antcall target="deploy"/>
+ </target>
+
+ <target name="start-tomcat" description="starts tomcat">
+ <condition property="isWindows">
+ <os family="windows"/>
+ </condition>
+ <condition property="isUnix">
+ <os family="unix"/>
+ </condition>
+ <antcall target="startup-tomcat-windows"/>
+ <antcall target="startup-tomcat-unix"/>
+ <waitfor maxwait="60" maxwaitunit="second" checkevery="4000">
+ <and>
+ <socket server="${tomcat.ip}" port="${tomcat.port}"/>
+ </and>
+ </waitfor>
+ <echo message="*****************************************************************"/>
+ <echo message="*"/>
+ <echo message="* You have successfully started Yanel ${yanel.version} (Revision ${yanel.revision})"/>
+ <echo message="*"/>
+ <echo message="*"/>
+ <echo message="* Start you Browser and visit"/>
+ <echo message="*"/>
+ <echo message="* http://127.0.0.1:8080/${servlet.context.prefix}/"/>
+ <echo message="*"/>
+ <echo message="* Thanks for using Yanel"/>
+ <echo message="*"/>
+ <echo message="*****************************************************************"/>
+ <available file="${document.root}/cruise_is_building.html" property="cruise_is_building_html_available"/>
+ <antcall target="delete-building-hint"/>
+ </target>
+
+ <target name="startup-tomcat-windows" if="isWindows">
+ <condition property="isTomcat1HomeSet">
+ <isset property="tomcat1.home.dir"/>
+ </condition>
+ <antcall target="startup-tomcat-windows-node1"/>
+ <condition property="isTomcat2HomeSet">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <antcall target="startup-tomcat-windows-node2"/>
+ </target>
+
+ <target name="startup-tomcat-unix" if="isUnix">
+ <condition property="isTomcat1HomeSet">
+ <isset property="tomcat1.home.dir"/>
+ </condition>
+ <antcall target="startup-tomcat-unix-node1"/>
+ <condition property="isTomcat2HomeSet">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <antcall target="startup-tomcat-unix-node2"/>
+ </target>
+
+
+ <target name="startup-tomcat-windows-node1" if="isTomcat1HomeSet">
+ <echo>Startup Tomcat Cluster Node 1: ${tomcat1.home.dir}/bin/startup.bat</echo>
+ <!-- NOTE: Spawn is true because otherwise the batch script will not continue beyond this call (This is only necessary for Windows) -->
+ <exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="startup.bat" spawn="true"/>
+ </target>
+ <target name="startup-tomcat-unix-node1" if="isTomcat1HomeSet">
+ <echo>Starting Tomcat (${tomcat1.home.dir}/bin/startup.sh) ...</echo>
+ <chmod dir="${tomcat1.home.dir}/bin" perm="755" includes="*"/>
+ <exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="startup.sh" spawn="false"/>
+ </target>
+ <target name="startup-tomcat-windows-node2" if="isTomcat2HomeSet">
+ <echo>Startup Tomcat Cluster Node 2: ${tomcat2.home.dir}/bin/startup.bat</echo>
+ <!-- NOTE: Spawn is true because otherwise the batch script will not continue beyond this call (This is only necessary for Windows) -->
+ <exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="startup.bat" spawn="true"/>
+ </target>
+ <target name="startup-tomcat-unix-node2" if="isTomcat2HomeSet">
+ <echo>Starting Tomcat (${tomcat2.home.dir}/bin/startup.sh) ...</echo>
+ <chmod dir="${tomcat2.home.dir}/bin" perm="755" includes="*"/>
+ <exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="startup.sh" spawn="false"/>
+ </target>
+
+ <target name="stop-tomcat" description="stops tomcat">
+ <available file="${document.root}/cruise_is_building.html.orig" property="cruise_is_building_html_orig_available"/>
+ <antcall target="copy-building-hint"/>
+ <condition property="isWindows">
+ <os family="windows"/>
+ </condition>
+ <condition property="isUnix">
+ <os family="unix"/>
+ </condition>
+ <antcall target="shutdown-tomcat-windows"/>
+ <antcall target="shutdown-tomcat-unix"/>
+ <echo message="*****************************************************************"/>
+ <echo message="*"/>
+ <echo message="* You have successfully stopped Yanel ${yanel.version} (Revision ${yanel.revision})"/>
+ <echo message="*"/>
+ <echo message="* Thanks for using Yanel"/>
+ <echo message="*"/>
+ <echo message="*****************************************************************"/>
+ </target>
+
+ <target name="shutdown-tomcat-windows" if="isWindows">
+ <echo>Windows ...</echo>
+ <condition property="isTomcat1HomeSet">
+ <isset property="tomcat1.home.dir"/>
+ </condition>
+ <antcall target="shutdown-tomcat-windows-node1"/>
+ <condition property="isTomcat2HomeSet">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <antcall target="shutdown-tomcat-windows-node2"/>
+ </target>
+
+ <target name="shutdown-tomcat-unix" if="isUnix">
+ <echo>Unix ...</echo>
+ <condition property="isTomcat1HomeSet">
+ <isset property="tomcat1.home.dir"/>
+ </condition>
+ <antcall target="shutdown-tomcat-unix-node1"/>
+ <condition property="isTomcat2HomeSet">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <antcall target="shutdown-tomcat-unix-node2"/>
+ </target>
+
+
+ <target name="shutdown-tomcat-windows-node1" if="isTomcat1HomeSet">
+ <exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="shutdown.bat" spawn="false"/>
+ </target>
+ <target name="shutdown-tomcat-unix-node1" if="isTomcat1HomeSet">
+ <echo>Shutdown Tomcat (${tomcat1.home.dir}/bin/shutdown.sh) ...</echo>
+ <chmod dir="${tomcat1.home.dir}/bin" perm="755" includes="*"/>
+ <exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="shutdown.sh" spawn="false"/>
+ </target>
+ <target name="shutdown-tomcat-windows-node2" if="isTomcat2HomeSet">
+ <exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="shutdown.bat" spawn="false"/>
+ </target>
+ <target name="shutdown-tomcat-unix-node2" if="isTomcat2HomeSet">
+ <echo>Shutdown Tomcat (${tomcat2.home.dir}/bin/shutdown.sh) ...</echo>
+ <chmod dir="${tomcat2.home.dir}/bin" perm="755" includes="*"/>
+ <exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="shutdown.sh" spawn="false"/>
+ </target>
+
+ <target name="copy-building-hint" if="cruise_is_building_html_orig_available" description="copy a message to the httpd saying yanel is stoped and building">
+ <copy file="${document.root}/cruise_is_building.html.orig" tofile="${document.root}/cruise_is_building.html"/>
+ </target>
+
+ <target name="delete-building-hint" if="cruise_is_building_html_available" description="removes the message from the httpd saying yanel is stoped and building">
+ <delete file="${document.root}/cruise_is_building.html"/>
+ </target>
+</project>
Added: public/yanel/trunk/src/build/targets/javadoc.xml
===================================================================
--- public/yanel/trunk/src/build/targets/javadoc.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/javadoc.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+<project name="javadoc" default="javadoc" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+<target name="javadoc" description="Generate Javadoc" depends="init,set-javadoc-classpath" if="javadoc-does-not-exist-yet">
+ <mkdir dir="${build.dir}/javadoc"/>
+ <javadoc
+ packagenames="org.*"
+ destdir="${yanel.source.home}/build/javadoc"
+ classpathref="classpath.javadoc"
+ >
+ <fileset dir="${yanel.source.home}/src/" defaultexcludes="yes">
+ <include name="impl/java/**"/>
+ <include name="core/java/**"/>
+ <include name="resources/*/src/java/**"/>
+ <include name="realms/*/src/java/**"/>
+ <exclude name="**/README.txt"/>
+ </fileset>
+
+ </javadoc>
+ <echo/>
+ <echo/>
+ <echo>You should find the javadoc under: ${build.dir}/javadoc/index.html</echo>
+ </target>
+
+ <target name="generate-javadoc" description="Generate Javadoc" depends="init">
+ <condition property="javadoc-does-not-exist-yet">
+ <not>
+ <available file="${build.dir}/javadoc" type="dir"/>
+ </not>
+ </condition>
+ <antcall target="javadoc"/>
+ <antcall target="javadoc-exisits"/>
+ </target>
+
+ <target name="javadoc-exisits" unless="javadoc-does-not-exist-yet">
+ <echo/>
+ <echo/>
+ <echo>The Javadoc already exisits. You should find it under: ${build.dir}/javadoc/index.html</echo>
+ </target>
+
+ <target name="set-javadoc-classpath" description="Set javadoc classpath" depends="init, dependencies">
+ <!-- TODO: This seems never to be used -->
+ <path id="classpath.javadoc">
+ <pathelement path="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/classes"/>
+
+ <fileset dir="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib">
+ <include name="*.jar"/>
+ </fileset>
+
+ <pathelement path="${maven2.cp}"/>
+ <pathelement path="${maven2.compile.cp}"/>
+ </path>
+ <property name="javadoc.cp" refid="classpath.javadoc"/>
+ <echo>INFO: Classpath to generate Javadoc: ${javadoc.cp}</echo>
+ </target>
+
+</project>
Added: public/yanel/trunk/src/build/targets/realms.xml
===================================================================
--- public/yanel/trunk/src/build/targets/realms.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/realms.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+
+<project name="realms" default="realms" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="deploy-libs-of-realms" description="Deploy libraries of realms" depends="generate-realms-build">
+ <ant antfile="${yanel.source.home}/build/build-realms.xml" target="deploy-realms"/>
+ </target>
+
+ <!-- Build Realms -->
+ <target name="build-realms" description="Build realms" depends="generate-realms-build">
+ <ant antfile="${yanel.source.home}/build/build-realms.xml" target="build-realms"/>
+ <ant antfile="${yanel.source.home}/build/build-realms.xml" target="copy-dependencies"/>
+ </target>
+
+ <target name="generate-realms-build" description="Generate realms build" depends="init">
+ <condition property="local.realms.config.exists">
+ <available file="${yanel.source.home}/${local.config.dir}/local.realms.xml" type="file"/>
+ </condition>
+ <antcall target="generate-realms-build-from-default"/>
+ <antcall target="generate-realms-build-from-local"/>
+ </target>
+
+ <target name="generate-realms-build-from-default" description="Generate realms build from default config" depends="init" unless="local.realms.config.exists">
+ <xslt in="${yanel.source.home}/conf/realms.xml" out="../../build/build-realms.xml" style="yanel2realms.xsl" force="false">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.source.version" expression="${yanel.version}-r${yanel.revision}"/>
+ <param name="maven.url" expression="${maven.url}"/>
+ </xslt>
+ <replace file="../../build/build-realms.xml" value="${yanel.source.home.forward.slashes}/src/realms">
+ <replacetoken>@REALMS_DIR@</replacetoken>
+ </replace>
+ </target>
+
+ <target name="generate-realms-build-from-local" description="Generate realms build from local config" depends="init" if="local.realms.config.exists">
+ <xslt in="${yanel.source.home}/${local.config.dir}/local.realms.xml" out="../../build/build-realms.xml" style="yanel2realms.xsl" force="true">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.source.version" expression="${yanel.version}-r${yanel.revision}"/>
+ <param name="maven.url" expression="${maven.url}"/>
+ </xslt>
+ <replace file="../../build/build-realms.xml" value="${yanel.source.home.forward.slashes}/src/realms">
+ <replacetoken>@REALMS_DIR@</replacetoken>
+ </replace>
+ </target>
+
+</project>
\ No newline at end of file
Added: public/yanel/trunk/src/build/targets/resources.xml
===================================================================
--- public/yanel/trunk/src/build/targets/resources.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/resources.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<project name="resources" default="deploy-resources" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="generate-resources-build" description="Generate resources build" depends="init">
+ <echo>INFO: Generate build file to build resources</echo>
+ <condition property="local.resource-types.config.exists">
+ <available file="${yanel.source.home}/${local.config.dir}/local.resource-types.xml" type="file"/>
+ </condition>
+ <antcall target="generate-resources-build-from-default"/>
+ <antcall target="generate-resources-build-from-local"/>
+
+ <replace file="../../build/build-resource-types.xml" value="${yanel.source.home.forward.slashes}">
+ <replacetoken>@YANEL_SRC_DIR@</replacetoken>
+ </replace>
+ </target>
+
+ <target name="generate-resources-build-from-default" description="Generate resources build from default config" depends="init" unless="local.resource-types.config.exists">
+ <xslt in="${yanel.source.home}/conf/resource-types.xml" out="../../build/build-resource-types.xml" style="yanel2resources.xsl" force="false">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.source.version" expression="${yanel.version}-r${yanel.revision}"/>
+ <param name="maven.url" expression="${maven.url}"/>
+ </xslt>
+ </target>
+
+ <target name="generate-resources-build-from-local" description="Generate resources build from local config" depends="init" if="local.resource-types.config.exists">
+ <xslt in="${yanel.source.home}/${local.config.dir}/local.resource-types.xml" out="../../build/build-resource-types.xml" style="yanel2resources.xsl" force="true">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.source.version" expression="${yanel.version}-r${yanel.revision}"/>
+ <param name="maven.url" expression="${maven.url}"/>
+ </xslt>
+ </target>
+
+ <target name="build-resources" description="Build resources" depends="generate-resources-build">
+ <ant antfile="${yanel.source.home}/build/build-resource-types.xml" target="build-resources"/>
+ </target>
+
+ <target name="deploy-resources" description="Deploy resources" depends="generate-resources-build">
+
+ <!-- TODO: Seems to copy global i18n files, but has nothing to do with resources. -->
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/">
+ <fileset dir="." casesensitive="yes">
+ <include name="global_*.properties"/>
+ </fileset>
+ </copy>
+
+ <ant antfile="${yanel.source.home}/build/build-resource-types.xml" target="deploy-resources"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: public/yanel/trunk/src/build/targets/test.xml
===================================================================
--- public/yanel/trunk/src/build/targets/test.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/test.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<project name="test" default="test" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="test" description="Run tests">
+ <ant dir="../test" target="test" inheritall="false"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: public/yanel/trunk/src/build/targets/webapp/cluster.xml
===================================================================
--- public/yanel/trunk/src/build/targets/webapp/cluster.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/webapp/cluster.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,306 @@
+<?xml version="1.0"?>
+
+<project name="cluster" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="deploy-to-tomcat-cluster-node1" if="property-tomcat-cluster-node1-is-set" description="Deploy webapp to Tomcat cluster node 1">
+ <echo>Copy webapp (${tomcat1.webapps.dir}):</echo>
+
+ <fail message="No such directory: ${tomcat1.webapps.dir}">
+ <condition><not><available file="${tomcat1.webapps.dir}"/></not></condition>
+ </fail>
+
+ <copy todir="${tomcat1.webapps.dir}/${servlet.context.prefix}">
+ <fileset dir="${yanel.source.home}/build/webapps/${servlet.context.prefix}"/>
+ </copy>
+
+ <replace file="${tomcat1.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="log4j-cnode1.log">
+ <replacetoken>log4j-cmdl.log</replacetoken>
+ </replace>
+ <touch file="${log4j.path}/log4j-cnode1.log"/>
+
+ <antcall target="patch-tomcat-cluster-node-1-ssl-port"/>
+
+ <condition property="endorsed-xerces-at-node1-does-not-exist-yet">
+ <not>
+ <available file="${tomcat1.home.dir}/common/endorsed/${xerces.impl.artifactId}-${xerces.impl.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xerces-to-node1"/>
+
+ <condition property="ask-to-copy-endorsed-xml-apis-to-node1">
+ <not>
+ <available file="${tomcat1.home.dir}/common/endorsed/${xml.apis.artifactId}-${xml.apis.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xml-apis-to-node1"/>
+
+ <condition property="endorsed-xalan-at-node1-does-not-exist-yet">
+ <not>
+ <available file="${tomcat1.home.dir}/common/endorsed/${xalan.artifactId}-${xalan.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xalan-to-node1"/>
+
+ </target>
+
+ <target name="patch-tomcat-cluster-node-1-ssl-port" if="property-tomcat1-ssl-port-is-set">
+ <echo>ssl port for tomcat is set</echo>
+ <xslt in="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml"
+ out="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml.tmp"
+ style="add-ssl-port.xsl">
+ <param name="ssl-port" expression="${tomcat1.ssl.port}"/>
+ </xslt>
+ <move file="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml.tmp" tofile="${tomcat1.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml"/>
+ </target>
+
+ <target name="patch-tomcat-cluster-node-2-ssl-port" if="property-tomcat2-ssl-port-is-set">
+ <xslt in="${tomcat2.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml"
+ out="${tomcat2.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml.tmp"
+ style="add-ssl-port.xsl">
+ <param name="ssl-port" expression="${tomcat2.ssl.port}"/>
+ </xslt>
+ <move file="${tomcat2.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml.tmp" tofile="${tomcat2.home.dir}/webapps/${servlet.context.prefix}/WEB-INF/web.xml"/>
+ </target>
+
+
+ <target name="deploy-to-tomcat-cluster-node2" if="property-tomcat-cluster-node2-is-set" description="Deploy webapp to Tomcat cluster node 2">
+ <echo>Copy webapp (${tomcat2.webapps.dir}):</echo>
+
+ <fail message="No such directory: ${tomcat2.webapps.dir}">
+ <condition><not><available file="${tomcat2.webapps.dir}"/></not></condition>
+ </fail>
+
+ <copy todir="${tomcat2.webapps.dir}/${servlet.context.prefix}">
+ <fileset dir="${yanel.source.home}/build/webapps/${servlet.context.prefix}"/>
+ </copy>
+
+ <replace file="${tomcat2.webapps.dir}/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="log4j-cnode2.log">
+ <replacetoken>log4j-cmdl.log</replacetoken>
+ </replace>
+ <touch file="${log4j.path}/log4j-cnode2.log"/>
+
+ <antcall target="patch-tomcat-cluster-node-2-ssl-port"/>
+
+ <condition property="endorsed-xerces-at-node2-does-not-exist-yet">
+ <not>
+ <available file="${tomcat2.home.dir}/common/endorsed/${xerces.impl.artifactId}-${xerces.impl.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xerces-node2"/>
+
+ <condition property="ask-to-copy-endorsed-xml-apis-node2">
+ <not>
+ <available file="${tomcat2.home.dir}/common/endorsed/${xml.apis.artifactId}-${xml.apis.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xml-apis-node2"/>
+
+ <condition property="endorsed-xalan-at-node2-does-not-exist-yet">
+ <not>
+ <available file="${tomcat2.home.dir}/common/endorsed/${xalan.artifactId}-${xalan.version}.jar"/>
+ </not>
+ </condition>
+ <antcall target="ask-to-copy-endorsed-xalan-to-node2"/>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xerces-to-node1" if="endorsed-xerces-at-node1-does-not-exist-yet">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xerces library at '${tomcat1.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat1.home.dir}/common/endorsed/${xerces.impl.artifactId}-${xerces.impl.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xerces-to-node1">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-copy-endorsed-xerces-to-node1"/>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xml-apis-to-node1" if="ask-to-copy-endorsed-xml-apis-to-node1">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xml api library at '${tomcat1.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat1.home.dir}/common/endorsed/${xml.apis.artifactId}-${xml.apis.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xml-apis-to-node1">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-copy-endorsed-xml-apis-to-node1"/>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xalan-to-node1" if="endorsed-xalan-at-node1-does-not-exist-yet">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xalan library at '${tomcat1.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat1.home.dir}/common/endorsed/${xalan.artifactId}-${xalan.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xalan-to-node1">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-copy-endorsed-xalan-to-node1"/>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xalan-to-node2" if="endorsed-xalan-at-node2-does-not-exist-yet">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xalan library at '${tomcat2.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat2.home.dir}/common/endorsed/${xalan.artifactId}-${xalan.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xalan-to-node2">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-copy-endorsed-xalan-to-node2"/>
+ </target>
+
+ <target name="do-copy-endorsed-xerces-to-node1" unless="do-not-copy-endorsed-xerces-to-node1">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xerces.impl.artifactId}-${xerces.impl.version}.jar" todir="${tomcat1.home.dir}/common/endorsed" overwrite="false"/>
+ </target>
+
+ <target name="do-copy-endorsed-xml-apis-to-node1" unless="do-not-copy-endorsed-xml-apis-to-node1">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xml.apis.artifactId}-${xml.apis.version}.jar" todir="${tomcat1.home.dir}/common/endorsed" overwrite="false"/>
+ </target>
+
+ <target name="do-copy-endorsed-xalan-to-node1" unless="do-not-copy-endorsed-xalan-to-node1">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xalan.artifactId}-${xalan.version}.jar" todir="${tomcat1.home.dir}/common/endorsed" overwrite="false"/>
+ </target>
+
+ <target name="do-copy-endorsed-xalan-to-node2" unless="do-not-copy-endorsed-xalan-to-node2">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xalan.artifactId}-${xalan.version}.jar" todir="${tomcat2.home.dir}/common/endorsed" overwrite="false"/>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xerces-node2" if="endorsed-xerces-at-node2-does-not-exist-yet">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xerces library at '${tomcat2.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat2.home.dir}/common/endorsed/${xerces.impl.artifactId}-${xerces.impl.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xerces-to-node2">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+
+ <antcall target="do-copy-endorsed-xerces-to-node2"/>
+ </target>
+
+ <target name="do-copy-endorsed-xerces-to-node2" unless="do-not-copy-endorsed-xerces-to-node2">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xerces.impl.artifactId}-${xerces.impl.version}.jar" todir="${tomcat2.home.dir}/common/endorsed" overwrite="false"/>
+ <echo>INFO: ${xerces.impl.artifactId}-${xerces.impl.version}.jar has been copied!</echo>
+ </target>
+
+ <target name="ask-to-copy-endorsed-xml-apis-node2" if="ask-to-copy-endorsed-xml-apis-node2">
+ <echo>IMPORTANT: Please note that your Tomcat might already contain an endorsed xml api library at '${tomcat2.home.dir}/common/endorsed/'. Please make sure to resolve any conflicts!</echo>
+ <input message="Endorsed lib is missing (${tomcat2.home.dir}/common/endorsed/${xml.apis.artifactId}-${xml.apis.version}.jar). Do you want it to be added? (YES/no):" addproperty="answer"/>
+ <condition property="do-not-copy-endorsed-xml-apis-to-node2">
+ <equals arg1="no" arg2="${answer}"/>
+ </condition>
+
+ <antcall target="do-copy-endorsed-xml-apis-to-node2"/>
+ </target>
+
+ <target name="do-copy-endorsed-xml-apis-to-node2" unless="do-not-copy-endorsed-xml-apis-to-node2">
+ <copy file="${yanel.source.home}/build/webapps/${servlet.context.prefix}/WEB-INF/lib/${xml.apis.artifactId}-${xml.apis.version}.jar" todir="${tomcat2.home.dir}/common/endorsed" overwrite="false"/>
+ <echo>INFO: ${xml.apis.artifactId}-${xml.apis.version}.jar has been copied!</echo>
+ </target>
+
+ <target name="ask-to-clean-tomcat-cluster-node1" if="property-tomcat-cluster-node1-is-set" description="Clean Tomcat cluster node 1">
+ <input message="Do you really want to delete your deployed (maybe productive) Yanel version at '${tomcat1.webapps.dir}/${servlet.context.prefix}'? (yes/NO):" addproperty="answer"/>
+ <condition property="yes-delete-tomcat-cluster-node1">
+ <equals arg1="yes" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-clean-tomcat-cluster-node1"/>
+ </target>
+
+ <target name="do-clean-tomcat-cluster-node1" if="yes-delete-tomcat-cluster-node1" description="Clean Tomcat cluster node 1">
+ <echo>Clean Tomcat cluster node 1:</echo>
+
+ <fail message="No such directory: ${tomcat1.webapps.dir}">
+ <condition><not><available file="${tomcat1.webapps.dir}"/></not></condition>
+ </fail>
+
+ <delete dir="${tomcat1.webapps.dir}/${servlet.context.prefix}"/>
+ <delete dir="${tomcat1.work.dir}/${servlet.context.prefix}"/>
+ </target>
+
+ <target name="ask-to-clean-tomcat-cluster-node2" if="property-tomcat-cluster-node2-is-set" description="Clean Tomcat cluster node 2">
+ <input message="Do you really want to delete your deployed (maybe productive) Yanel version at '${tomcat2.webapps.dir}/${servlet.context.prefix}'? (yes/NO):" addproperty="answer"/>
+ <condition property="yes-delete-tomcat-cluster-node2">
+ <equals arg1="yes" arg2="${answer}"/>
+ </condition>
+ <antcall target="do-clean-tomcat-cluster-node2"/>
+ </target>
+
+ <target name="do-clean-tomcat-cluster-node2" if="yes-delete-tomcat-cluster-node2" description="Clean Tomcat cluster node 2">
+ <echo>Clean Tomcat cluster node 2:</echo>
+
+ <fail message="No such directory: ${tomcat2.webapps.dir}">
+ <condition><not><available file="${tomcat2.webapps.dir}"/></not></condition>
+ </fail>
+
+ <delete dir="${tomcat2.webapps.dir}/${servlet.context.prefix}"/>
+ <delete dir="${tomcat2.work.dir}/${servlet.context.prefix}"/>
+ </target>
+
+
+ <target name="ask-to-reconfigure-tomcat-cluster-node1" description="reconfigure Tomcat cluster node 1" if="isTomcat1PortsSet">
+ <input message="Do you want to reconfigure tomcat cluster node 1 in order to support SSL? (YES/no):" defaultvalue="NO" addproperty="answerReconfigureTomcat1"/>
+ <condition property="doNotReconfigureTomcat1">
+ <equals arg1="no" arg2="${answerReconfigureTomcat1}"/>
+ </condition>
+ <antcall target="reconfigure-tomcat-cluster-node1"/>
+ <antcall target="comment-local-tomcat1-ports"/>
+ </target>
+
+ <target name="comment-local-tomcat1-ports" if="doNotReconfigureTomcat1" description="Comment ports of Tomcat Cluster Node 1 within local.build.properties">
+ <replace file="${yanel.source.home}/src/build/local.build.properties" value="#tomcat1.ssl.port=${tomcat1.ssl.port}">
+ <replacetoken>tomcat1.ssl.port=8443</replacetoken>
+<!--TODO: why is this commented
+ <replacetoken>tomcat1.ssl.port=${tomcat1.ssl.port}</replacetoken>
+-->
+ </replace>
+ <replace file="${yanel.source.home}/src/build/local.build.properties" value="#tomcat1.http.port=${tomcat1.http.port}">
+ <replacetoken>tomcat1.http.port=8080</replacetoken>
+<!--TODO: why is this commented
+ <replacetoken>tomcat1.http.port=${tomcat1.http.port}</replacetoken>
+-->
+ </replace>
+ </target>
+
+ <target name="reconfigure-tomcat-cluster-node1" unless="doNotReconfigureTomcat1" description="reconfigures tomcat regarding ssl">
+ <!-- TODO: Ask the port numbers -->
+
+<!--
+ <replace file="${yanel.source.home}/src/build/local.build.properties" value="tomcat1.http.port=8080">
+ <replacetoken>#tomcat1.http.port=9190</replacetoken>
+ </replace>
+ <replace file="${yanel.source.home}/src/build/local.build.properties" value="tomcat1.ssl.port=8443">
+ <replacetoken>#tomcat1.ssl.port=9143</replacetoken>
+ </replace>
+-->
+
+ <antcall target="createCK"/>
+ <copy file="${build.dir}/${certificate.keystore}" todir="${tomcat1.home.dir}"/>
+ <xslt in="${tomcat1.home.dir}/conf/server.xml"
+ out="${tomcat1.home.dir}/conf/server.xml.ssl"
+ style="connector.xsl">
+ <param name="ssl-port" expression="${tomcat1.ssl.port}"/>
+ <param name="keystoreFile" expression="${certificate.keystore}"/>
+ <param name="keystorePass" expression="${certificate.keypass}"/>
+ <param name="http-port" expression="${tomcat1.http.port}"/>
+ </xslt>
+ <tstamp>
+ <format property="timestamp" pattern="yyyyMMdd'T'HHmmss"/>
+ </tstamp>
+ <copy file="${tomcat1.home.dir}/conf/server.xml" tofile="${tomcat1.home.dir}/conf/server.xml.BAK_${timestamp}"/>
+ <move file="${tomcat1.home.dir}/conf/server.xml.ssl" tofile="${tomcat1.home.dir}/conf/server.xml"/>
+ </target>
+
+ <target name="ask-to-reconfigure-tomcat-cluster-node2" description="reconfigure Tomcat cluster node 2" if="isTomcat2HomeSet">
+ <input message="Do you want to reconfigure tomcat cluster node 2 in order to support SSL? (yes/NO):" defaultvalue="NO" addproperty="answerReconfigureTomcat2"/>
+ <condition property="reconfigureTomcat2">
+ <equals arg1="yes" arg2="${answerReconfigureTomcat2}"/>
+ </condition>
+ <antcall target="reconfigure-tomcat-cluster-node2"/>
+ </target>
+
+ <target name="reconfigure-tomcat-cluster-node2" if="reconfigureTomcat2" description="reconfigures tomcat regarding ssl">
+ <antcall target="createCK"/>
+ <copy file="${build.dir}/${certificate.keystore}" todir="${tomcat2.home.dir}"/>
+ <xslt in="${tomcat2.home.dir}/conf/server.xml"
+ out="${tomcat2.home.dir}/conf/server.xml.ssl"
+ style="connector.xsl">
+ <param name="ssl-port" expression="${tomcat2.ssl.port}"/>
+ <param name="keystoreFile" expression="${certificate.keystore}"/>
+ <param name="keystorePass" expression="${certificate.keypass}"/>
+ <param name="http-port" expression="${tomcat2.http.port}"/>
+ </xslt>
+ <tstamp>
+ <format property="timestamp" pattern="yyyyMMdd'T'HHmmss"/>
+ </tstamp>
+ <copy file="${tomcat2.home.dir}/conf/server.xml" tofile="${tomcat2.home.dir}/conf/server.xml.BAK_${timestamp}"/>
+ <move file="${tomcat2.home.dir}/conf/server.xml.ssl" tofile="${tomcat2.home.dir}/conf/server.xml"/>
+ </target>
+
+</project>
\ No newline at end of file
Added: public/yanel/trunk/src/build/targets/webapp/webapp.xml
===================================================================
--- public/yanel/trunk/src/build/targets/webapp/webapp.xml (rev 0)
+++ public/yanel/trunk/src/build/targets/webapp/webapp.xml 2008-08-19 14:26:55 UTC (rev 38121)
@@ -0,0 +1,214 @@
+<?xml version="1.0"?>
+
+<project name="webapp" default="deploy" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <target name="deploy" description="Deploy war file" depends="init, webapp">
+ <condition property="property-tomcat-cluster-node1-is-set">
+ <isset property="tomcat1.home.dir"/>
+ </condition>
+ <condition property="property-tomcat1-ssl-port-is-set">
+ <isset property="tomcat1.ssl.port"/>
+ </condition>
+ <antcall target="deploy-to-tomcat-cluster-node1"/>
+
+ <condition property="property-tomcat-cluster-node2-is-set">
+ <isset property="tomcat2.home.dir"/>
+ </condition>
+ <condition property="property-tomcat2-ssl-port-is-set">
+ <isset property="tomcat2.ssl.port"/>
+ </condition>
+ <antcall target="deploy-to-tomcat-cluster-node2"/>
+
+ <antcall target="final-message"/>
+ </target>
+
+ <!-- TODO: Invoice depends on impl ...! -->
+ <target name="webapp" description="Build webapp" depends="init, compile-core, compile-impl, compile-webapp, build-resources, build-realms">
+<!--
+ <target name="webapp" description="Build webapp" depends="init, compile-webapp">
+-->
+ <mkdir dir="${build.dir}/webapps/${servlet.context.prefix}"/>
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}">
+ <fileset dir="${yanel.source.home}/src/webapp">
+ <exclude name="src/**"/>
+ </fileset>
+ </copy>
+
+ <!-- TODO: Copy only core, impl, webapp, but NOT cmdl, etc. -->
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
+ <fileset dir="${yanel.source.home}/build/lib"/>
+ </copy>
+
+ <antcall target="deploy-resources"/>
+
+<!--
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes">
+ <fileset dir="${yanel.source.home}/lib">
+ <include name="*.properties"/>
+ <exclude name="local.*.properties"/>
+ </fileset>
+ </copy>
+-->
+ <copy file="${yanel.source.home}/conf/CatalogManager.properties" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/catalog.xml" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/entities" overwrite="false">
+ <fileset dir="${yanel.source.home}/conf/entities"/>
+ </copy>
+
+ <copy file="${yanel.source.home}/conf/spring-yanel-config.xml" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/realms.xml" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
+ <copy file="${yanel.source.home}/conf/log4j.properties" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="false"/>
+ <!-- Create yanel.xml -->
+ <condition property="local.yanel.config.exists">
+ <available file="${yanel.source.home}/${local.config.dir}/local.yanel.xml" type="file"/>
+ </condition>
+ <antcall target="generate-yanel-properties"/>
+
+ <condition property="local.resource-types.config.exists">
+ <available file="${yanel.source.home}/${local.config.dir}/local.resource-types.xml" type="file"/>
+ </condition>
+ <antcall target="generate-resource-types-registry"/>
+
+ <antcall target="check-config-version"/>
+
+ <!-- Overwrite default by local properties -->
+ <!-- TODO: Make the patching selectable within the build.properties of the build ... -->
+ <copy file="${yanel.source.home}/${local.config.dir}/local.log4j.properties" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" overwrite="true" failonerror="false"/>
+ <copy file="${yanel.source.home}/${local.config.dir}/local.realms.xml" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/realms.xml" overwrite="true" failonerror="false"/>
+ <antcall target="patch-with-local-yanel-config"/>
+ <antcall target="patch-with-local-resource-types-registry"/>
+
+
+ <!-- Patch properties ... -->
+
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/yanel.xml" value="${yanel.source.home.forward.slashes}">
+ <replacetoken>..</replacetoken>
+ </replace>
+
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/realms.xml" value="${yanel.source.home.forward.slashes}/src/realms">
+ <replacetoken>@REALMS_DIR@</replacetoken>
+ </replace>
+
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml" value="${yanel.source.home.forward.slashes}">
+ <replacetoken>@YANEL_SRC_DIR@</replacetoken>
+ </replace>
+
+ <!-- DEPRECATED -->
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml" value="${yanel.source.home.forward.slashes}/src">
+ <replacetoken>../src</replacetoken>
+ </replace>
+ <!-- /DEPRECATED -->
+
+ <xslt in="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml" out="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml-OUT" style="fix-resources-src.xsl" force="true">
+ </xslt>
+ <move file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml-OUT" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml"/>
+
+ <copy file="${yanel.source.home}/src/build/install.rdf" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes" overwrite="true"/>
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/install.rdf" value="${yanel.version}">
+ <replacetoken>@VERSION@</replacetoken>
+ </replace>
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/install.rdf" value="${yanel.revision}">
+ <replacetoken>@REVISION@</replacetoken>
+ </replace>
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/install.rdf" value="source">
+ <replacetoken>@INSTALLTYPE@</replacetoken>
+ </replace>
+
+ <replace file="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/log4j.properties" value="${log4j.file.forward.slashes}">
+ <replacetoken>@LOG4J_FILE@</replacetoken>
+ </replace>
+ <touch file="${log4j.file}"/>
+
+ <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/lib">
+ <fileset refid="maven2.fileset"/>
+ <mapper type="flatten"/>
+ </copy>
+
+ <!-- TODO: So far only the javadoc of the core is being built -->
+ <condition property="javadoc-does-not-exist-yet">
+ <not>
+ <available file="${build.dir}/javadoc" type="dir"/>
+ </not>
+ </condition>
+ <antcall target="generate-javadoc"/>
+
+ <ant antfile="${yanel.source.home}/build/build-resource-types.xml" target="copy-resources-dependencies"/>
+
+ <antcall target="deploy-libs-of-realms"/>
+ </target>
+
+ <target name="war" description="Build war file" depends="init, webapp">
+ <jar jarfile="${yanel.source.home}/build/webapps/${servlet.context.prefix}.war" basedir="${yanel.source.home}/build/webapps/${servlet.context.prefix}"/>
+ </target>
+
+ <target name="compile-webapp" description="Compile Java classes of Yanel webapp" depends="init, compile-core, compile-cmdl">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${yanel.source.home}/src/webapp/src/java/org/wyona/yanel/servlet" destdir="${classes.dir}"
+ debug="true"
+ classpathref="classpath.compile"
+ />
+ <mkdir dir="${yanel.source.home}/build/lib"/>
+ <jar destfile="${yanel.source.home}/build/lib/yanel-webapp-${yanel.version}-r${yanel.revision}.jar"
+ basedir="${classes.dir}"
+ includes="org/wyona/yanel/servlet/**"/>
+
+ <copy file="${yanel.source.home}/src/build/pom-webapp.xml" todir="${yanel.source.home}/build/lib"/>
+ <replace file="${yanel.source.home}/build/lib/pom-webapp.xml" value="${yanel.version}-r${yanel.revision}">
+ <replacetoken>@VERSION@</replacetoken>
+ </replace>
+
+ <artifact:pom id="webapp.project" file="${yanel.source.home}/build/lib/pom-webapp.xml"/>
+
+ <artifact:install file="${yanel.source.home}/build/lib/yanel-webapp-${yanel.version}-r${yanel.revision}.jar">
+ <pom refid="webapp.project"/>
+ </artifact:install>
+ </target>
+
+ <target name="createCK" description="Add ssl configuration to your webserver">
+ <!-- delete already created file -->
+ <delete file="${build.dir}/${certificate.keystore}"/>
+ <!-- create new keystore file -->
+ <!-- IMPORT NOTE: In order to find keytool set: export PATH=/usr/local/jdk1.5.0_06/bin:$PATH (resp. depending on operating system use some other way to reset the PATH environment variable) -->
+ <exec executable="keytool">
+ <arg line="-genkey"/>
+ <arg line="-alias"/>
+ <arg value="${servlet.container}"/>
+ <arg line="-keyalg"/>
+ <arg value="RSA"/>
+ <arg line="-storepass"/>
+ <arg value="${certificate.keypass}"/>
+ <arg line="-keypass"/>
+ <arg value="${certificate.keypass}"/>
+ <arg line="-keystore"/>
+ <arg value="${build.dir}/${certificate.keystore}"/>
+ <arg line="-dname"/>
+ <arg value="CN=${certificate.common.name}, OU=${certificate.organisation.unit}, O=${certificate.organisation}, L=${certificate.locality.name}, S=${certificate.state.name}, C=${certificate.country.code}"/>
+ </exec>
+ </target>
+
+ <target name="generate-resource-types-registry" unless="local.resource-types.config.exists">
+ <copy file="${yanel.source.home}/conf/resource-types.xml" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml" overwrite="false"/>
+ </target>
+
+ <target name="patch-with-local-resource-types-registry" if="local.resource-types.config.exists">
+ <copy file="${yanel.source.home}/${local.config.dir}/local.resource-types.xml" tofile="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/resource-types.xml" overwrite="true"/>
+ </target>
+
+ <target name="generate-yanel-properties" unless="local.yanel.config.exists">
+ <xslt in="${yanel.source.home}/conf/yanel.xml" out="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/yanel.xml" style="yanel2properties.xsl" force="false">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.revision" expression="${yanel.revision}"/>
+ <param name="yanel.version" expression="${yanel.version}"/>
+ </xslt>
+ </target>
+
+ <target name="patch-with-local-yanel-config" if="local.yanel.config.exists">
+ <xslt in="${yanel.source.home}/${local.config.dir}/local.yanel.xml" out="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes/yanel.xml" style="yanel2properties.xsl" force="true">
+ <param name="servlet.context.prefix" expression="${servlet.context.prefix}"/>
+ <param name="yanel.revision" expression="${yanel.revision}"/>
+ <param name="yanel.version" expression="${yanel.version}"/>
+ </xslt>
+ </target>
+
+
+</project>
More information about the Yanel-commits
mailing list