<?xml version='1.0' encoding="ISO-8859-1"?>
<project name="VKC5" default="compile_classes" basedir=".">

	<property environment="env"/>
	<property name="src"          			value="src"/>
	<property name="classes"      			value="defaultroot/WEB-INF/classes"/>
	<property name="libs"         			value="jars"/>
	<property name="webinf"       			value="defaultroot/WEB-INF"/>
	<property name="webapp.dir"       		value="defaultroot"/>
	<property name="tomcat.home"       		value="${env.TOMCAT_HOME}"/>
	<property name="converter.dist"			value="converter-dist"/>
	<property name="shark.home"				value="d:/work/eclipse3/Shark-VKC"/>
	<property name="service.host"			value="localhost"/>
	<property name="service.port"			value="80"/>
    <property name="distpath"				value="distrib" />
	
	<patternset id="props">
		<include name="**/*.properties"/>
		<include name="**/*.wsdl"/>
	</patternset>
	
	<patternset id="java.lib">
		<include name="**/*.jar"/>
	</patternset>
	
	<path id="axis.classpath">
	  <fileset dir="${libs}">
	    <include name="**/*.jar" />
	  </fileset>
	</path>
	
	<taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />
		
	<target name="generate-wsdl">
		<axis-java2wsdl classname="vkc.ws.axis.service.SharkService"
				style="RPC"
				namespace="urn:http://c-lab.de/wsdl/vkc/ws/axis/service/SharkService"
				location="http://${service.host}:${service.port}/VKC3/services/SharkService"
				output="${src}/vkc/ws/axis/service/SharkService.wsdl">
			<classpath path="${classes}"/>
			<mapping package="vkc.ws.axis.service" namespace="urn:Shark"/>
		</axis-java2wsdl>
		<axis-java2wsdl classname="vkc.ws.axis.service.DocumentService"
				style="RPC"
				namespace="urn:http://c-lab.de/wsdl/vkc/ws/axis/service/DocumentService"
				location="http://${service.host}:${service.port}/VKC3/services/DocumentService"
				output="${src}/vkc/ws/axis/service/DocumentService.wsdl">
			<classpath path="${classes}"/>
			<mapping package="vkc.ws.axis.service" namespace="urn:Document"/>
		</axis-java2wsdl> 
		<axis-java2wsdl classname="vkc.ws.axis.service.AudiService"
				style="RPC"
				namespace="urn:http://c-lab.de/wsdl/vkc/ws/axis/service/AudiService"
				location="http://${service.host}:${service.port}/VKC3/services/AudiService"
				output="${src}/vkc/ws/axis/service/AudiService.wsdl">
			<classpath path="${classes}"/>
			<mapping package="vkc.ws.axis.service" namespace="urn:Audi"/>
		</axis-java2wsdl> 
		<antcall target="copy_resources" />
	</target>
	
	<target name="init"><tstamp/></target>

	<target name="all" depends="init,compile_classes,copy.webinf.libs"></target>	
	
	<target name="copy_resources">
		<copy todir="${classes}">
			<fileset dir="${src}">
				<patternset refid="props"/>
			</fileset>
		</copy>
	</target>
			
	<target name="compile_classes" depends="copy.webinf.libs">
	
		<javac srcdir="${src}" destdir="${classes}">
			<classpath>
				<fileset dir="${libs}">
					<patternset refid="java.lib"/>
				</fileset>
			</classpath>
		</javac>

		<antcall target="copy_resources"/>
	
	</target>

	<target name="copy.webinf.libs" depends="init,clean.webinf.libs">
		
		<copy todir="${webinf}/lib">

			<fileset dir="${libs}">
				<include name="*.jar"/>
				<exclude name="servlet.jar"/>				
				<exclude name="junit-3.8.1.jar"/>
			</fileset>

			<fileset dir="${libs}/jdbc-drivers">
				<include name="*.jar"/>
			</fileset>

			<fileset dir="${libs}/struts">
				<include name="*.jar"/>
			</fileset>

			<fileset dir="${libs}/commons">
				<include name="*.jar"/>
			</fileset>
			
			<fileset dir="${libs}/jobo">
				<include name="*.jar"/>
			</fileset>
			
			<fileset dir="${libs}/jsse">
				<include name="*.jar"/>
			</fileset>
			
			<fileset dir="${libs}/soffice">
				<include name="*.jar"/>
			</fileset>
			<fileset dir="${libs}/axis-1.2alpha">
				<include name="*.jar"/>
			</fileset>

			<fileset dir="${libs}/xerces-2.6.2">
				<include name="*.jar"/>
			</fileset>
			
			<fileset dir="${libs}/shark">
				<include name="*.jar"/>
			</fileset>
			
			<fileset dir="${libs}/jfreechart">
	     		<include name="*.jar"/>
     		</fileset>
		</copy>

	</target>	

	<target name="clean.webinf.libs" >
		<delete failonerror="false">
			<fileset dir="${webinf}/lib">
				<include name="*.jar"/>
			</fileset>
		</delete>
	</target>

	<target name="workflow.copy_vkclib" depends="compile_classes">
			<jar destfile="${shark.home}/lib/vkc.jar">
					<fileset dir="${classes}">
						<include name="**/*"/>
					</fileset>
			</jar>
			<copy todir="${shark.home}/lib">
				<fileset dir="${libs}/commons">
					<include name="*.jar"/>
				</fileset>
				<fileset dir="${libs}/struts">
					<include name="struts.jar"/>
				</fileset>
				<fileset dir="${libs}/jdbc-drivers">
					<include name="*.jar"/>
				</fileset>
				<fileset dir="${libs}">
					<include name="velocity-1.3.1.jar"/>
					<include name="quartz.jar"/>
				</fileset>
			</copy>
	</target>	

    <!-- BUILD VKC5.JAR -->
	<target name="create.vkc5_jar">
		<jar destfile="${libs}/vkc5.jar">
			<fileset dir="${classes}">
				<include name="**/*"/>
			</fileset>
		</jar>
    </target> 
	
	<!-- CONVERTER SECTION -->
	<target name="dist.converter" depends="compile_classes">
		<mkdir  dir="${converter.dist}"/>
		<mkdir  dir="${converter.dist}/logs"/>
		<mkdir  dir="${converter.dist}/lib"/>
		<jar destfile="${converter.dist}/lib/vkc5.jar">
			<fileset dir="${classes}">
				<include name="**/*"/>
			</fileset>
		</jar>
		
		<copy todir="${converter.dist}/lib">
			<fileset dir="${libs}">
				<include name="vkc5.jar"/>
				<include name="mail.jar"/>
				<include name="activation.jar"/>
				<include name="velocity-dep-1.3.1.jar"/>
				<include name="jsl.jar"/>
				<include name="quartz.jar"/>
			</fileset>
			<fileset dir="${libs}/jobo">
				<include name="jobo.jar"/>
			</fileset>
			<fileset dir="${libs}/jdbc-drivers">
				<include name="*.jar"/>
			</fileset>
			<fileset dir="${libs}/soffice">
				<include name="*.jar"/>
			</fileset>
			<fileset dir="${libs}/commons">
				<include name="*.jar"/>
			</fileset>
		</copy>
	</target>
	
	<target name="clean.converter">
		<delete>
			<fileset dir="${converter.dist}">
				<exclude name="*.exe"/>
				<exclude name="*.html"/>
				<exclude name="*.bat"/>
				<exclude name="*.sh"/>
				<exclude name="*.log"/>
				<exclude name="*.tmpl"/>
				<exclude name=".cvsignore"/>
				<exclude name="license.dat"/>
				<exclude name="converter.properties.tmpl"/>
				<exclude name="converter.properties"/>
				<include name="**/*"/>
			</fileset>
		</delete>
		<delete dir="${converter.dist}/lib"/>
	</target>

	<target name="generate-war" description="Genrate a WAR archive">
	  <jar   jarfile="${webapp.dir}/WEB-INF/lib/VKC5.jar"
	         basedir="${classes}"/>
	  <war destfile="${distpath}/VKC5.war" webxml="${webinf}/web.xml">
		<fileset dir="${webapp.dir}">
			<include name="*.*"/>
			<include name="common/**/*"/>
			<include name="lang/**/*"/>
			<include name="templates/default/**/*"/>
			<include name="WEB-INF/lib/**/*"/>
			<include name="WEB-INF/taglib/**/*"/>
			<include name="WEB-INF/license.dat"/>
			<include name="WEB-INF/server-config.wsdd"/>
			<include name="WEB-INF/struts-config.xml"/>
			<include name="WEB-INF/struts-workflow.xml"/>
			<include name="WEB-INF/vkc.properties.tmpl"/>
			<include name="WEB-INF/vkc.properties"/>
			<include name="WEB-INF/web.xml"/>
		</fileset>
		</war>
		<delete file="${webapp.dir}/WEB-INF/lib/VKC5.jar"/>
	</target>
</project>