<project name="samples" default="help" basedir=".">
 <target name="help">
  <echo>
  This script requires Ant 1.5 or higher

  usage:
    ant -help 
  		display ant help screen
    ant help 
  		display this message
    ant clean 
  		delete the build directory
    ant compile 
  		build the samples

  	These samples make stockquote requests to the sample services through Synapse

  	ant stockquote
  		Use the smart client - Synapse in WS-Addressing router mode
  		Use default sample configuration (i.e. start with -sample 0)
    
  	  examples:
  	  ant stockquote
  	  ant stockquote [-Dsymbol=IBM] 
  	  	[-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
  	  	[-Dsynapseurl=http://localhost:8080] [-Drepository=client_repo]
  	
  	ant proxystockquote
	    Use the http proxy client - Synapse in "transparent mode" as an HTTP proxy
	    Use default sample configuration (i.e. start with -sample 0)
    
  	 	examples:
  	  ant proxystockquote
  	  ant proxystockquote [-Dsymbol=IBM] 
  	  	[-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
  	  	[-Dsynapseurl=http://localhost:8080]

    ant dumbstockquote 
      Use the dumb soap client - Synapse in "gateway" mode; transport set to virtual
      url which is interpreted by Synapse
      Use default sample configuration (i.e. start with -sample 0)
  
  		examples:
	  	ant dumbstockquote 
	    ant dumbstockquote [-Dsymbol=IBM] [-Dgatewayurl=http://localhost:8080/StockQuote]

    ant customquote 
      Use a custom stock quote request and response format, and transform (XSLT) between
      Use sample configuration #1 (i.e. start with -sample 1)
  
  		examples:
	  	ant customquote 
	    ant customquote [-Dsymbol=IBM] 
	    	[-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
	    	[-Dsynapseurl=http://localhost:8080]

    ant advancedquote 
      Validate custom quote requests against a schema before sending out
      Use sample configuration #2 (i.e. start with -sample 2)
  
  		examples:
	  	ant advancedquote 
	    ant advancedquote 
	    	[-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
	    	[-Dsynapseurl=http://localhost:8080]

    ant simplequote 
      Use a simple quote using addressing to demonstrate the custom server 
      configuration created programmatically
      Use sample configuration created programmatically (i.e. start using custom.bat/sh)
  
  		examples:
	  	ant simplequote 
	    ant simplequote [-Dsymbol=IBM] 
	    	[-Durl=http://localhost:9000/axis2/services/SimpleStockQuoteService]
	    	[-Dsynapseurl=http://localhost:8080] [-Drepository=client_repo]

  	ant proxyquote
	    Use Proxy services to query stock prices. (Must be used with the sample configuration # 3)
    
  	 	examples:
  	  ant proxyquote
  	  ant proxyquote -Dsymbol=IBM 
  	  	-DfwdProxy=http://localhost:8080/axis2/services/StockQuoteForwardProxy 
  	  	-DdefProxy=http://localhost:8080/axis2/services/StockQuoteDefaultProxy 
  	  	-DseqProxy=http://localhost:8080/axis2/services/StockQuoteSequenceProxy"
        </echo>
    </target>

		<property name="symbol" value="IBM"/>
    <property name="url" value="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
    <property name="synapseurl" value="http://localhost:8080"/>
    <property name="gatewayurl" value="http://localhost:8080/StockQuote"/>
    <property name="repository" value="client_repo"/>
    <property name="fwdProxy" value="http://localhost:8080/axis2/services/StockQuoteForwardProxy"/>
    <property name="defProxy" value="http://localhost:8080/axis2/services/StockQuoteDefaultProxy"/>
    <property name="seqProxy" value="http://localhost:8080/axis2/services/StockQuoteSequenceProxy"/>

    <property name="class.dir" value="target/classes"/>

    <path id="axis.classpath">
        <fileset dir="../lib">
            <include name="*.jar"/>
        </fileset>
    </path>

    <target name="clean">
        <delete dir="target" quiet="true"/>
        <delete dir="${class.dir}" quiet="true"/>
    </target>

    <target name="stockquote" depends="compile">    		
        <java classname="samples.userguide.StockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${url}"/>
            <arg value="${synapseurl}"/>
            <arg value="${repository}"/>
        </java>
    </target>

    <target name="proxystockquote" depends="compile">    		
        <java classname="samples.userguide.ProxyStockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${url}"/>
            <arg value="${synapseurl}"/>
        </java>
    </target>

    <target name="dumbstockquote" depends="compile">        
        <java classname="samples.userguide.DumbStockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${gatewayurl}"/>
        </java>
    </target>

    <target name="customquote" depends="compile">        
        <java classname="samples.mediation.CustomStockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${url}"/>
            <arg value="${synapseurl}"/>
        </java>
    </target>

    <target name="advancedquote" depends="compile">
        <java classname="samples.mediation.AdvancedQuoteClient"
              classpathref="javac.classpath" fork="true">
            <arg value="${url}"/>
            <arg value="${synapseurl}"/>
        </java>
    </target>

    <target name="simplequote" depends="compile">        
        <java classname="samples.userguide.StockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${url}"/>
            <arg value="${synapseurl}"/>
            <arg value="${repository}"/>
        </java>
    </target>
    
    <target name="proxyquote" depends="compile">        
        <java classname="samples.mediation.ProxyStockQuoteClient"
              classpathref="javac.classpath" fork="true">
           	<arg value="${symbol}"/>
            <arg value="${fwdProxy}"/>
            <arg value="${defProxy}"/>
            <arg value="${seqProxy}"/>
        </java>
    </target>

    <target name="init">
        <mkdir dir="${class.dir}"/>
        <path id="javac.classpath">
            <pathelement path="${class.dir}"/>
            <fileset dir="../lib">
                <include name="**/*.jar"/>
            </fileset>
        </path>
    </target>

    <target name="compile" depends="init" description="Compile all Java">
        <javac srcdir="src" destdir="${class.dir}">
            <classpath refid="javac.classpath"/>
        </javac>
    </target>

</project>
