<!--
 Copyright 2004 Sun Microsystems, Inc. All rights reserved.
 SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->

<project name="Java WSDP 1.4 Launcher" default="jwsdp" basedir=".">



  <!-- standard properties -->
  <property name="jwsdp.home" location="${basedir}/../.."/>
  <!--
  <property name="JSSE_HOME" location="${jwsdp.home}/jwsdp-shared"/>
  -->
  <property name="JAVA_HOME" value="${JAVA_HOME}"/>
  <property name="ANT_HOME" location="${jwsdp.home}/apache-ant"/>
  <property name="jwsdp.running" value="JWSDP 1.4"/>


  <property file="${jwsdp.home}/conf/jwsdp.properties" />

  <!-- localized properties -->
  <property resource="com/sun/jwsdp/launcher/launcher_${launch.locale.language}_${launch.locale.country}.properties"/>
  <property resource="com/sun/jwsdp/launcher/launcher_${launch.locale.language}.properties"/>
  <property resource="com/sun/jwsdp/launcher/launcher.properties"/>

  <!-- import the user's custom properties -->
  <property file="${jwsdp.home}/bin/user.properties"/>

  <!-- user configurable property values -->
  <property name="jwsdp.class.path" value=""/>
  <property name="deprecated.jwsdp.class.path" value=""/>
  <property name="jwsdp.vm.args" value=""/>
  <property name="deprecated.jwsdp.vm.args" value=""/>

  <property name="http.proxyHost" value="" />
  <property name="http.proxyPort" value="" />
  <property name="https.proxyHost" value="" />
  <property name="https.proxyPort" value="" />
  <property name="ftp.proxyHost" value="" />
  <property name="ftp.proxyPort" value="" />

  <!-- Properties required by the WS-I clients -->
  <property name="configurator.endpoint" value="http://localhost:8080/wsi-server/scm/configurator"/>
  <property name="configurator.refresh" value="true"/>
  <property name="catalog.endpoint" value="local"/>
  <property name="catalog.level" value="thumbnail,details"/>
  <property name="wsi-sampleapp.home" value="${jwsdp.home}/wsi-sampleapp"/>


  <!-- Java WSDP specific classpath : Needed for client side apps only-->
  <path id="jwsdp.specific.classpath" >

     
   <pathelement location="${JAVA_HOME}/lib/tools.jar"/>
  <!-- the standard classpath -->
    <pathelement location="${JAVA_HOME}/jre/lib/ext/localedata.jar" />

    <fileset dir="${jwsdp.home}" >
        <!-- JAXP endorsed jar files  -->
        <include name="*/lib/endorsed/*.jar" />

        <!--All the remaning component jar files in their lib directories -->
        <include name="*/lib/*.jar" />
    </fileset>

   <pathelement path="${jwsdp.class.path}"/>
   <pathelement path="${deprecated.jwsdp.class.path}"/>

  </path>

     
  <path id="base.class.path">

     
    <pathelement location="${jwsdp.home}/bin" />
    <pathelement location="${jwsdp.home}/bin/bootstrap.jar" />

    <pathelement location="${JAVA_HOME}/lib/tools.jar"/>
    <!-- the standard classpath -->
    <pathelement location="${JAVA_HOME}/jre/lib/ext/localedata.jar" />

   
   <pathelement location="${jwsdp.home}/jstl/tld" />

   <pathelement path="${jwsdp.class.path}"/>
   <pathelement path="${deprecated.jwsdp.class.path}"/>

    <pathelement location="${JAVA_HOME}/jre/lib/ext/access-bridge.jar" />
    <pathelement location="${JAVA_HOME}/jre/lib/ext/jaccess.jar" />

  </path>

  <syspropertyset id="base.sys.properties">
    <sysproperty key="java.ext.dirs"
                path="${jwsdp.home}/lib/ext:${JAVA_HOME}/jre/lib/ext"/>
    <!-- set up JAXP 1.2 -->
    <!-- Because of package renaming we don't need to use endorsed
         mechanism. Setting Factory properties after making the jar
         files available in the classpath is sufficient. 
    <sysproperty key="java.endorsed.dirs"
                file="${jwsdp.home}/jaxp/lib/endorsed"/>
    -->

    <sysproperty key="javax.xml.parsers.SAXParserFactory"
               value="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
    <sysproperty key="javax.xml.parsers.DocumentBuilderFactory"
               value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
    <sysproperty key="javax.xml.transform.TransformerFactory"
               value="com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"/>
    <sysproperty key="org.xml.sax.parser"
               value="org.xml.sax.helpers.XMLReaderAdapter"/>
    <sysproperty key="org.xml.sax.driver"
               value="com.sun.org.apache.xerces.internal.parsers.SAXParser"/>
    <sysproperty key="java.security.auth.login.config"
               value="${jwsdp.home}/xws-security/etc/server-config.jaas"/>

  </syspropertyset>

  <!-- the standard jvmargs -->
  <jvmargset id="base.jvm.args">
    <jvmarg line="${jwsdp.vm.args}"/>
    <jvmarg line="${deprecated.jwsdp.vm.args}"/>

    <jvmarg value="-sourcepath" if="jdb"/>
    <jvmarg path="${jwsdp.home}/../../src/share:${jwsdp.home}/../../src/tools" if="jdb"/>
  </jvmargset>

  <!-- Targets to execute applications -->

  <target name="setjdb" description="Set JDB properties" if="debug">

    <property name="jdb" value="true"/>

  </target>

  <target name="setjpda" description="Set JPDA properties" >

    <condition property="jpda.transport" value="dt_shmem">
      <os family="windows"/>
    </condition>
    <condition property="jpda.transport" value="dt_socket">
      <not>
        <os family="windows"/>
      </not>
    </condition>
    <condition property="jpda.address" value="jdbconn">
      <equals arg1="${jpda.transport}" arg2="dt_shmem"/>
    </condition>
    <condition property="jpda.address" value="9876">
      <not>
        <equals arg1="${jpda.transport}" arg2="dt_shmem"/>
      </not>
    </condition>
    <property name="jpda.suspend" value="y"/>
    <property name="jpda.settings" value="transport=${jpda.transport},address=${jpda.address},server=y,suspend=${jpda.suspend}"/>

  </target>

  <target name="jwsdp" depends="setjdb,setjpda">

    <!--
      Make sure that the policy file path is property converted to the
      local platform since we need to precede it with a "=" when assigning
      it to a system property
    -->
    <property name="policy.file"
          location="${jwsdp.home}/conf/catalina.policy"/>

    <!--<property name="print" value="true" /> -->

    <!-- Execute the Catalina server -->
    <launch classname="org.apache.catalina.startup.Bootstrap"
            requiretools="true"
            print="${print}"
            debug="${jdb}"
            usesystemin="false"
            waitforchild="${wait}"
            redirectoutput="true"
            output="${jwsdp.home}/logs/launcher.server.log"
            appendoutput="true"
	    filterclassname="com.sun.jwsdp.launcher.JWSDPLaunchFilter"
            displayMinimizedWindow="true"
            minimizedWindowTitle="${jwsdp.running}">
	<jvmarg value="-Dhttp.proxyHost=${http.proxyHost}" />
        <jvmarg value="-Dhttp.proxyPort=${http.proxyPort}" />
        <jvmarg value="-Dhttps.proxyHost=${https.proxyHost}" />
        <jvmarg value="-Dhttps.proxyPort=${https.proxyPort}" />
        <jvmarg value="-Dftp.proxyHost=${ftp.proxyHost}" />
        <jvmarg value="-Dftp.proxyPort=${ftp.proxyPort}" />
        <jvmarg value="-Dsun.io.useCanonCaches=false" />
	<jvmarg line="${CATALINA_OPTS}" if="CATALINA_OPTS" />


        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <sysproperty key="jwsdp.container.type" value="tomcat" />
        <sysproperty key="jpda.settings" value="${jpda.settings}" />
        <sysproperty key="catalina.home" value="${jwsdp.home}"/>
        <sysproperty key="catalina.base" value="${jwsdp.home}"/>
	<!--
        <sysproperty key="jsse.home" value="${jwsdp.home}/jwsdp-shared"/>
	-->
        <sysproperty key="java.protocol.handler.pkgs" value="com.sun.net.ssl.internal.www.protocol"/>
        <sysproperty key="ANT_HOME" value="${ANT_HOME}"/>
        <sysproperty key="javax.naming.Context.INITIAL_CONTEXT_FACTORY" value="org.apache.naming.java.javaURLContextFactory"/>
	
        <sysproperty key="catalina.useNaming" value="true"/>

    <!-- RegistryServer and Xindice need to know where to find database(s) for bootstraping -->
	<sysproperty key="jwsdp.home"                                     value="${jwsdp.home}"/>
	<sysproperty key="org.apache.xindice.root-collection" value="${jwsdp.home}/registry-server/Xindice/db"/>
    <sysproperty key="xindice.db.home"                              value="${jwsdp.home}/registry-server/Xindice"/>
    <!--
    	to change the host and port that the RegistryServer uses to connect to Xindice, update the following properties:
        <sysproperty key="org.apache.xindice.host" value="desired Xindice host"/>
        <sysproperty key="org.apache.xindice.port" value="desired Xindice port"/>
	-->
	
        <classpath>
          <path refid="base.class.path"/>
        </classpath>
    </launch>

  </target>

 
  <target name="wscompile" depends="setjdb,setjpda">
    <launch classname="com.sun.xml.rpc.tools.wscompile.Main"
            requiretools="true"
            print="${print}"
            debug="${jdb}">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

  <target name="wsdeploy" depends="setjdb,setjpda">
    <launch classname="com.sun.xml.rpc.tools.wsdeploy.Main"
            requiretools="true"
            print="${print}"
            debug="${jdb}">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

   <target name="wsi-retailer-client" depends="setjdb,setjpda">
    <launch classname="com.sun.wsi.scm.retailer.RetailerClient"
            requiretools="true"
            print="${print}"
            debug="${jdb}">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <sysproperty key="http.proxyHost" value="${http.proxyHost}"/>
        <sysproperty key="http.proxyPort" value="${http.proxyPort}"/>
        <sysproperty key="retailer.soap.msgs.file" value="retailer-soap-msgs.txt/"/>
        <sysproperty key="logging.soap.msgs.file" value="logging-soap-msgs.txt/"/>
        <sysproperty key="vendor.config.file" value="${wsi-sampleapp.home}/etc/vendor-config.xml/"/>
        <sysproperty key="retailer.config.file" value="${wsi-sampleapp.home}/etc/retailer-config.xml/"/>
        <sysproperty key="endpoints.props" value="${wsi-sampleapp.home}/etc/endpoints.props/"/>
	<sysproperty key="retailer.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/retailer.client_en.properties"/>
	<sysproperty key="reporter.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/reporter.client_en.properties"/>
        <sysproperty key="log.home" value="${wsi-sampleapp.home}/logs"/>
        <sysproperty key="log.file" value="retailer-results.xml"/>
	<sysproperty key="html.style" value="${wsi-sampleapp.home}/etc/retailer-results.xsl"/>
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

   <target name="wsi-query-client" depends="setjdb,setjpda">
    <launch classname="com.sun.wsi.scm.configurator.WSIQuery"
            requiretools="true"
            print="${print}"
            debug="${jdb}">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <sysproperty key="endpoint" value="${configurator.endpoint}"/>
        <sysproperty key="http.proxyHost" value="${http.proxyHost}"/>
        <sysproperty key="http.proxyPort" value="${http.proxyPort}"/>
        <sysproperty key="query.manager" value="http://uddi.ibm.com/ubr/inquiryapi/"/>
        <sysproperty key="lifecycle.manager" value="http://uddi.ibm.com/ubr/publishapi/"/>
	<sysproperty key="refresh" value="${configurator.refresh}"/>
	<sysproperty key="configurator.soap.msgs.file" value="configurator-soap-msgs.txt"/>
	<sysproperty key="query.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/configurator.client_en.properties"/>
	<sysproperty key="reporter.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/reporter.client_en.properties"/>
	<sysproperty key="log.home" value="${wsi-sampleapp.home}/logs"/>
        <sysproperty key="log.file" value="query-results.xml"/>
	<sysproperty key="html.style" value="${wsi-sampleapp.home}/etc/query-results.xsl"/>
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

  <target name="wsi-catalog-client" depends="setjdb,setjpda">
     <launch classname="com.sun.wsi.scm.catalog.CatalogClient"
            requiretools="true"
            print="${print}"
            debug="${jdb}">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
	<sysproperty key="soap.msgs.file" value="catalog-soap-msgs.text"/>
	<sysproperty key="endpoints.props" value="${wsi-sampleapp.home}/etc/endpoints.props"/>
	<sysproperty key="retailer.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/retailer.client_en.properties"/>
	<sysproperty key="catalog.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/catalog.client_en.properties"/>
	<sysproperty key="reporter.props" value="${wsi-sampleapp.home}/src/com/sun/wsi/scm/resources/reporter.client_en.properties"/>
	<sysproperty key="catalog" value="${catalog.level}"/>
	<sysproperty key="endpoint" value="${catalog.endpoint}"/>
        <sysproperty key="log.home" value="${wsi-sampleapp.home}/logs"/>
        <sysproperty key="log.file" value="catalog-results.xml"/>
	<sysproperty key="html.style" value="${wsi-sampleapp.home}/etc/catalog-results.xsl"/>

        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

  <!-- Target that executes Ant -->
  <target name="ant" description="Execute Ant using the Launcher"
    depends="setjdb,setjpda">

    <property name="wait" value="true" />
    <!--
      Execute Ant in a separate process. Note the use if "if" and "unless"
      attributes to control the passing of arguments to Ant.
     -->
    <launch classname="org.apache.tools.ant.Main"
      waitforchild="${wait}"
      debug="${jdb}"
      print="${print}"
      requiretools="true"
      redirectoutput="true"
      output="${jwsdp.home}/logs/ant.log"
      displayMinimizedWindow="true"
      disposeMinimizedWindow="true"
      minimizedWindowTitle="Ant">
        <jvmargset refid="base.jvm.args"/>
        <syspropertyset refid="base.sys.properties"/>
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
	<sysproperty key="jwsdp.home" value="${jwsdp.home}" />
    </launch>

  </target>

  <target name="xjc" depends="setjdb,setjpda">
    <launch classname="com.sun.tools.xjc.Driver"
            requiretools="true"
            print="${print}"
            output="${jwsdp.home}/logs/xjc.server.log"
            debug="${jdb}">
         <jvmargset refid="base.jvm.args"/>
         <jvmarg value="-Xmx256m"/>
         <jvmarg value="-Xss5m"/>
        <!-- <syspropertyset refid="base.sys.properties"/> -->
        <classpath>
          <path refid="jwsdp.specific.classpath"/>
        </classpath>
    </launch>
  </target>

  <property name="JAXR_HOME" value="${jwsdp.home}/jaxr" />
  <property name="JAXR_LIB" value="${JAXR_HOME}/lib" />
  <property name="SAAJ_HOME" value="${jwsdp.home}/saaj" />
  <property name="JAXP_HOME" value="${jwsdp.home}/jaxp" />
  <property name="JAXB_HOME" value="${jwsdp.home}/jaxb" />

  <path id="jaxr.classpath">
    <fileset dir="${JAXR_LIB}" >
      <include name="*.jar" />
    </fileset>
    <fileset dir="${JAXP_HOME}/lib" >
      <include name="jaxp-api.jar" />
    </fileset>

    <fileset dir="${JAXP_HOME}/lib/endorsed" >
      <include name="*.jar" />
    </fileset>
    <fileset dir="${SAAJ_HOME}/lib" >
      <include name="*.jar" />
    </fileset>
    <fileset dir="${JAXB_HOME}/lib" >
      <include name="*.jar" />
    </fileset>
    <fileset dir="${jwsdp.home}/jwsdp-shared/lib" >
      <include name="*.jar" />
    </fileset>


  </path>

  
  <target name="jaxr-browser" depends="setjdb,setjpda">
    <launch classname="RegistryBrowser"
            requiretools="true"
            print="${print}"
            output="${jwsdp.home}/logs/jaxr-browser.log"
            debug="${jdb}">
         <jvmargset refid="base.jvm.args"/>
         <syspropertyset refid="base.sys.properties"/> 
        <sysproperty key="org.apache.commons.logging.log" value="org.apache.commons.logging.impl.SimpleLog" />
        <sysproperty key="org.apache.commons.logging.simplelog.defaultlog" value="warn" />
	<sysproperty key="http.proxyHost" value="${http.proxyHost}" />
	<sysproperty key="http.proxyPort" value="${http.proxyPort}" />
	<sysproperty key="https.proxyHost" value="${https.proxyHost}" />
	<sysproperty key="https.proxyPort" value="${https.proxyPort}" />
        <classpath>
	  <pathelement location="${jwsdp.home}/jaxr/samples/jaxr-browser/jaxr-browser.jar" />
          <path refid="jaxr.classpath"/>
        </classpath>
    </launch>
  </target>

  <target name="jaxr-query-sample" >
    <echo message="Compiling sources" />
    <javac
        srcdir="${JAXR_HOME}/samples/jaxr-query"
        destdir="${JAXR_HOME}/samples/jaxr-query" includes="*.java">
        <classpath>
	  <pathelement location="${jwsdp.home}/jaxr/samples/jaxr-query" />
          <path refid="jaxr.classpath"/>
        </classpath>
    </javac>

    <echo message="Running Query Sample" />
    <java classname="BusinessQueryTest" fork="true">
        <classpath>
	  <pathelement location="${jwsdp.home}/jaxr/samples/jaxr-query" />
          <path refid="jaxr.classpath" />
        </classpath>
        <sysproperty name="org.apache.commons.logging.log" value="org.apache.commons.logging.impl.SimpleLog" />
        <sysproperty name="org.apache.commons.logging.simplelog.defaultlog" value="warn" />
	<sysproperty key="http.proxyHost" value="${http.proxyHost}" />
	<sysproperty key="http.proxyPort" value="${http.proxyPort}" />
	<sysproperty key="https.proxyHost" value="${https.proxyHost}" />
	<sysproperty key="https.proxyPort" value="${https.proxyPort}" />
    </java>

  </target>

  
  <target name="jaxr-publish-sample" >
    <echo message="Compiling JAXR Publish sample sources" />
    <javac
        srcdir="${JAXR_HOME}/samples/jaxr-publish"
        destdir="${JAXR_HOME}/samples/jaxr-publish" includes="*.java">
        <classpath>
          <pathelement location="${jwsdp.home}/jaxr/samples/jaxr-publish" />
          <path refid="jaxr.classpath"/>
        </classpath>
    </javac>

    <echo message="Running JAXR Publish Sample" />
    <java classname="SaveOrganizationTest" fork="true">
        <classpath>
          <pathelement location="${jwsdp.home}/jaxr/samples/jaxr-publish" />
          <path refid="jaxr.classpath" />
        </classpath>
        <sysproperty name="org.apache.commons.logging.log" value="org.apache.commons.logging.impl.SimpleLog" />
        <sysproperty name="org.apache.commons.logging.simplelog.defaultlog" value="warn" />
        <sysproperty key="http.proxyHost" value="${http.proxyHost}" />
        <sysproperty key="http.proxyPort" value="${http.proxyPort}" />
        <sysproperty key="https.proxyHost" value="${https.proxyHost}" />
        <sysproperty key="https.proxyPort" value="${https.proxyPort}" />
    </java>

  </target>


</project>


