<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="oboejar" basedir="." name="OBOE jar builder">
    <!--ANT 1.7 is required                                       -->
	
	<property name="src" location="src"/>
	<property name="lib" location="lib"/>
	<property name="build" location="build"/>
	<property name="morphobuild" location="../../../morpho/build"/>
	
	<property name="executable" location="../../../sonet-private/dataintegretionlog/executable"/>
	<property name="semtoolslib" location="lib"/>
	<property name="morpholib" location="../../../morpho/lib"/>
	<property name="emllib" location="../../../eml/lib"/>
	
	<property name="sql.driver" value="org.postgresql.Driver"/>
    <property name="sql.url" value="jdbc:postgresql://localhost:5432/oboe"/>
    <property name="sql.user" value="oboe"/>
    <property name="sql.pass" value="nceas"/>
		
	<target name="set-oboe-classpath">
		<path id="classpath.runtime">
			<pathelement location="./"/>
			<pathelement location="${build}"/>
			<fileset dir="${executable}/runlib">
				<include name="*.jar" />
			</fileset>
		</path>
		<property name="runclasspath" refid="classpath.runtime"/>
	</target>
	
	<target name="oboejar" depends="set-oboe-classpath">
		<!-- To run the main modules:
		java -cp oboe.jar org.ecoinformatics.oboe.MaterializeDB
		java -cp oboe.jar org.ecoinformatics.oboe.QueryProcessor
		java -cp oboe.jar org.ecoinformatics.oboe.RawDataLoader
		-->
        <jar destfile="${executable}/oboe.jar">
            <manifest>
            	<attribute name="Class-Path" value=". runlib/owlapi-2.2.0.jar runlib/abstractparser.jar runlib/antlr-2.7.5.jar runlib/arq-extra.jar runlib/arq.jar runlib/aterm-java-1.6.jar runlib/colt-1.2.0.jar runlib/commons-collections-3.2.jar runlib/commons-collections-testframework-3.2.jar runlib/commons-logging.jar runlib/concurrent-colt-1.2.0.jar runlib/concurrent.jar runlib/examples.jar runlib/icu4j_3_4.jar runlib/inference.jar runlib/io.jar runlib/iri.jar runlib/jakarta-oro-2.0.8.jar runlib/jena.jar runlib/jenatest.jar runlib/jetty.jar runlib/json.jar runlib/jung-1.7.6.jar runlib/junit-4.5.jar runlib/log4j-1.2.12.jar runlib/lucene-core-2.3.1.jar runlib/owl-servlet.jar runlib/owltest.jar runlib/pellet-core.jar runlib/pellet-datatypes.jar runlib/pellet-dig.jar runlib/pellet-el.jar runlib/pellet-explanation.jar runlib/pellet-jena.jar runlib/pellet-modularity.jar runlib/pellet-owlapi.jar runlib/pellet-pellint.jar runlib/pellet-query.jar runlib/pellet-rules.jar runlib/pellet-test.jar runlib/servlet.jar runlib/pellet-cli.jar runlib/rdfapi.jar runlib/rdfparser.jar runlib/relaxngDatatype.jar runlib/slf4j-api-1.5.6.jar runlib/slf4j-log4j12-1.5.6.jar runlib/stax-1.1.1-dev.jar runlib/stax-api-1.0.jar runlib/validation_test.jar runlib/validation.jar runlib/wstx-asl-3.0.0.jar runlib/xercesImpl.jar runlib/xml-apis.jar runlib/xsdlib.jar runlib/activation.jar runlib/dom4j.jar runlib/itislib.jar runlib/jarbundler-1.9.jar runlib/jcalendar-1.3.2.jar runlib/jcert.jar runlib/jhall.jar runlib/jhindexer.jar runlib/jlfgr-1_0.jar runlib/jnet.jar runlib/jsse.jar runlib/kunststoff.jar runlib/liveMap.jar runlib/morphohelp.jar runlib/nbii.jar runlib/PDFRenderer.jar runlib/shippedIcons.jar runlib/standalone-compiler.jar runlib/svnant.jar runlib/svnClientAdapter.jar runlib/svnjavahl.jar runlib/tar.jar runlib/xercesImpl.jar runlib/xml-apis.jar runlib/xalan.jar runlib/axis-ant.jar runlib/axis-schema.jar runlib/axis.jar runlib/commons-discovery.jar runlib/commons-logging.jar runlib/jaxrpc.jar runlib/saaj.jar runlib/soap.jar runlib/wsdl4j.jar runlib/httpclient.jar runlib/morpho-config.jar runlib/utilities.jar runlib/morpho.jar runlib/configxml.jar runlib/cos.jar runlib/eml.jar runlib/jdom.jar runlib/junit.jar runlib/axis.jar runlib/commons-discovery.jar runlib/commons-logging.jar runlib/hsqldb.jar runlib/jaxrpc.jar runlib/log4j-1.2.8.jar runlib/org.ecoinformatics.ecogrid.AuthenticatedQueryService-stub.jar runlib/org.ecoinformatics.ecogrid.AuthenticationService-stub.jar runlib/org.ecoinformatics.ecogrid.PutService-stub.jar runlib/org.ecoinformatics.ecogrid.QueryService-stub.jar runlib/postgresql-8.0-312.jdbc3.jar runlib/saaj.jar runlib/soap.jar runlib/tar.jar runlib/utilities.jar runlib/wsdl4j.jar runlib/servlet.jar runlib/xercesImpl.jar runlib/xml-apis.jar runlib/xalan.jar runlib/xmlParserAPIs.jar runlib/owlapi-bin.jar runlib/datamanager.jar runlib/jgraphx.jar runlib/owlapi-src.jar"/>
            	<!-- <attribute name="Class-Path" value=". ${runclasspath}"/> --> <!-- This does not work -->
            </manifest>
            <fileset dir="/Users/cao/DATA/SONET/svntrunk/semtools/dev/sms/build"/>
            <fileset dir="/Users/cao/DATA/SONET/svntrunk/morpho/lib/MemoryMonitor"/>
            <fileset dir="/Users/cao/DATA/SONET/svntrunk/morpho"/>
            <fileset dir="/Users/cao/DATA/SONET/svntrunk/morpho/lib"/>
        </jar>
    </target>
	
	<target name="clean-db">
		<!-- Delete the content of the data tables -->
		<echo> Clean data table contents ......... </echo>
		<sql driver="${sql.driver}" url="${sql.url}" userid="${sql.user}" password="${sql.pass}" >
			<classpath>
			<pathelement location="${executable}/runlib/postgresql-8.0-312.jdbc3.jar"/>
	 		</classpath>   
			<!-- <transaction src="${src}/org/ecoinformatics/oboe/cleandb.sql"/> -->
			<transaction src="${src}/org/ecoinformatics/oboe/db/dropdb.sql"/>
			<transaction src="${src}/org/ecoinformatics/oboe/db/crtdb.sql"/>
		</sql>
	</target>
	
	<target name="copy_lib_file">
    	<!-- this need to be run first -->
        <delete dir="${executable}/runlib"/>
    	<mkdir dir="${executable}/runlib"/>
    	<copy todir="${executable}/runlib" >
			<fileset dir="./lib" includes="*.jar"/>
    		<fileset dir="${morpholib}" includes="*.jar"/>
    		<fileset dir="${morpholib}/axis" includes="*.jar"/>
    		<fileset dir="${emllib}" includes="*.jar"/>
    		<fileset dir="${emllib}/datamanager" includes="*.jar"/>
    		<fileset dir="${emllib}/apache" includes="*.jar"/>
		</copy>
    	<copy file="${morpholib}/../build/morpho.jar" todir="${executable}/runlib"/>
    	<copy file="${semtoolslib}$/../../owlifier/lib/owlapi-2.2.0.jar" todir="${executable}/runlib"/>
    </target>
	
	
</project>
