<project name="DougWS" default="deploy" basedir=".">
	<description>
        builds externalExec clients and server
    </description>
	<!-- set global properties for this build -->
	<property name="src" location="src"/>
	<property name="build" location="build"/>
	<property name="lib" location="lib"/> 
	<property name="serverTarget" location="/home/poecher/apache-tomcat-5.5.17/webapps/axis/WEB-INF/classes"/>
	<property name="clientTarget" location="/home/poecher/client"/>

	<target name="init" depends="clean">
		<!-- Create the build directory structure used by compile -->
		<mkdir dir="${build}"/>
	</target>

	<target name="compile" depends="init"
        description="compile the source" >
		<!-- Compile the java code from ${src} into ${build} including debug infos -->
		<javac srcdir="${src}" destdir="${build}" debug="true" debuglevel="lines,vars,source">
			<classpath>
				<fileset dir="${lib}">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
		</javac>
	</target>

	<target name="deployServer" depends="compile" description="put the files into Axis classes directory">
		<!-- Copy all files in their name to ${serverTarget} regardless, if they are for the server or not.-->
		<copy todir="${serverTarget}">
			<fileset dir="${build}"/>
		</copy>
	</target>

	<target name="deployClient" depends="compile" 
		description="put the files into the right place">
		<!-- Copy all files to ${clientTarget} regardless, if they are for the server or not. -->
		<mkdir dir="${clientTarget}" />
		<copy todir="${clientTarget}">
			<fileset dir="${build}" />
		</copy>
	</target>

	<target name="deploy" depends="deployServer, deployClient" 
		description="put the files into the right place">
		<delete dir="${build}"/>
	</target>

	<target name="clean"
        description="cleans up build and client directories, but not deployed axis classes" >
		<!-- Delete the directory trees -->
		<delete dir="${build}"/>
		<delete includeemptydirs="true">
	    	<fileset dir="${serverTarget}" includes="**/*"/>
			<fileset dir="${clientTarget}" includes="**/*" />
	  	</delete>
	</target>
	
	<target name="register"
		description="registers webservice in axis, that is process services WSDD file">
		<java classname="org.apache.axis.client.AdminClient">
			<classpath>
				<fileset dir="${lib}">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
			<arg file="${src}/deploy.wsdd"/>
		</java>
	</target>
	
	<target name="unregister"
		description="unregisters webservice in axis, that is process services WSDD file">
		<java classname="org.apache.axis.client.AdminClient">
			<classpath>
				<fileset dir="${lib}">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
			<arg file="${src}/undeploy.wsdd"/>
		</java>
	</target>
</project>