<?xml version="1.0"?>

<project name="soap build" default="all" basedir=".">
	<!-- 	on Mac OS X launch with 
			/Users/cosmo/ant-1.5/bin/ant -verbose -buildfile SOAPbuild.xml-->
	

	<property name="targetsite" value="www.cenquest.com" 	/>
	
	
<!-- get Google -->													
	<target name="getGoogle">
		<!-- uncomment for Windows <taskdef name="httppost" 
				classname="org.apache.tools.ant.taskdefs.optional.http.HttpPost" classpath="C:\ant\lib\;"/>	-->										
		<taskdef name="httppost" 
				classname="org.apache.tools.ant.taskdefs.optional.http.HttpPost" classpath="/Users/cosmo/ant-1.5/lib/;"/>											
		<copy file="sources/googlerequest.xml" todir="temp" overwrite="true" />
		<replace file="temp/googlerequest.xml" token="@target@" value="${targetsite}" summary="yes"/>
		<!-- httppost is not currently in the release build.  You should be able to find it in ant CVS under proposals/sandbox/httptasks or 
			you can get my jar of it from www.gregorycosmohaun/2002/ant/lib/http.jar -->
		<httppost url="http://api.google.com/search/beta2" 
			dest="temp/Googleresult.xml"
        	uploadFile="temp/googlerequest.xml"
        	contentType="text/xml" />
        
        <style 	in="temp/Googleresult.xml" 
				out="out/linkList.xml"
				style="XSLs/Google2LinkList.xsl" >
			
 		<param name="target" expression="${targetsite}"/>
 	</style>	        	
	</target>
	
	
	<target name="init" depends=""/>
	
<!-- XSLTs	-->
	<target name="xslt" depends="init">
 		
 		<style in="out/linkList.xml"
 				out="out/linkList.html"
 				style="XSLs/linkList2html.xsl"/>
 				
 		<style in="out/linkList.xml"
 				out="out/linkList.wml"
 				style="XSLs/linkList2wml.xsl"/>
 	</target>
 	
 	
 <!-- PDF -->	
 	<target name="pdf" depends="init"> 	
		<taskdef name="fop" 
				classname="org.apache.fop.tools.anttasks.Fop" />
 		<style in="out/linkList.xml"
 				out="temp/linkList.fo"
 				style="XSLs/linkList2fo.xsl" />
 				
		<fop 	format="application/pdf" 
				outdir="out" 
				messagelevel="verbose"				
                    >
			<fileset dir="temp">
				<include name="linkList.fo"/>
			</fileset>
		</fop>
 	</target>
 	
 	
<!-- jpeg -->
 	<target name="jpeg"  depends="init">	
		<taskdef name="rasterize" 
				classname="org.apache.tools.ant.taskdefs.optional.SVGRasterizer" />
		<style in="out/linkList.xml"
				out="temp/linkList.svg"
				style="XSLs/linkList2SVG.xsl"/>
		
		
		<rasterize 
			result="image/jpeg"
			height="300"
			quality="0.5"
			src="temp/linkList.svg"
			dest="out/linkList.jpeg">
		</rasterize>
		<!--  -->
	</target>
 	
 	
<!-- Flash -->
 	<target name="flash"  depends="init">		

		<taskdef name="swf2xml" 
				classname="com.gregorycosmohaun.anttasks.javaswf.swf2xml"  />
		<taskdef name="xml2swf" 
				classname="com.gregorycosmohaun.anttasks.javaswf.xml2swf"  />

		<swf2xml dest="temp" src="sources" includes="circleOrig.swf"/>
		<copy file="temp/circleOrig.xml" tofile="temp/circle.xml" overwrite="true" />
		<replace file="temp/circle.xml">
			<replacefilter token="@text goes here@" value="${targetsite}" />
		</replace>

		<xml2swf dest="out" src="temp" includes="circle.xml"/>
	</target>

	<target name="all" depends="getGoogle,flash,jpeg,pdf,xslt"/>
</project>

