<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<project name="mcf-connector-build">

    <property environment="env"/>

    <target name="setup-maven-url">
	<property name="maven-base-url" value="https://repo1.maven.org/maven2"/>
    </target>
    
    <target name="download-via-maven" depends="setup-maven-url">
	<get src="${maven-base-url}/${project-path}/${artifact-name}/${artifact-version}/${artifact-name}-${artifact-version}.${artifact-type}" dest="${target}/${artifact-name}-${artifact-version}.${artifact-type}"/>
    </target>

    <target name="checkout-source-via-svn">
	<mkdir dir="${root-dir}"/>
	<exec dir="${root-dir}" executable="svn" failifexecutionfails="true" failonerror="true">
	      <arg value="checkout" />
	      <arg value="${svn-url}" />
	      <arg value="${dir-name}" />
	</exec>
    </target>

    <target name="calculate-svn-patch-available">
	<mkdir dir="build/svn-check"/>
	<exec dir="build/svn-check" output="build/svn-check/svn.output" executable="svn" failifexecutionfails="true" failonerror="true">
	      <arg value="--version" />
	</exec>
	<loadfile property="svn-output" srcFile="build/svn-check/svn.output"/>
	<condition property="svn-version-ok">
	    <or>
		<contains string="${svn-output}" substring="1.7."/>
		<contains string="${svn-output}" substring="1.8."/>
		<contains string="${svn-output}" substring="1.9."/>
		<contains string="${svn-output}" substring="1.10."/>
		<contains string="${svn-output}" substring="1.11."/>
	    </or>
	</condition>
    </target>

    <target name="calculate-patch-available" depends="calculate-svn-patch-available" unless="svn-version-ok">
	<condition property="patch-ok">
	    <os family="unix"/>
	</condition>
    </target>
    
    <target name="check-svn-patch-available" depends="calculate-svn-patch-available" unless="svn-version-ok">
	<echo message="You need svn version 1.7 or higher - attempting patch instead."/>
    </target>
    
    <target name="check-patch-available" depends="calculate-patch-available" unless="patch-ok">
    </target>
    
    <target name="patch-source-via-svn" depends="check-svn-patch-available" if="svn-version-ok">
	<mkdir dir="${root-dir}"/>
	<exec dir="${root-dir}" executable="svn" failifexecutionfails="true" failonerror="true">
	      <arg value="patch" />
	      <arg value="${diff-file}" />
	      <arg value="${dir-name}" />
	</exec>
    </target>
    
    <target name="patch-source-via-patch" depends="check-patch-available" if="patch-ok">
	<mkdir dir="${root-dir}"/>
	<exec dir="${root-dir}/${dir-name}" executable="patch" input="../${diff-file}" failifexecutionfails="true" failonerror="true">
	      <arg value="-p0" />
	</exec>
    </target>
    
    <target name="patch-source" depends="patch-source-via-svn,patch-source-via-patch"/>
    
    <target name="build-via-ant">
	<exec osfamily="windows" dir="${root-dir}" executable="cmd" failifexecutionfails="true" failonerror="true">
	    <arg value="/c"/>
	    <arg value="ant.bat"/>
	    <arg value="${target}" />
	</exec>
	<exec osfamily="unix" dir="${root-dir}" executable="ant" failifexecutionfails="true" failonerror="true">
	    <arg value="${target}" />
	</exec>
    </target>
    
    <target name="clean">
	<delete dir="build"/>
	<delete dir="dist"/>
	<delete dir="test-postgresql-output"/>
	<delete dir="test-mysql-output"/>
	<delete dir="test-HSQLDB-output"/>
	<delete dir="test-HSQLDBext-output"/>
    </target>

    <path id="mcf-connector-build.connector-classpath">
	<fileset dir="${mcf-dist}/connector-common-lib">
	    <include name="mcf-connector-common.jar"/>
	</fileset>
	<fileset dir="${mcf-dist}/lib">
	    <include name="mcf-core.jar"/>
	    <include name="mcf-ui-core.jar"/>
	    <include name="mcf-agents.jar"/>
	    <include name="mcf-pull-agent.jar"/>
	</fileset>
	<fileset dir="${mcf-dist}/lib">
	    <include name="zookeeper*.jar"/>
	    <include name="mail*.jar"/>
	    <include name="commons-exec*.jar"/>
	    <include name="guava*.jar"/>
	    <include name="gson*.jar"/>
	    <include name="jna*.jar"/>
	    <include name="json-simple*.jar"/>
	    <include name="commons-codec*.jar"/>
	    <include name="commons-collections*.jar"/>
	    <include name="commons-collections4*.jar"/>
	    <include name="commons-el*.jar"/>
	    <include name="commons-fileupload*.jar"/>
	    <include name="httpcore*.jar"/>
	    <include name="httpclient*.jar"/>
	    <include name="commons-io*.jar"/>
	    <include name="commons-lang*.jar"/>
	    <include name="commons-logging*.jar"/>
	    <include name="eclipse*.jar"/>
	    <include name="jasper*.jar"/>
	    <include name="jetty*.jar"/>
	    <include name="slf4j*.jar"/>
	    <include name="jsp-2.1*.jar"/>
	    <include name="jsp-api*.jar"/>
	    <include name="junit*.jar"/>
	    <include name="selenium*.jar"/>
	    <include name="okhttp*.jar"/>
	    <include name="okio*.jar"/>
	    <include name="byte-buddy*.jar"/>
	    <include name="cglib-nodep*.jar"/>
	    <include name="hamcrest-core*.jar"/>
	    <include name="log4j*.jar"/>
	    <include name="serializer*.jar"/>
	    <include name="javax.servlet-api*.jar"/>
	    <include name="tomcat-juli*.jar"/>
	    <include name="xalan*.jar"/>
	    <include name="xercesImpl*.jar"/>
	    <include name="xml-apis*.jar"/>
	    <include name="velocity*.jar"/>
	</fileset>
	<fileset dir="${mcf-dist}/connector-common-lib">
	    <include name="tika-core*.jar"/>
	    <include name="jackson-core*.jar"/>
	    <include name="jackson-databind*.jar"/>
	    <include name="jackson-annotations*.jar"/>
	    <include name="tika-parsers*.jar"/>
	    <include name="poi*.jar"/>
	    <include name="dom4j*.jar"/>
	    <include name="xmlbeans*.jar"/>
	    <include name="curvesapi*.jar"/>
	    <include name="geoapi*.jar"/>
	    <include name="sis-metadata*.jar"/>
	    <include name="sis-utility*.jar"/>
	    <include name="sis-netcdf*.jar"/>
	    <include name="sis-storage*.jar"/>
	    <include name="opennlp-tools*.jar"/>
	    <include name="jackcess*.jar"/>
	    <include name="junrar*.jar"/>
	    <include name="commons-vfs2*.jar"/>
	    <include name="commons-csv*.jar"/>
	    <include name="commons-exec*.jar"/>
	    <include name="netcdf4*.jar"/>
	    <include name="httpservices*.jar"/>
	    <include name="grib*.jar"/>
	    <include name="cdm*.jar"/>
	    <include name="udunits*.jar"/>
	    <include name="jcommander*.jar"/>
	    <include name="jcip-annotations*.jar"/>
	    <include name="ehcache-core*.jar"/>
	    <include name="bzip2*.jar"/>
	    <include name="jdom2*.jar"/>
	    <include name="quartz*.jar"/>
	    <include name="c3p0*.jar"/>
	    <include name="tagsoup*.jar"/>
	    <include name="vorbis-java*.jar"/>
	    <include name="apache-mime4j-core*.jar"/>
	    <include name="apache-mime4j-dom*.jar"/>
	    <include name="commons-compress*.jar"/>
	    <include name="pdfbox*.jar"/>
	    <include name="fontbox*.jar"/>
	    <include name="jempbox*.jar"/>
	    <include name="bcmail-jdk15on*.jar"/>
	    <include name="bcprov-jdk15on*.jar"/>
	    <include name="bcpkix-jdk15on*.jar"/>
	    <include name="geronimo-stax-api_1.0_spec*.jar"/>
	    <include name="asm*.jar"/>
	    <include name="isoparser*.jar"/>
	    <include name="aspectjrt*.jar"/>
	    <include name="metadata-extractor*.jar"/>
	    <include name="xmpcore*.jar"/>
	    <include name="xml-apis*.jar"/>
	    <include name="boilerpipe*.jar"/>
	    <include name="rome*.jar"/>
	    <include name="jdom*.jar"/>
	    <include name="xercesImpl*.jar"/>
	    <include name="vorbis-java-core*.jar"/>
	    <include name="juniversalchardet*.jar"/>
	    <include name="jhighlight*.jar"/>
	    <include name="jmatio*.jar"/>
	    <include name="java-libpst*.jar"/>
	    <include name="xz*.jar"/>
	    <include name="cxf-core*.jar"/>
	    <include name="cxf-rt-frontend-jaxrs*.jar"/>
	    <include name="cxf-rt-transports-http*.jar"/>
	    <include name="cxf-rt-rs-client*.jar"/>
	    <include name="xmlschema-core*.jar"/>
	    <include name="javax.annotation-api*.jar"/>
	    <include name="javax.ws.rs-api*.jar"/>
	</fileset>
	<fileset dir="${mcf-dist}/connector-common-lib">
	    <include name="axis*.jar"/>
	    <include name="saaj*.jar"/>
	    <include name="wsdl4j*.jar"/>
	    <include name="wss4j*.jar"/>
	    <include name="xmlsec*.jar"/>
	    <include name="opensaml*.jar"/>
	    <include name="commons-discovery*.jar"/>
	    <include name="activation*.jar"/>
	    <include name="castor*.jar"/>
	    <include name="geronimo-javamail_1.4_spec*.jar"/>
	</fileset>
	<pathelement location="build/stubclasses"/>
	<pathelement location="build/wsdlclasses"/>
	<pathelement location="build/xsdclasses"/>
	<pathelement location="build/interface/classes"/>
	<pathelement location="build/rmistub/classes"/>
    </path>
    
    <path id="connector-classpath">
	<path refid="mcf-connector-build.connector-classpath"/>
    </path>

    <path id="mcf-connector-build.connector-test-classpath">
	<path refid="connector-classpath"/>
	<pathelement location="build/connector/classes"/>
	<fileset dir="${mcf-dist}/test-lib"/>
	<fileset dir="${mcf-dist}/lib">
	    <include name="postgresql*.jar"/>
	    <include name="hsqldb*.jar"/>
	</fileset>
	<fileset dir="${mcf-dist}/lib-proprietary">
	    <include name="mysql*.jar"/>
	</fileset>
    </path>

    <path id="connector-test-classpath">
	<path refid="mcf-connector-build.connector-test-classpath"/>
    </path>

    <path id="mcf-connector-build.implementation-classpath">
	<pathelement location="build/interface/classes"/>
	<pathelement location="build/stubclasses"/>
    </path>

    <path id="implementation-classpath">
	<path refid="mcf-connector-build.implementation-classpath"/>
    </path>

    <path id="mcf-connector-build.interface-classpath">
    </path>

    <path id="interface-classpath">
	<path refid="mcf-connector-build.interface-classpath"/>
    </path>

    <!-- Standard connector proprietary/non-proprietary setup described below.
    (1) If there's a lib-proprietary directory, we presume that the connector requires one or
	more proprietary libraries to build and run.  We expect to find a README.txt file in
	the directory, which describes what is needed at build time, and that if the required
	libraries are not present, the connector's build.xml file will override "calculate-condition"
	and "precompile-check" appropriately.  If there's a "proprietary-library-instructions.txt" file,
	it will be copied to the connector-lib directory with the name {connector}-README.txt.
	If the required libraries are not present, the same file will also be copied to {connector}-PLACEHOLDER.txt.
    (2) If there's a build-stub directory, we presume that the connector requires one or
	more proprietary libraries to run, but can be built without proprietary libraries through
	the use of stubs.  In this case the connector MAY also have a
	"proprietary-library-instructions.txt" file, if proprietary libraries are required at
	runtime.  This file will be copied to the
	connector-lib directory with the name {connector}-README.txt and to {connector}-PLACEHOLDER.txt,
	as a placeholder for the required proprietary libraries.

    A connector can have both a build-stub and a lib-proprietary directory.  In this case,
    the connector will build against stubs but will deliver proprietary libraries to
    connector-lib-proprietary for use at runtime, and the {connector}-README.txt
    file will only be delivered to the connector-lib directory.
    -->
    
    <target name="calculate-condition">
	<available file="build.xml" property="build-present"/>
    </target>

    <target name="calculate-testcode-condition">
	<available file="connector/src/test/java" property="tests-present"/>
    </target>

    <target name="calculate-run-condition">
	<property name="libs-present" value="true"/>
    </target>

    <target name="precompile-warn" depends="calculate-condition" unless="build-present"/>

    <target name="pretest-warn" depends="calculate-testcode-condition" unless="tests-present"/>

    <target name="prerun-warn" depends="calculate-run-condition" unless="libs-present"/>


    <target name="precompile-check" depends="precompile-warn">
	<condition property="canBuild">
	    <isset property="build-present"/>
	</condition>
    </target>
    
    <target name="pretest-check" depends="precompile-warn,pretest-warn">
	<condition property="canTest">
	    <and>
		<isset property="build-present"/>
		<isset property="tests-present"/>
	    </and>
	</condition>
    </target>

    <target name="prerun-check" depends="precompile-warn,prerun-warn">
	<condition property="canRun">
	    <and>
		<isset property="build-present"/>
		<isset property="libs-present"/>
	    </and>
	</condition>
    </target>

    <target name="has-stubs-check" depends="precompile-check" if="canBuild">
	<available file="build-stub/src/main/java" property="hasStubs"/>
    </target>

    <target name="has-proprietary-materials-check">
    </target>
    
    <target name="build-stubs-check" depends="has-stubs-check,has-proprietary-materials-check" if="hasStubs">
	<condition property="buildStubs">
	    <not>
		<isset property="proprietaryMaterialsAvailable"/>
	    </not>
	</condition>
    </target>

    <target name="include-README-lib-proprietary-check" depends="precompile-check" if="canBuild">
	<available file="proprietary-library-instructions.txt" property="includeREADMELibProprietary"/>
    </target>
    
    <target name="include-proprietary-instructions-lib-proprietary-check" depends="prerun-check" unless="canRun">
	<available file="proprietary-library-instructions.txt" property="includeProprietaryInstructionsLibProprietary"/>
    </target>

    <target name="compile-stubs" depends="build-stubs-check" if="buildStubs">
	<mkdir dir="build/stubclasses"/>
	<javac srcdir="build-stub/src/main/java" destdir="build/stubclasses" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
	    </classpath>
	</javac>
    </target>

    <target name="has-tests-check" depends="pretest-check">
	<condition property="hasTests">
	    <isset property="canTest"/>
	</condition>
    </target>

    <target name="has-test-resources-check" depends="has-tests-check" if="hasTests">
	<available file="connector/src/test/resources" property="hasTestResources"/>
    </target>

    <target name="has-native2ascii-check" depends="precompile-check" if="canBuild">
	<available file="connector/src/main/native2ascii" property="hasNative2Ascii"/>
    </target>

    <target name="has-resources-check" depends="precompile-check" if="canBuild">
	<available file="connector/src/main/resources" property="hasResources"/>
    </target>

    <target name="has-RMI-check" depends="precompile-check" if="canBuild">
	<available file="implementation" property="hasImplementation"/>
	<available file="interface" property="hasInterface"/>
	<available file="server" property="hasServer"/>
	<available file="registry" property="hasRegistry"/>
	<condition property="hasRMI">
	    <and>
		<isset property="hasImplementation"/>
		<isset property="hasInterface"/>
		<isset property="hasServer"/>
		<isset property="hasRegistry"/>
	    </and>
	</condition>
    </target>

    <target name="classcreate-wsdl-cxf">
          <mkdir dir="build/wsdljava"/>
          <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
              <classpath>
                  <fileset dir="${mcf-dist}/connector-common-lib">
                      <include name="cxf*.jar"/>
                      <include name="jaxb*.jar"/>
                      <include name="wsdl4j*.jar"/>
                      <include name="woodstox*.jar"/>
                      <include name="stax2-api*.jar"/>
                      <include name="xmlschema*.jar"/>
                      <include name="neethi*.jar"/>
                      <include name="xml-resolver*.jar"/>
                  </fileset>
                  <fileset dir="${mcf-dist}/lib">
                      <include name="velocity*.jar"/>
                      <include name="commons-collections*.jar"/>
                      <include name="commons-lang*.jar"/>
                  </fileset>
              </classpath>
              <jvmarg value="-Dorg.apache.cxf.stax.allowInsecureParser=1"/>
              <jvmarg value="-Dfile.encoding=UTF-8"/>
              <arg value="-client"/>
              <arg value="-exsh"/>
              <arg value="true"/>
              <arg value="-wsdlLocation"/>
              <arg value="http://localhost/${wsdlname}"/>
              <arg value="-d"/>
              <arg value="build/wsdljava"/>
              <arg value="${wsdlname}"/>
          </java>
    </target>

    <target name="classcreate-wsdl">
	<mkdir dir="build/wsdljava"/>
	<java classname="org.apache.axis.wsdl.WSDL2Java" fork="true">
	    <classpath>
		<fileset dir="${mcf-dist}/connector-common-lib">
		    <include name="axis*.jar"/>
		    <include name="saaj*.jar"/>
		    <include name="wsdl*.jar"/>
		    <include name="mail*.jar"/>
		    <include name="activation*.jar"/>
		    <include name="commons-discovery*.jar"/>
		</fileset>
		<fileset dir="${mcf-dist}/lib">
		    <include name="commons-logging*.jar"/>
		</fileset>
	    </classpath>
	    <jvmarg value="-Dfile.encoding=UTF-8"/>
	    <arg value="--timeout"/>
	    <arg value="0"/>
	    <arg value="--noImports"/>
	    <arg value="-o"/>
	    <arg value="build/wsdljava"/>
	    <arg value="${wsdlname}"/>
	</java>
    </target>

    <target name="classcreate-xsd">
	<mkdir dir="build/xsdjava"/>
	<java classname="org.exolab.castor.builder.SourceGeneratorMain" fork="true">
	    <classpath>
		<fileset dir="${mcf-dist}/connector-common-lib">
		    <include name="castor*.jar"/>
		    <include name="geronimo-activation_1.1_spec*.jar"/>
		    <include name="geronimo-javamail_1.4_spec*.jar"/>
		    <include name="xerces*.jar"/>
		</fileset>
		<fileset dir="${mcf-dist}/lib">
		    <include name="commons-logging*.jar"/>
		</fileset>
	    </classpath>
	    <jvmarg value="-Dfile.encoding=UTF-8"/>
	    <arg value="-i"/>
	    <arg value="${xsdname}"/>
	    <arg value="-f"/>
	    <arg value="-dest"/>
	    <arg value="build/xsdjava"/>
	    <arg value="-package"/>
	    <arg value="org.apache.manifoldcf.crawler.connectors.${packagename}"/>
	</java>
    </target>

    <target name="classcreate-xsd-bindings">
	<mkdir dir="build/xsdjava"/>
	<java classname="org.exolab.castor.builder.SourceGeneratorMain" fork="true">
              <classpath>
                  <fileset dir="${mcf-dist}/connector-common-lib">
                      <include name="castor*.jar"/>
                      <include name="geronimo-activation_1.1_spec*.jar"/>
                      <include name="geronimo-javamail_1.4_spec*.jar"/>
                      <include name="xerces*.jar"/>
                  </fileset>
                  <fileset dir="${mcf-dist}/lib">
                      <include name="commons-logging*.jar"/>
                  </fileset>
              </classpath>
              <jvmarg value="-Dfile.encoding=UTF-8"/>
              <arg value="-i"/>
              <arg value="${xsdname}"/>
              <arg value="-binding-file"/>
              <arg value="${bindingfile}"/>
              <arg value="-f"/>
              <arg value="-dest"/>
              <arg value="build/xsdjava"/>
              <arg value="-package"/>
              <arg value="org.apache.manifoldcf.crawler.connectors.${packagename}"/>
          </java>
    </target>

    <target name="classcreate-wsdls"/>

    <target name="has-wsdls-check" depends="classcreate-wsdls,precompile-check" if="canBuild">
	<available file="build/wsdljava" property="hasWSDLs"/>
    </target>

    <target name="compile-wsdls" depends="has-wsdls-check" if="hasWSDLs">
	<mkdir dir="build/wsdlclasses"/>
	<javac srcdir="build/wsdljava" destdir="build/wsdlclasses" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<fileset dir="${mcf-dist}/connector-common-lib">
		    <include name="axis*.jar"/>
		    <include name="saaj*.jar"/>
		    <include name="wsdl*.jar"/>
		    <include name="activation*.jar"/>
		    <include name="commons-discovery*.jar"/>
		    <include name="commons-logging*.jar"/>
		</fileset>
	    </classpath>
	</javac>
    </target>

    <target name="classcreate-xsds"/>
    
    <target name="has-xsds-check" depends="classcreate-xsds,precompile-check" if="canBuild">
	<available file="build/xsdjava" property="hasXSDs"/>
    </target>

    <target name="compile-xsds" depends="has-xsds-check" if="hasXSDs">
	<mkdir dir="build/xsdclasses"/>
	<javac srcdir="build/xsdjava" destdir="build/xsdclasses" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<fileset dir="${mcf-dist}/connector-common-lib">
		    <include name="castor*.jar"/>
		</fileset>
	    </classpath>
	</javac>
    </target>

    <target name="setup-rmic" depends="has-RMI-check" if="hasRMI">
	<mkdir dir="build/rmijava"/>
	<copy todir="build/rmijava">
	    <fileset dir="implementation/src/main/java"/>
	</copy>
    </target>

    <target name="rmic-build">
	<rmic base="build/rmijava" classname="${classname}">
	    <classpath>
		<path refid="implementation-classpath"/>
		<pathelement location="build/implementation/classes"/>
	    </classpath>
	</rmic>
    </target>

    <target name="rmic-build-all" depends="compile-implementation,compile-interface,setup-rmic,has-RMI-check" if="hasRMI"/>

    <target name="doc-rmi" depends="compile-wsdls,compile-xsds,has-RMI-check" if="hasRMI">
	<mkdir dir="dist/doc"/>
	<javadoc destdir="dist/doc" source="1.8" use="true" locale="en_US">
	    <link href="http://docs.oracle.com/javase/8/docs/api/"/>
	    <link href="http://manifoldcf.apache.org/release/trunk/api/framework/"/>
	    <classpath>
		<path refid="connector-classpath"/>
	    </classpath>
	    <fileset dir="interface/src/main/java" includes="**/*.java"/>
	    <fileset dir="connector/src/main/java" includes="**/*.java"/>
	</javadoc>
    </target>

    <target name="doc" depends="compile-stubs,doc-rmi,compile-wsdls,compile-xsds,has-RMI-check,precompile-check" if="canBuild" unless="hasRMI">
	<mkdir dir="dist/doc"/>
	<javadoc destdir="dist/doc" source="1.8" use="true" locale="en_US">
	    <link href="http://docs.oracle.com/javase/8/docs/api/"/>
	    <link href="http://manifoldcf.apache.org/release/trunk/api/framework/"/>
	    <classpath>
		<path refid="connector-classpath"/>
	    </classpath>
	    <fileset dir="connector/src/main/java" includes="**/*.java"/>
	</javadoc>
    </target>

    <target name="compile-connector-resources" depends="has-resources-check" if="hasResources">
	<mkdir dir="build/connector/classes"/>
	<copy todir="build/connector/classes">
	    <fileset dir="connector/src/main/resources"/>
	</copy>
    </target>

    <target name="compile-connector-native2ascii" depends="has-native2ascii-check" if="hasNative2Ascii">
	<mkdir dir="build/connector/classes"/>
	<native2ascii encoding="UTF-8" src="connector/src/main/native2ascii" dest="build/connector/classes" includes="**/*.properties" />
    </target>
    
    <target name="compile-rmic" depends="rmic-build-all,has-RMI-check" if="hasRMI">
	<mkdir dir="build/rmiskel/classes"/>
	<copy todir="build/rmiskel/classes">
	    <fileset dir="build/rmijava">
		<include name="**/*_Skel.class"/>
	    </fileset>
	</copy>
	<mkdir dir="build/rmistub/classes"/>
	<copy todir="build/rmistub/classes">
	    <fileset dir="build/rmijava">
		<include name="**/*_Stub.class"/>
	    </fileset>
	</copy>
    </target>
    
    <target name="compile-server" depends="compile-interface,compile-implementation,compile-rmic,has-RMI-check" if="hasRMI">
	<mkdir dir="build/server/classes"/>
	<javac srcdir="server/src/main/java" destdir="build/server/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<pathelement location="build/interface/classes"/>
		<pathelement location="build/implementation/classes"/>
		<pathelement location="build/rmistub/classes"/>
		<pathelement location="build/rmiskel/classes"/>
	    </classpath>
	</javac>
    </target>

    <target name="compile-registry" depends="compile-interface,has-RMI-check" if="hasRMI">
	<mkdir dir="build/registry/classes"/>
	<javac srcdir="registry/src/main/java" destdir="build/registry/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<pathelement location="build/interface/classes"/>
	    </classpath>
	</javac>
    </target>

    <target name="compile-connector" depends="compile-stubs,compile-connector-native2ascii,compile-connector-resources,compile-wsdls,compile-xsds,compile-interface,compile-rmic,precompile-check" if="canBuild">
	<mkdir dir="build/connector/classes"/>
	<javac srcdir="connector/src/main/java" destdir="build/connector/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<path refid="connector-classpath"/>
	    </classpath>
	</javac>
    </target>

    <target name="compile-implementation" depends="compile-stubs,compile-interface,has-RMI-check" if="hasRMI">
	<mkdir dir="build/implementation/classes"/>
	<javac srcdir="implementation/src/main/java" destdir="build/implementation/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<path refid="implementation-classpath"/>
	    </classpath>
	</javac>
    </target>

    <target name="compile-interface" depends="has-RMI-check" if="hasRMI">
	<mkdir dir="build/interface/classes"/>
	<javac srcdir="interface/src/main/java" destdir="build/interface/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<path refid="interface-classpath"/>
	    </classpath>
	</javac>
    </target>

    <target name="compile-test-resources" depends="has-test-resources-check" if="hasTestResources">
	<mkdir dir="build/connector-tests/classes"/>
	<copy todir="build/connector-tests/classes">
	    <fileset dir="connector/src/test/resources"/>
	</copy>
    </target>

    <target name="compile-tests" depends="compile-connector,compile-test-resources,has-tests-check" if="hasTests">
	<mkdir dir="build/connector-tests/classes"/>
	<javac srcdir="connector/src/test/java" destdir="build/connector-tests/classes" deprecation="true" target="1.8" source="1.8" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
	    <classpath>
		<path refid="connector-test-classpath"/>
	    </classpath>
	</javac>
    </target>

    <target name="jar-connector" depends="compile-connector,precompile-check" if="canBuild">
          <mkdir dir="build/xsdclasses"/>
          <mkdir dir="build/wsdlclasses"/>
          <mkdir dir="build/jar"/>
          <mkdir dir="build/metainf"/>
          <jar destfile="build/jar/mcf-${ant.project.name}-connector.jar">
            <fileset dir="build/connector/classes"/>
            <fileset dir="build/xsdclasses"/>
            <fileset dir="build/wsdlclasses"/>
            <metainf dir="build/metainf"/>
          </jar>
    </target>

    <target name="jar-interface" depends="compile-interface,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-interface.jar" basedir="build/interface/classes"/>
    </target>

    <target name="jar-implementation" depends="compile-implementation,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-implementation.jar" basedir="build/implementation/classes"/>
    </target>

    <target name="jar-rmiskel" depends="compile-rmic,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-rmiskel.jar" basedir="build/rmiskel/classes"/>
    </target>

    <target name="jar-rmistub" depends="compile-rmic,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-rmistub.jar" basedir="build/rmistub/classes"/>
    </target>

    <target name="jar-server" depends="compile-server,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-server.jar" basedir="build/server/classes"/>
    </target>

    <target name="jar-registry" depends="compile-registry,has-RMI-check" if="hasRMI">
	<mkdir dir="build/jar"/>
	<jar destfile="build/jar/mcf-${ant.project.name}-connector-registry.jar" basedir="build/registry/classes"/>
    </target>

    <target name="lib-rmi" depends="jar-interface,jar-rmistub,has-RMI-check" if="hasRMI">
	<mkdir dir="dist/lib"/>
	<copy todir="dist/lib" file="build/jar/mcf-${ant.project.name}-connector-rmistub.jar"/>
	<copy todir="dist/lib" file="build/jar/mcf-${ant.project.name}-connector-interface.jar"/>
    </target>
    
    <target name="lib-wsdls" depends="has-wsdls-check" if="hasWSDLs">
	<!-- mkdir dir="dist/lib"/>
	<copy todir="dist/lib">
	    <fileset dir="${mcf-dist}/lib">
		<include name="axis*.jar"/>
		<include name="saaj*.jar"/>
		<include name="wsdl*.jar"/>
		<include name="activation*.jar"/>
		<include name="commons-discovery*.jar"/>
	    </fileset>
	</copy -->
    </target>

    <target name="lib-xsds" depends="has-xsds-check" if="hasXSDs">
	<!-- mkdir dir="dist/lib"/>
	<copy todir="dist/lib">
	    <fileset dir="${mcf-dist}/lib">
		<include name="castor*.jar"/>
		<include name="geronimo-activation_1.1_spec*.jar"/>
		<include name="geronimo-javamail_1.4_spec*.jar"/>
	    </fileset>
	</copy -->
    </target>

    <target name="lib" depends="lib-rmi,lib-wsdls,lib-xsds,jar-connector,precompile-check" if="canBuild">
	<mkdir dir="dist/lib"/>
	<copy todir="dist/lib" file="build/jar/mcf-${ant.project.name}-connector.jar"/>
    </target>

    <target name="lib-proprietary-README" depends="include-README-lib-proprietary-check" if="includeREADMELibProprietary">
	<mkdir dir="dist/lib-proprietary-only"/>
	<copy tofile="dist/lib-proprietary-only/${ant.project.name}-README.txt" file="proprietary-library-instructions.txt"/>
    </target>
    
    <target name="lib-proprietary-instructions" depends="include-proprietary-instructions-lib-proprietary-check" if="includeProprietaryInstructionsLibProprietary">
	<mkdir dir="dist/lib-proprietary-only"/>
	<copy tofile="dist/lib-proprietary-only/${ant.project.name}-PLACEHOLDER.txt" file="proprietary-library-instructions.txt"/>
    </target>
    
    <target name="server-process" depends="jar-interface,jar-implementation,jar-rmiskel,jar-server,has-RMI-check" if="hasRMI">
	<mkdir dir="dist/server-process/lib"/>
	<copy todir="dist/server-process/lib">
	    <fileset dir="build/jar">
		<include name="mcf-${ant.project.name}-connector-server.jar"/>
		<include name="mcf-${ant.project.name}-connector-interface.jar"/>
		<include name="mcf-${ant.project.name}-connector-rmiskel.jar"/>
		<include name="mcf-${ant.project.name}-connector-implementation.jar"/>
	    </fileset>
	</copy>
	<copy todir="dist/server-process">
	    <fileset dir="server-scripts">
		<include name="*.sh"/>
		<include name="*.bat"/>
	    </fileset>
	</copy>
    </target>

    <target name="registry-process" depends="jar-registry,has-RMI-check" if="hasRMI">
	<mkdir dir="dist/registry-process/lib"/>
	<copy todir="dist/registry-process/lib">
	    <fileset dir="build/jar">
		<include name="mcf-${ant.project.name}-connector-registry.jar"/>
		<include name="mcf-${ant.project.name}-connector-interface.jar"/>
	    </fileset>
	</copy>
	<copy todir="dist/registry-process">
	    <fileset dir="registry-scripts">
		<include name="*.sh"/>
		<include name="*.bat"/>
	    </fileset>
	</copy>
    </target>

    <!-- Override this target to provide integration materials to the connector dist area -->
    <target name="integration" depends="precompile-check" if="canBuild"/>

    <!-- Delivery targets.  These targets conditionally deliver code and connectors.xml lines
	into the main distribution area.
    -->
    
    <target name="general-connector-integration-check" depends="integration" if="canBuild">
	<available file="dist/integration" type="dir" property="has-integration"/>
    </target>

    <target name="general-server-process-check" depends="server-process" if="canBuild">
	<available file="dist/server-process" type="dir" property="has-server-process"/>
    </target>

    <target name="general-registry-process-check" depends="registry-process" if="canBuild">
	<available file="dist/registry-process" type="dir" property="has-registry-process"/>
    </target>

    <target name="general-connector-delivery-integration" depends="general-connector-integration-check" if="has-integration">
	<mkdir dir="${mcf-dist}/plugins/${ant.project.name}"/>
	<copy todir="${mcf-dist}/plugins/${ant.project.name}">
	    <fileset dir="dist/integration"/>
	</copy>
    </target>

    <target name="general-delivery-server-process" depends="general-server-process-check" if="has-server-process">
	<mkdir dir="${mcf-dist}/processes/${ant.project.name}-server"/>
	<copy todir="${mcf-dist}/processes/${ant.project.name}-server">
	    <fileset dir="dist/server-process"/>
	</copy>
    </target>

    <target name="general-delivery-registry-process" depends="general-registry-process-check" if="has-registry-process">
	<mkdir dir="${mcf-dist}/processes/${ant.project.name}-registry"/>
	<copy todir="${mcf-dist}/processes/${ant.project.name}-registry">
	    <fileset dir="dist/registry-process"/>
	</copy>
    </target>
    
    <target name="general-connector-delivery-processes" depends="general-delivery-server-process,general-delivery-registry-process"/>

    <target name="general-connector-proprietary-only-check" depends="lib-proprietary-instructions,lib-proprietary-README">
	<available file="dist/lib-proprietary-only" type="dir" property="has-proprietary-only"/>
    </target>

    <target name="general-connector-proprietary-only-delivery" depends="general-connector-proprietary-only-check" if="has-proprietary-only">
	<mkdir dir="${mcf-dist}/connector-lib-proprietary"/>
	<copy todir="${mcf-dist}/connector-lib-proprietary">
	    <fileset dir="dist/lib-proprietary-only"/>
	</copy>
    </target>

    <target name="general-connector-delivery-check" depends="lib">
	<available file="dist/lib" type="dir" property="has-lib"/>
    </target>
    
    <target name="general-connector-delivery" depends="general-connector-delivery-check,general-connector-proprietary-only-delivery,general-connector-delivery-integration,general-connector-delivery-processes" if="has-lib">
	<mkdir dir="${mcf-dist}/connector-lib"/>
	<copy todir="${mcf-dist}/connector-lib">
	    <fileset dir="dist/lib"/>
	</copy>
    </target>

    <target name="general-connector-doc-check" depends="doc">
	<available file="dist/doc" type="dir" property="has-doc"/>
    </target>

    <target name="general-connector-doc-delivery" depends="general-connector-doc-check" if="has-doc">
	<mkdir dir="${mcf-dist}/doc/api/${ant.project.name}"/>
	<copy todir="${mcf-dist}/doc/api/${ant.project.name}">
	    <fileset dir="dist/doc"/>
	</copy>
    </target>

    <target name="general-connector-proprietary-runnable-check" depends="lib-proprietary-instructions,has-RMI-check">
	<available file="dist/lib-proprietary-only/${ant.project.name}-PLACEHOLDER.txt" property="has-placeholder"/>
	<condition property="is-proprietary-runnable">
	    <or>
		<not>
		    <isset property="has-placeholder"/>
		</not>
		<isset property="hasRMI"/>
	    </or>
	</condition>
    </target>

    <target name="general-connector-runnable-check" depends="general-connector-proprietary-runnable-check,has-RMI-check">
	<available file="lib-proprietary" type="dir" property="has-lib-proprietary"/>
	<condition property="is-runnable">
	    <or>
		<not>
		    <isset property="has-lib-proprietary"/>
		</not>
		<isset property="hasRMI"/>
	    </or>
	</condition>
    </target>
    
    <target name="general-add-mapping-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your mapping connectors here --&gt;" value="&lt;!-- Add your mapping connectors here --&gt;&#0010;  &lt;!--mappingconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-mapping-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your mapping connectors here --&gt;" value="&lt;!-- Add your mapping connectors here --&gt;&#0010;  &lt;mappingconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-mapping-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your mapping connectors here --&gt;" value="&lt;!-- Add your mapping connectors here --&gt;&#0010;  &lt;!--mappingconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-mapping-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your mapping connectors here --&gt;" value="&lt;!-- Add your mapping connectors here --&gt;&#0010;  &lt;mappingconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-mapping-connector" depends="general-add-mapping-connector-commented,general-add-mapping-connector-non-commented,general-add-mapping-connector-proprietary-commented,general-add-mapping-connector-proprietary-non-commented">
    </target>

    <target name="general-add-authority-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your authority connectors here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;  &lt;!--authorityconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-authority-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your authority connectors here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;  &lt;authorityconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-authority-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your authority connectors here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;  &lt;!--authorityconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-authority-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your authority connectors here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;  &lt;authorityconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-authority-connector" depends="general-add-authority-connector-commented,general-add-authority-connector-non-commented,general-add-authority-connector-proprietary-commented,general-add-authority-connector-proprietary-non-commented">
    </target>

    <target name="general-add-output-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your output connectors here --&gt;" value="&lt;!-- Add your output connectors here --&gt;&#0010;  &lt;!--outputconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-output-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your output connectors here --&gt;" value="&lt;!-- Add your output connectors here --&gt;&#0010;  &lt;outputconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-output-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your output connectors here --&gt;" value="&lt;!-- Add your output connectors here --&gt;&#0010;  &lt;!--outputconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-output-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your output connectors here --&gt;" value="&lt;!-- Add your output connectors here --&gt;&#0010;  &lt;outputconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-output-connector" depends="general-add-output-connector-commented,general-add-output-connector-non-commented,general-add-output-connector-proprietary-commented,general-add-output-connector-proprietary-non-commented">
    </target>

    <target name="general-add-transformation-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;!--transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-transformation-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-transformation-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;!--transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-transformation-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your transformation connectors here --&gt;" value="&lt;!-- Add your transformation connectors here --&gt;&#0010;  &lt;transformationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-transformation-connector" depends="general-add-transformation-connector-commented,general-add-transformation-connector-non-commented,general-add-transformation-connector-proprietary-commented,general-add-transformation-connector-proprietary-non-commented">
    </target>

    <target name="general-add-notification-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;!--notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-notification-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-notification-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;!--notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-notification-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-notification-connector" depends="general-add-notification-connector-commented,general-add-notification-connector-non-commented,general-add-notification-connector-proprietary-commented,general-add-notification-connector-proprietary-non-commented">
    </target>

    <target name="general-add-repository-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;!--repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-repository-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
	<replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-repository-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;!--repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
    </target>

    <target name="general-add-repository-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
	<replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
    </target>

    <target name="general-add-repository-connector" depends="general-add-repository-connector-commented,general-add-repository-connector-non-commented,general-add-repository-connector-proprietary-commented,general-add-repository-connector-proprietary-non-commented">
    </target>
    
    <!-- Main targets -->

    <target name="download-dependencies"/>

    <target name="download-cleanup"/>
    
    <target name="deliver-connector" depends="general-connector-delivery"/>
    
    <target name="deliver-connector-doc" depends="general-connector-doc-delivery"/>

    <target name="build" depends="lib,lib-proprietary-instructions,lib-proprietary-README,server-process,registry-process,integration"/>
    
    <target name="build-tests" depends="build,compile-tests"/>

    <target name="run-IT-postgresql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-postgresql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-postgresql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-postgresql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*PostgresqlIT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-IT-HSQLDB" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDB-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDB-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDB-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBIT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-IT-HSQLDBext" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDBext-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDBext-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDBext-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBextIT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-IT-mysql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-mysql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-mysql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web-proprietary/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-mysql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*MySQLIT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-LT-postgresql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-postgresql-output"/>
	<junit fork="true" maxmemory="384m" dir="test-postgresql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-postgresql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*PostgresqlLT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-LT-HSQLDB" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDB-output"/>
	<junit fork="true" maxmemory="1024m" dir="test-HSQLDB-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDB-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBLT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-LT-HSQLDBext" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDBext-output"/>
	<junit fork="true" maxmemory="384m" dir="test-HSQLDBext-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDBext-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBextLT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-LT-mysql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-mysql-output"/>
	<junit fork="true" maxmemory="384m" dir="test-mysql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web-proprietary/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-mysql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*MySQLLT.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-UI-postgresql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-postgresql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-postgresql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-Dwebdriver.chrome.driver=${env.SL_CHROME_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.safari.driver=${env.SL_SAFARI_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.gecko.driver=${env.SL_FIREFOX_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.ie.driver=${env.SL_IE_DRIVER}"/>
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-postgresql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*PostgresqlUI.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-UI-HSQLDB" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDB-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDB-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-Dwebdriver.chrome.driver=${env.SL_CHROME_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.safari.driver=${env.SL_SAFARI_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.gecko.driver=${env.SL_FIREFOX_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.ie.driver=${env.SL_IE_DRIVER}"/>
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDB-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBUI.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-UI-HSQLDBext" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-HSQLDBext-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDBext-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-Dwebdriver.chrome.driver=${env.SL_CHROME_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.safari.driver=${env.SL_SAFARI_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.gecko.driver=${env.SL_FIREFOX_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.ie.driver=${env.SL_IE_DRIVER}"/>
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-HSQLDBext-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBextUI.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>
    
    <target name="run-UI-mysql" depends="compile-tests,pretest-check" if="canTest">
	<mkdir dir="test-mysql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-mysql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <jvmarg value="-Dwebdriver.chrome.driver=${env.SL_CHROME_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.safari.driver=${env.SL_SAFARI_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.gecko.driver=${env.SL_FIREFOX_DRIVER}"/>
	    <jvmarg value="-Dwebdriver.ie.driver=${env.SL_IE_DRIVER}"/>
	    <jvmarg value="-DcrawlerWarPath=${mcf-dist}/web-proprietary/war/mcf-crawler-ui.war"/>
	    <jvmarg value="-DauthorityserviceWarPath=${mcf-dist}/web-proprietary/war/mcf-authority-service.war"/>
	    <jvmarg value="-DapiWarPath=${mcf-dist}/web-proprietary/war/mcf-api-service.war"/>
	    <jvmarg value="-DcombinedWarPath=${mcf-dist}/web-proprietary/war/mcf-combined-service.war"/>
	    <classpath>
		<fileset dir="${env.JAVA_HOME}/lib">
		    <include name="tools.jar"/>
		</fileset>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-mysql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*MySQLUI.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-tests" depends="compile-tests,has-tests-check" if="hasTests">
	<mkdir dir="test-output"/>
	<junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
	    <classpath>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <formatter type="brief" usefile="false"/>
	    <batchtest todir="test-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*Test.class"/>
		    <exclude name="**/*PostgresqlTest.class"/>
		    <exclude name="**/*MySQLTest.class"/>
		    <exclude name="**/*HSQLDBTest.class"/>
		    <exclude name="**/*HSQLDBextTest.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-tests-postgresql" depends="compile-tests,has-tests-check" if="hasTests">
	<mkdir dir="test-postgresql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-postgresql-output" showoutput="true" haltonfailure="true">
	    <classpath>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <batchtest todir="test-postgresql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*PostgresqlTest.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-tests-mysql" depends="compile-tests,has-tests-check" if="hasTests">
	<mkdir dir="test-mysql-output"/>
	<junit fork="true" maxmemory="128m" dir="test-mysql-output" showoutput="true" haltonfailure="true">
	    <classpath>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <batchtest todir="test-mysql-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*MySQLTest.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-tests-HSQLDB" depends="compile-tests,has-tests-check" if="hasTests">
	<mkdir dir="test-HSQLDB-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDB-output" showoutput="true" haltonfailure="true">
	    <classpath>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <batchtest todir="test-HSQLDB-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBTest.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="run-tests-HSQLDBext" depends="compile-tests,has-tests-check" if="hasTests">
	<mkdir dir="test-HSQLDBext-output"/>
	<junit fork="true" maxmemory="128m" dir="test-HSQLDBext-output" showoutput="true" haltonfailure="true">
	    <classpath>
		<path refid="connector-test-classpath"/>
		<pathelement location="build/connector-tests/classes"/>
	    </classpath>
	    <batchtest todir="test-HSQLDBext-output">
		<fileset dir="build/connector-tests/classes">
		    <include name="**/*HSQLDBextTest.class"/>
		</fileset>
	    </batchtest>
	</junit>
    </target>

    <target name="all" depends="build,doc,build-tests,run-tests,run-tests-HSQLDB"/>

</project>
