svn commit: r524298 [4/5] - in /jakarta/slide/trunk/proposals/purexmladapter: ./ slide/ slide/com/ slide/com/ibm/ slide/com/ibm/db2/ slide/com/ibm/db2/purexml/ slide/dbsetup/
[email protected] Fri, 30 Mar 2007 22:24:28 -0000
| Newsgroups | gmane.comp.jakarta.slide.devel |
|---|---|
| Message-ID | <[email protected]> |
Added: jakarta/slide/trunk/proposals/purexmladapter/slide/build.xml
URL: http://svn.apache.org/viewvc/jakarta/slide/trunk/proposals/purexmladapter/slide/build.xml?view=auto&rev=524298
==============================================================================
--- jakarta/slide/trunk/proposals/purexmladapter/slide/build.xml (added)
+++ jakarta/slide/trunk/proposals/purexmladapter/slide/build.xml Fri Mar 30 15:24:26 2007
@@ -0,0 +1,971 @@
+<project name="Slide" default="all" basedir=".">
+ <!-- =================================================================== -->
+ <!-- Load build.properties -->
+ <!-- =================================================================== -->
+ <property file="build.properties"/>
+ <property file="${user.home}/build.properties"/>
+ <!-- =================================================================== -->
+ <!-- Compiler Options -->
+ <!-- =================================================================== -->
+ <!-- Should Java compilations set the 'debug' compiler option? -->
+ <property name="compile.debug" value="true"/>
+ <!-- Should Java compilations set the 'deprecation' compiler option? -->
+ <property name="compile.deprecation" value="true"/>
+ <!-- Should Java compilations set the 'optimize' compiler option? -->
+ <property name="compile.optimize" value="true"/>
+ <!-- Target VM -->
+ <property name="compile.target" value="1.3"/>
+ <!-- Source compatibility -->
+ <property name="compile.source" value="1.3"/>
+ <!-- =================================================================== -->
+ <!-- Project Properties -->
+ <!-- =================================================================== -->
+ <property name="name" value="Jakarta-Slide"/>
+ <property name="year" value="2004"/>
+ <property name="version" value="2.2pre1"/>
+ <property name="purexmlversion" value="1.0"/>
+ <property name="release-notes" value="RELEASE-NOTES-2.2"/>
+ <property name="project" value="jakarta-slide"/>
+ <property name="final.name" value="${project}-server-bin-${version}"/>
+ <property name="final-src.name" value="${project}-server-src-${version}"/>
+ <property name="testsuite.name" value="${project}-webdav-testsuite-${version}"/>
+ <!-- =================================================================== -->
+ <!-- Dependencies Properties -->
+ <!-- =================================================================== -->
+ <property name="lib.dir" value="./lib"/>
+ <property name="servlet.jar" value="${lib.dir}/servlet-2.3.jar"/>
+ <property name="jdom.jar" value="${lib.dir}/jdom-1.0.jar"/>
+ <property name="saxpath.jar" value="${lib.dir}/saxpath.jar"/>
+ <property name="jaxen-core.jar" value="${lib.dir}/jaxen-core.jar"/>
+ <property name="jaxen-jdom.jar" value="${lib.dir}/jaxen-jdom.jar"/>
+ <property name="jta.jar" value="${lib.dir}/geronimo-jta.jar"/>
+ <property name="log4j.jar" value="${lib.dir}/log4j-1.2.8.jar"/>
+ <property name="commons-httpclient.jar" value="${lib.dir}/commons-httpclient.jar"/>
+ <property name="commons-dbcp.jar" value="${lib.dir}/commons-dbcp-1.2.1.jar"/>
+ <property name="commons-pool.jar" value="${lib.dir}/commons-pool-1.1.jar"/>
+ <property name="commons-collections.jar" value="${lib.dir}/commons-collections-2.1.jar"/>
+ <property name="commons-logging.jar" value="${lib.dir}/commons-logging-1.0.4.jar"/>
+ <property name="commons-lang.jar" value="${lib.dir}/commons-lang-2.0.jar"/>
+ <property name="lucene.jar" value="${lib.dir}/lucene-1.4-final.jar"/>
+ <property name="poi.jar" value="${lib.dir}/poi-2.5-final-20040428.jar"/>
+ <property name="pdfbox.jar" value="${lib.dir}/PDFBox-0.6.5.jar"/>
+ <property name="tm-extractors.jar" value="${lib.dir}/tm-extractors-0.4.jar"/>
+ <property name="ehcache.jar" value="${lib.dir}/ehcache-1.0.jar"/>
+ <property name="commons-xmlio.jar" value="${lib.dir}/commons-xmlio-0.1pre.jar"/>
+ <property name="commons-transaction.jar" value="${lib.dir}/commons-transaction-1.1.1pre1.jar"/>
+ <property name="commons-codec.jar" value="${lib.dir}/commons-codec-1.3.jar"/>
+ <property name="jakarta-slide-webdavlib.jar" location="webdavclient/dist/lib/jakarta-slide-webdavlib-${version}.jar"/>
+ <property name="db-ojb.jar" value="${lib.dir}/db-ojb-1.0.1.jar"/>
+ <property name="xdoclet.jar" value="${lib.dir}/xdoclet-1.2.1.jar"/>
+ <property name="xjavadoc.jar" value="${lib.dir}/xjavadoc-1.0.3.jar"/>
+ <property name="xdoclet-ojb-module.jar" value="${lib.dir}/xdoclet-ojb-module-1.2.2.jar"/>
+ <property name="velocity.jar" value="${lib.dir}/velocity-1.3.1.jar"/>
+ <!-- =================================================================== -->
+ <!-- Produced jars Properties -->
+ <!-- =================================================================== -->
+ <property name="db2purexml-stores.jar" value="db2purexml-stores-${purexmlversion}.jar"/>
+ <property name="slide-kernel.jar" value="slide-kernel-${version}.jar"/>
+ <property name="slide-kernel-bundle.jar" value="slide-kernel-bundle-${version}.jar"/>
+ <property name="slide-stores.jar" value="slide-stores-${version}.jar"/>
+ <property name="slide-roles.jar" value="slide-roles-${version}.jar"/>
+ <property name="slide-webdavservlet.jar" value="slide-webdavservlet-${version}.jar"/>
+ <property name="slide-catalinawrapper.jar" value="slide-catalinawrapper-${version}.jar"/>
+ <property name="slide-log4jwrapper.jar" value="slide-log4jwrapper-${version}.jar"/>
+ <property name="slide-jdk14logger.jar" value="slide-jdk14logger-${version}.jar"/>
+ <property name="slide-log4jlogger.jar" value="slide-log4jlogger-${version}.jar"/>
+ <property name="slide-jaas.jar" value="slide-jaas-${version}.jar"/>
+ <!-- =================================================================== -->
+ <!-- Build Properties -->
+ <!-- =================================================================== -->
+ <property name="slide.build" value="./build"/>
+ <property name="slide.dist" value="./dist"/>
+ <property name="slide.clientlib.dist" value="webdavclient/${slide.dist}"/>
+ <property name="testsuite.dist" value="${slide.dist}/webdav-testsuite"/>
+ <property name="webapp.dist" value="${slide.dist}/slide/webapp"/>
+ <property name="slide.archive" value="./${final.name}"/>
+ <property name="slide-src.archive" value="./${final-src.name}"/>
+ <property name="testsuite.archive" value="./${testsuite.name}"/>
+ <!-- =================================================================== -->
+ <!-- Overridden when authentication is -->
+ <!-- =================================================================== -->
+ <property name="authenticate" value="!--"/>
+ <!-- =================================================================== -->
+ <!-- OJB Store Properties -->
+ <!-- =================================================================== -->
+ <property name="table.prefix" value="SLIDE_"/>
+ <property name="ojb.databases" value="mysql,mysql41,postgresql,oracle"/>
+ <property name="ojb.platform" value="Hsqldb"/>
+ <property name="ojb.jdbc-level" value="2.0"/>
+ <property name="ojb.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="ojb.protocol" value="jdbc"/>
+ <property name="ojb.subprotocol" value="hsqldb"/>
+ <property name="ojb.dbalias" value="slide"/>
+ <property name="ojb.username" value="sa"/>
+ <property name="ojb.password" value=""/>
+ <!-- =================================================================== -->
+ <!-- Patterns -->
+ <!-- =================================================================== -->
+ <!-- patternset describing files to be copied from the doc directory -->
+ <patternset id="patternset-doc"/>
+ <!-- patternset describing test classes -->
+ <patternset id="patternset-test-classes">
+ <include name="**/Test*.class"/>
+ </patternset>
+ <!-- patternset describing non test classes -->
+ <patternset id="patternset-non-test-classes">
+ <include name="**/*.class"/>
+ <exclude name="**/Test*.class"/>
+ </patternset>
+ <!-- patternset describing non test source files (*.java, *html, etc.) -->
+ <patternset id="patternset-javadocable-sources">
+ <include name="**/*"/>
+ <exclude name="**/Test*.java"/>
+ </patternset>
+ <!-- =================================================================== -->
+ <!-- Classpaths -->
+ <!-- =================================================================== -->
+ <path id="util.classpath">
+ <pathelement location="${jaxp.jar}"/>
+ <pathelement location="${xmlapi.jar}"/>
+ </path>
+ <path id="main.classpath">
+ <pathelement location="${xmlapi.jar}"/>
+ <pathelement location="${jaxp.jar}"/>
+ <pathelement location="${jta.jar}"/>
+ <pathelement location="${jdom.jar}"/>
+ <pathelement location="${jaxen-jdom.jar}"/>
+ <pathelement location="${jaxen-core.jar}"/>
+ <pathelement location="${saxpath.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ <pathelement location="${poi.jar}"/>
+ <pathelement location="${pdfbox.jar}"/>
+ <pathelement location="${tm-extractors.jar}"/>
+ <pathelement location="${ehcache.jar}"/>
+ <pathelement location="${commons-transaction.jar}"/>
+ <pathelement location="${commons-codec.jar}"/>
+ <pathelement location="${commons-httpclient.jar}"/>
+ <pathelement location="${jakarta-slide-webdavlib.jar}"/>
+ </path>
+ <path id="stores.classpath">
+ <pathelement location="${xmlapi.jar}"/>
+ <pathelement location="${jaxp.jar}"/>
+ <pathelement location="${jta.jar}"/>
+ <pathelement location="${jdom.jar}"/>
+ <pathelement location="${slide.build}/classes"/>
+ <pathelement location="${commons-dbcp.jar}"/>
+ <pathelement location="${commons-pool.jar}"/>
+ <pathelement location="${lucene.jar}"/>
+ <pathelement location="${ehcache.jar}"/>
+ <pathelement location="${commons-transaction.jar}"/>
+ <pathelement location="${commons-logging.jar}"/>
+ <pathelement location="${commons-codec.jar}"/>
+ <pathelement location="${commons-lang.jar}"/>
+ <pathelement location="${db-ojb.jar}"/>
+ </path>
+ <path id="wrappers.classpath">
+ <pathelement location="${slide.build}/classes"/>
+ <pathelement location="${log4j.jar}"/>
+ <pathelement location="${catalina.jar}"/>
+ <pathelement location="${jmx.jar}"/>
+ <pathelement location="${jta.jar}"/>
+ </path>
+ <path id="webdavservlet.classpath">
+ <pathelement location="${xmlapi.jar}"/>
+ <pathelement location="${jaxp.jar}"/>
+ <pathelement location="${servlet.jar}"/>
+ <pathelement location="${jdom.jar}"/>
+ <pathelement location="${jta.jar}"/>
+ <pathelement location="${commons-httpclient.jar}"/>
+ <pathelement location="${slide.build}/classes"/>
+ <pathelement location="${ehcache.jar}"/>
+ <pathelement location="${commons-transaction.jar}"/>
+ <pathelement location="${commons-xmlio.jar}"/>
+ <pathelement location="${commons-codec.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ </path>
+ <path id="ojbdoclet.classpath">
+ <pathelement location="${db-ojb.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ <pathelement location="${commons-logging.jar}"/>
+ <pathelement location="${xdoclet.jar}"/>
+ <pathelement location="${xjavadoc.jar}"/>
+ <pathelement location="${xdoclet-ojb-module.jar}"/>
+ </path>
+ <path id="ojbsql.classpath">
+ <pathelement location="${slide.build}/classes"/>
+ <pathelement location="${jdom.jar}"/>
+ <pathelement location="${velocity.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ <pathelement location="src/conf/ojb/templates"/>
+ </path>
+ <!-- =================================================================== -->
+ <!-- Detect -->
+ <!-- =================================================================== -->
+ <target name="detect" depends="detect.display,detect.fail"
+ description="Display configuration and conditional compilation flags">
+ </target>
+ <target name="detect.display">
+ <available property="jaxp.present" classname="javax.xml.transform.TransformerFactory" classpath="${jaxp.jar}"/>
+ <available property="dom.present" classname="org.w3c.dom.Document" classpath="${xmlapi.jar}"/>
+ <available property="sax.present" classname="org.xml.sax.helpers.DefaultHandler" classpath="${xmlapi.jar}"/>
+ <available property="catalina.present" classname="org.apache.catalina.User" classpath="${catalina.jar}"/>
+ <condition property="jvm14.present">
+ <or>
+ <equals arg1="${ant.java.version}" arg2="1.4"/>
+ <equals arg1="${ant.java.version}" arg2="1.5"/>
+ </or>
+ </condition>
+ <echo message="+-------------------------------------------------------"/>
+ <echo message="| Build environment for ${name} ${version}"/>
+ <echo message="| "/>
+ <echo message="| Note: "/>
+ <echo message="| If ${property.name} is displayed for a library "/>
+ <echo message="| instead of 'true', that library is not present."/>
+ <echo message="+-------------------------------------------------------"/>
+ <echo message=""/>
+ <echo message="Environment:"/>
+ <echo message=" Java home ${java.home}"/>
+ <echo message=" Java version ${ant.java.version}"/>
+ <echo message=""/>
+ <echo message="Build options:"/>
+ <echo message=" Generate debugging info ${compile.debug}"/>
+ <echo message=" Display deprecation info ${compile.deprecation}"/>
+ <echo message=" Optimize ${compile.optimize}"/>
+ <echo message=" Target ${compile.target}"/>
+ <echo message=" Source ${compile.source}"/>
+ <echo message=" Build directory ${slide.build}"/>
+ <echo message=" Distribution directory ${slide.dist}"/>
+ <echo message=" Distribution archive name ${slide.archive}"/>
+ <echo message=""/>
+ <echo message="Libraries:"/>
+ <echo message=" JAXP (1.1 or later) ${jaxp.present}"/>
+ <echo message=" XML DOM Level 2 API ${dom.present}"/>
+ <echo message=" XML SAX 2 API ${sax.present}"/>
+ <echo message=""/>
+ <echo message="Optional Tomcat bundle:"/>
+ <echo message=" Tomcat (4.1.x or 5.0.x) ${catalina.dist}"/>
+ <echo message=" Present ${catalina.present}"/>
+ <echo message=""/>
+ <condition property="required.present">
+ <and>
+ <equals arg1="${jaxp.present}" arg2="true"/>
+ <equals arg1="${dom.present}" arg2="true"/>
+ <equals arg1="${sax.present}" arg2="true"/>
+ </and>
+ </condition>
+ </target>
+ <target name="detect.fail" unless="required.present">
+ <fail message="Failed dependancy">
+ One or more required libraries could not be found.
+ Please check your build.propertes file.
+ </fail>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Prepare -->
+ <!-- =================================================================== -->
+ <target name="prepare" depends="detect">
+ <mkdir dir="${slide.build}"/>
+ <mkdir dir="${slide.build}/classes"/>
+ <mkdir dir="${slide.build}/lib"/>
+ <mkdir dir="${slide.build}/doc"/>
+ <mkdir dir="${slide.build}/doc/schema"/>
+ <mkdir dir="${slide.build}/doc/samples"/>
+ <mkdir dir="${slide.build}/doc/javadoc"/>
+ <mkdir dir="${slide.build}/ojb"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build All : Main, Doc and JavaDoc -->
+ <!-- =================================================================== -->
+ <target name="all" depends="clean,dist" description="Delete previous build
+ and make client and core components distribution"/>
+ <!-- =================================================================== -->
+ <!-- Build webdavclient -->
+ <!-- =================================================================== -->
+ <target name="webdavclient">
+ <ant dir="webdavclient" inheritall="false">
+ <property name="jakarta-slide-webdavlib.jar" value="${jakarta-slide-webdavlib.jar}"/>
+ </ant>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build Slide -->
+ <!-- =================================================================== -->
+ <target name="main" depends="webdavclient" description="Builds Slide's Core">
+ <copy todir="${slide.build}/classes">
+ <fileset dir=".">
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ </fileset>
+ </copy>
+ <echo message="Building Slide Core API"/>
+ <javac srcdir="src/share" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" excludes="**/CVS/**,**/webdav/**,**/manager/**,**/package.html" target="${compile.target}" source="${compile.source}">
+ <classpath refid="main.classpath"/>
+ <exclude name="**/Slide.java" unless="jmx.present"/>
+ <exclude name="**/SlideMBean.java" unless="jmx.present"/>
+ </javac>
+ <copy todir="${slide.build}/classes">
+ <fileset dir="src/share">
+ <include name="**/*.properties"/>
+ <exclude name="**/slide.properties"/>
+ </fileset>
+ </copy>
+ <copy todir="${slide.build}/lib">
+ <fileset dir="lib">
+ <include name="**/**"/>
+ </fileset>
+ </copy>
+ <echo message="Building Slide WebDAV Servlet"/>
+ <javac srcdir="src/webdav/server" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includes="**/webdav/**" excludes="**/CVS/**,**/package.html" target="${compile.target}" source="${compile.source}">
+ <classpath refid="webdavservlet.classpath"/>
+ </javac>
+ <copy todir="${slide.build}/classes">
+ <fileset dir="src/webdav/server">
+ <include name="**/*.properties"/>
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+ <echo message="Building Standard Stores"/>
+ <javac srcdir="src/stores" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" excludes="**/CVS/**,**/package.html,**/*Test*,**/ojb/tools/*" target="${compile.target}" source="${compile.source}">
+ <classpath refid="stores.classpath"/>
+ </javac>
+ <copy todir="${slide.build}/classes">
+ <fileset dir="src/stores">
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+ <echo message="Building Default Roles"/>
+ <javac srcdir="src/roles" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" excludes="**/CVS/**,**/package.html" target="${compile.target}" source="${compile.source}">
+ <classpath refid="stores.classpath"/>
+ </javac>
+ <echo message="Building JAAS LoginModule"/>
+ <javac srcdir="src/jaas" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" target="${compile.target}" source="${compile.source}">
+ <classpath refid="main.classpath"/>
+ </javac>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build Log4j related components -->
+ <!-- This target requires Log4j -->
+ <!-- =================================================================== -->
+ <target name="log4j-logger" depends="main">
+ <javac srcdir="src/wrappers" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includes="**/log4j/**" excludes="**/CVS/**" target="${compile.target}" source="${compile.source}">
+ <classpath refid="wrappers.classpath"/>
+ </javac>
+ <copy file="src/etc/MANIFEST.MF" tofile="${slide.build}/classes/MANIFEST.MF"/>
+ <replace file="${slide.build}/classes/MANIFEST.MF" token="$$VERSION$$" value="${version}"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-log4jlogger.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,**/log4j/**"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build JDK1.4 logging related components -->
+ <!-- This target requires JDK1.4 -->
+ <!-- =================================================================== -->
+ <target name="jdk14-logging" depends="main" if="jvm14.present">
+ <javac srcdir="src/jdk14" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includes="**" excludes="**/CVS/**" target="${compile.target}" source="${compile.source}">
+ <classpath refid="wrappers.classpath"/>
+ </javac>
+ <copy file="src/etc/MANIFEST.MF" tofile="${slide.build}/classes/MANIFEST.MF"/>
+ <replace file="${slide.build}/classes/MANIFEST.MF" token="$$VERSION$$" value="${version}"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-jdk14logger.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,**/jdk14/**"/>
+ </target>
+ <!-- ================================================================== -->
+ <!-- Generates XML descriptors for OJB from sources and file templates -->
+ <!-- ================================================================== -->
+ <target name="ojb-xml"
+ description="Generate XML descriptors for OJB from sources and templates">
+ <taskdef name="ojbdoclet"
+ classname="xdoclet.modules.ojb.OjbDocletTask"
+ classpathref="ojbdoclet.classpath"/>
+ <copy todir="${slide.build}/ojb">
+ <fileset dir="src/conf/ojb">
+ <include name="ojbcore-schema.xml"/>
+ <include name="repository_database.xml"/>
+ <include name="repository_internal.xml"/>
+ <include name="database_3_0_1.dtd"/>
+ </fileset>
+ <filterset>
+ <filter token="DATABASE_DEFAULT" value="slide"/>
+ <filter token="PREFIX" value="${table.prefix}"/>
+ <filter token="DBMS_NAME" value="${ojb.platform}"/>
+ <filter token="JDBC_LEVEL" value="${ojb.jdbc-level}"/>
+ <filter token="DRIVER_NAME" value="${ojb.driver}"/>
+ <filter token="URL_PROTOCOL" value="${ojb.protocol}"/>
+ <filter token="URL_SUBPROTOCOL" value="${ojb.subprotocol}"/>
+ <filter token="URL_DBALIAS" value="${ojb.dbalias}"/>
+ <filter token="USER_NAME" value="${ojb.username}"/>
+ <filter token="USER_PASSWD" value="${ojb.password}"/>
+ </filterset>
+ </copy>
+ <ojbdoclet destdir="${slide.build}/ojb">
+ <fileset dir="src/stores">
+ <include name="**/*Peer.java"/>
+ </fileset>
+ <ojbrepository destinationFile="repository_user.xml"/>
+ <torqueschema databaseName="slide"
+ dtdUrl="database_3_0_1.dtd"
+ destinationFile="slide-schema.xml"/>
+ </ojbdoclet>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Generate SQL for OJB Slide database -->
+ <!-- =================================================================== -->
+ <target name="ojb-sql" depends="ojb-xml,ojb-tools">
+ <taskdef name="sqlgen"
+ classname="org.apache.slide.store.ojb.tools.DDLGeneratorTask"
+ classpathref="ojbsql.classpath"/>
+ <sqlgen schema="${slide.build}/ojb/ojbcore-schema.xml,${slide.build}/ojb/slide-schema.xml"
+ targetDatabases="${ojb.databases}"
+ outputPattern="${slide.build}/ojb/slide-schema-%{database}.sql"/>
+ </target>
+ <target name="ojb-tools">
+ <javac srcdir="src/stores"
+ destdir="${slide.build}/classes"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ includes="**/ojb/tools/*.java"
+ target="${compile.target}" source="${compile.source}"
+ classpathref="ojbsql.classpath"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build documentation -->
+ <!-- =================================================================== -->
+ <target name="doc" depends="prepare" description="Generate documentation/website">
+ <style basedir="src/doc" destdir="${slide.build}/doc" extension=".html" style="src/doc/stylesheets/slide.xsl" includes="*.xml"/>
+ <copy todir="${slide.build}/doc">
+ <fileset dir="src/doc">
+ <include name="**/*.gif"/>
+ <include name="**/*.jpg"/>
+ <include name="**/*.png"/>
+ <include name="**/*.css"/>
+ <include name="**/*.sample"/>
+ </fileset>
+ </copy>
+ <copy todir="${slide.build}/doc/schema">
+ <fileset dir="src/schema">
+ <include name="**/*.xsd"/>
+ <include name="**/*.dtd"/>
+ </fileset>
+ </copy>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Javadoc of the WebDAV Server -->
+ <!-- =================================================================== -->
+ <target name="webdav-server-javadoc" unless="skip.javadoc">
+ <copy todir="${slide.build}/src/webdav/server">
+ <fileset dir="${slide.build}/doc/serverjavadoc"/>
+ <fileset dir="src/webdav/server">
+ <include name="**/webdav/**"/>
+ <exclude name="**/CVS/**"/>
+ <exclude name="**/Slide.java" unless="jmx.present"/>
+ <exclude name="**/SlideMBean.java" unless="jmx.present"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${slide.build}/doc/serverjavadoc"/>
+ <property name="copyright" value=""/>
+ <javadoc sourcepath="${slide.build}/src/webdav/server" destdir="${slide.build}/doc/serverjavadoc" doctitle="Slide ${version} WebDAV Server JavaDoc" windowtitle="Slide WebDAV Server Documentation" package="true" noindex="false" author="true" version="true" packagenames="org.apache.slide.webdav.*">
+ <classpath refid="webdavservlet.classpath"/>
+ </javadoc>
+ <copy todir="${slide.dist}/doc/serverjavadoc">
+ <fileset dir="${slide.build}/doc/serverjavadoc"/>
+ </copy>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Clean build and distribution directories -->
+ <!-- =================================================================== -->
+ <target name="clean" description="Delete previous build">
+ <delete dir="${slide.build}"/>
+ <delete dir="${slide.dist}"/>
+ <!-- Clean subprojects -->
+ <ant antfile="build.xml" dir="projector" target="clean"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build the Slide JavaDoc -->
+ <!-- =================================================================== -->
+ <target name="javadoc" depends="prepare" unless="skip.javadoc" description="Generate core API documentation">
+ <property name="copyright" value=""/>
+ <javadoc sourcepath="src/share" destdir="${slide.build}/doc/javadoc" doctitle="Slide ${version} API Documentation" windowtitle="Slide API Documentation" overview="src/share/overview.html" package="true" noindex="false" author="true" version="true" packagenames="org.*">
+ <classpath>
+ <path refid="main.classpath"/>
+ <pathelement location="${jmx.jar}" />
+ <pathelement path="${slide.build}/classes"/>
+ </classpath>
+ </javadoc>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Prepare distribution directories -->
+ <!-- =================================================================== -->
+ <target name="prepare-dist">
+ <echo message="Creating distribution directories"/>
+ <mkdir dir="${slide.dist}"/>
+ <mkdir dir="${slide.dist}/slide/webapp"/>
+ <mkdir dir="${slide.dist}/slide/lib"/>
+ <mkdir dir="${slide.dist}/doc"/>
+ <mkdir dir="${slide.dist}/slide/wrappers"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build a Slide distribution -->
+ <!-- =================================================================== -->
+ <target name="dist" depends="main,ojb-sql,prepare-dist,doc,javadoc,dist-xml,log4j-logger,jdk14-logging" description="Make distribution of core components">
+ <copy file="src/etc/MANIFEST.MF" tofile="${slide.build}/classes/MANIFEST.MF" overwrite="yes" />
+ <replace file="${slide.build}/classes/MANIFEST.MF" token="$$VERSION$$" value="${version}"/>
+ <echo message="Building Slide main JAR file"/>
+ <copy file="src/conf/webapp/slide.properties" tofile="${slide.build}/classes/org/apache/slide/slide.properties" overwrite="yes" />
+ <jar jarfile="${slide.dist}/slide/lib/${slide-kernel.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,org/apache/slide/**" excludes="org/apache/slide/webdav/**,org/apache/slide/jaas/**,org/apache/slide/store/impl/**,org/apache/slide/store/util/**,org/apache/slide/store/txfile/**,org/apache/slide/store/txjndi/**,org/apache/slide/store/mem/**,org/apache/slide/search/basic/sample/**,org/apache/slide/index/**,org/apache/slide/util/logger/jdk14/**,org/apache/slide/store/ojb/**"/>
+ <echo message="Building Slide Standard Stores JAR file"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-stores.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,slidestore/**,org/apache/slide/store/impl/**,org/apache/slide/store/util/**,org/apache/slide/store/txfile/**,org/apache/slide/store/txjndi/**,org/apache/slide/store/mem/**,org/apache/slide/index/**,org/apache/slide/store/ojb/**" excludes="org/apache/slide/store/ojb/tools/**"/>
+ <echo message="Building DB2 PureXML Stores JAR file"/>
+ <jar jarfile="${slide.dist}/slide/lib/${db2purexml-stores.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,slidestore/**,com/ibm/db2/purexml/**"/>
+ <echo message="Building Default Roles JAR file"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-roles.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,slideroles/**"/>
+ <echo message="Building WebDAV Servlet JAR"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-webdavservlet.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,org/apache/slide/webdav/**"/>
+ <echo message="Building JAAS LoginModule JAR"/>
+ <jar jarfile="${slide.dist}/slide/lib/${slide-jaas.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,org/apache/slide/jaas/**"/>
+
+ <echo message="Copying documentation"/>
+ <copy todir="${slide.dist}/doc">
+ <fileset dir="${slide.build}/doc"/>
+ </copy>
+ <copy todir="${slide.dist}/slide/db-schema" overwrite="yes">
+ <fileset dir="src/conf/schema"/>
+ </copy>
+ <copy todir="${slide.dist}">
+ <fileset dir=".">
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ <include name="README"/>
+ <include name="${release-notes}"/>
+ </fileset>
+ </copy>
+ <echo message="Copying libraries"/>
+ <copy todir="${slide.dist}/slide/lib">
+ <fileset dir="${slide.build}/lib">
+ <exclude name="servlet*.jar"/>
+ <exclude name="xdoclet*.jar"/>
+ <exclude name="xjavadoc*.jar"/>
+ <exclude name="ant-contrib*.jar"/>
+ <exclude name="torque*.jar"/>
+ <exclude name="velocity*.jar"/>
+ </fileset>
+ </copy>
+ <copy todir="${slide.dist}/slide/ojb-schema">
+ <fileset dir="${slide.build}/ojb" includes="slide-schema-*.sql"/>
+ </copy>
+ <copy todir="${slide.dist}/slide/conf">
+ <fileset dir="src/conf/ojb" includes="repository.*,*.properties"/>
+ <fileset dir="${slide.build}/ojb" includes="repository_*.xml"/>
+ </copy>
+ </target>
+ <target name="dist-xml" unless="jvm14.present">
+ <copy todir="${slide.dist}/slide/lib" file="${jaxp.jar}"/>
+ <copy todir="${slide.dist}/slide/lib" file="${xmlapi.jar}"/>
+ <copy todir="${slide.dist}/slide/lib" file="${xmlparser.jar}"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build a Slide distribution packaged as a web application -->
+ <!-- =================================================================== -->
+ <target name="webapp-dist" depends="dist" description="Creates a web archive (war) without authentication">
+ <filter token="AUTH" value="${authenticate}"/>
+ <copy todir="${slide.dist}/slide/conf" filtering="true" overwrite="yes">
+ <fileset dir="src/conf/webapp">
+ <include name="web.xml"/>
+ <include name="slide.properties"/>
+ <include name="log4j.properties"/>
+ <include name="commons-logging.properties"/>
+ </fileset>
+ </copy>
+ <war warfile="${webapp.dist}/slide.war" webxml="${slide.dist}/slide/conf/web.xml">
+ <fileset dir="src/conf/webapp">
+ <include name="**/Domain.xml"/>
+ </fileset>
+ <lib dir="${slide.dist}/slide/lib"/>
+ <classes dir="src/conf/ojb">
+ <include name="*.properties"/>
+ <include name="repository.*"/>
+ </classes>
+ <classes dir="${slide.build}/ojb">
+ <include name="repository_*.xml"/>
+ </classes>
+ <classes dir="src/conf/webapp">
+ <include name="*.properties"/>
+ </classes>
+ </war>
+ <war warfile="${webapp.dist}/slide-doc.war" webxml="src/conf/webapp/webdoc.xml">
+ <fileset dir="${slide.dist}/doc">
+ </fileset>
+ </war>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build a Slide distribution packaged as a JAAS web application -->
+ <!-- =================================================================== -->
+ <target name="webapp-jaas-dist" depends="dist" description="Creates a web archive (war) with JAAS authentication">
+ <filter token="AUTH" value=""/>
+ <copy todir="${slide.dist}/slide/conf" filtering="true" overwrite="yes">
+ <fileset dir="src/conf/webapp">
+ <include name="web.xml"/>
+ <include name="slide.properties"/>
+ <include name="log4j.properties"/>
+ <include name="commons-logging.properties"/>
+ </fileset>
+ </copy>
+ <war warfile="${webapp.dist}/slide.war" webxml="${slide.dist}/slide/conf/web.xml">
+ <fileset dir="src/conf/webapp">
+ <include name="**/Domain.xml"/>
+ </fileset>
+ <lib dir="${slide.dist}/slide/lib"/>
+ <fileset dir=".">
+ <include name="README"/>
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ <include name="${release-notes}"/>
+ </fileset>
+ <zipfileset dir="src/conf/schema" prefix="db-schema" />
+ <classes dir="src/conf/ojb">
+ <include name="*.properties"/>
+ <include name="repository.*"/>
+ </classes>
+ <classes dir="${slide.build}/ojb">
+ <include name="repository_*.xml"/>
+ </classes>
+ <zipfileset dir="${slide.dist}/slide/ojb-schema" prefix="ojb-schema"/>
+ </war>
+ <war warfile="${webapp.dist}/slide-doc.war" webxml="src/conf/webapp/webdoc.xml">
+ <fileset dir="${slide.dist}/doc">
+ </fileset>
+ </war>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Deploy Slide as a web application with JAAS authentication to -->
+ <!-- Tomcat 5.0.28 and later -->
+ <!-- This target requires Tomcat 5.0.28 -->
+ <!-- =================================================================== -->
+ <target name="jaas-deploy-tomcat-5" depends="webapp-jaas-dist" description="Deploys Slide as a web application with JAAS authentication to Tomcat 5" if="catalina.present">
+ <copy file="${slide.dist}/slide/webapp/slide-doc.war" todir="${catalina.dist}/webapps" overwrite="yes"/>
+ <copy file="${slide.dist}/slide/webapp/slide.war" todir="${catalina.dist}/webapps" overwrite="yes"/>
+ <!-- jaas config -->
+ <copy file="src/conf/webapp/jaas.config" todir="${catalina.dist}/conf/" overwrite="yes"/>
+ <!-- patch server.xml -->
+ <patch originalfile="${catalina.dist}/conf/server.xml" patchfile="src/conf/catalina/tomcat-jaas-server.patch"/>
+ <!-- patch startup -->
+ <patch originalfile="${catalina.dist}/bin/startup.bat" patchfile="src/conf/catalina/startup-jaas.bat.patch"/>
+ <patch originalfile="${catalina.dist}/bin/catalina.sh" patchfile="src/conf/catalina/catalina-jaas.sh.patch"/>
+ <ant antfile="build.xml" dir="projector" target="tomcat-install"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build Catalina related components -->
+ <!-- This target requires Tomcat 4 or 5 -->
+ <!-- =================================================================== -->
+ <target name="catalina-wrapper" depends="dist" if="catalina.present">
+ <javac srcdir="src/wrappers" destdir="${slide.build}/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" includes="**" excludes="**/CVS/**" target="${compile.target}" source="${compile.source}">
+ <classpath refid="wrappers.classpath"/>
+ <exclude name="**/catalina/**" unless="catalina.present"/>
+ <exclude name="**/log4j/**"/>
+ </javac>
+ <copy file="src/etc/MANIFEST.MF" tofile="${slide.build}/classes/MANIFEST.MF"/>
+ <replace file="${slide.build}/classes/MANIFEST.MF" token="$$VERSION$$" value="${version}"/>
+ <copy todir="${slide.build}/classes/wrappers/catalina">
+ <fileset dir="src/wrappers/wrappers/catalina">
+ <include name="slide-descriptors.xml"/>
+ </fileset>
+ </copy>
+ <jar jarfile="${slide.dist}/slide/wrappers/${slide-catalinawrapper.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,**/wrappers/catalina/**"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Installs Slide with Tomcat 4.x using Tomcat authentication -->
+ <!-- This target requires Tomcat 4.x -->
+ <!-- =================================================================== -->
+ <target name="tomcat-4-install" depends="tomcat-install" if="catalina.present" description="Modifies Tomcat 4.x installation to include Slide">
+ <copy todir="${slide.dist}/slide/catalina-conf" overwrite="yes">
+ <fileset dir="src/conf/catalina">
+ <include name="tomcat-4-server.patch"/>
+ </fileset>
+ </copy>
+ <!-- patch server.xml -->
+ <patch originalfile="${catalina.dist}/conf/server.xml" patchfile="${slide.dist}/slide/catalina-conf/tomcat-4-server.patch"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Installs Slide with Tomcat 5.x using Tomcat authentication -->
+ <!-- This target requires Tomcat 5.x -->
+ <!-- =================================================================== -->
+ <target name="tomcat-5-install" depends="tomcat-install" if="catalina.present" description="Modifies Tomcat 5.x installation to include Slide">
+ <copy todir="${slide.dist}/slide/catalina-conf" overwrite="yes">
+ <fileset dir="src/conf/catalina">
+ <include name="tomcat-5-server.patch"/>
+ </fileset>
+ </copy>
+ <!-- patch server.xml -->
+ <patch originalfile="${catalina.dist}/conf/server.xml" patchfile="${slide.dist}/slide/catalina-conf/tomcat-5-server.patch"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Installs Slide with Tomcat 5.x/4.xusing Tomcat authentication -->
+ <!-- This target requires Tomcat 5.x/4.x -->
+ <!-- =================================================================== -->
+ <target name="tomcat-install" depends="catalina-wrapper, webapp-dist" if="catalina.present">
+ <!-- create Slide dir and copy Domain.xml and web.xml to it -->
+ <mkdir dir="${slide.dist}/slide/catalina-conf"/>
+ <filter token="AUTH" value=""/>
+ <!-- enable authentication -->
+ <copy todir="${slide.dist}/slide/catalina-conf" filtering="true" overwrite="yes">
+ <fileset dir="src/conf/webapp">
+ <include name="web.xml"/>
+ <include name="log4j.properties"/>
+ </fileset>
+ </copy>
+ <copy todir="${slide.dist}/slide/catalina-conf" overwrite="yes">
+ <fileset dir="src/conf/catalina">
+ <include name="slide.properties"/>
+ </fileset>
+ </copy>
+ <copy file="${slide.dist}/slide/catalina-conf/slide.properties" tofile="${slide.build}/classes/org/apache/slide/slide.properties"/>
+ <jar jarfile="${slide.dist}/slide/catalina-conf/${slide-kernel-bundle.jar}" basedir="${slide.build}/classes" manifest="${slide.build}/classes/MANIFEST.MF" includes="LICENSE,NOTICE,org/apache/slide/**,org/apache/util/**" excludes="org/apache/slide/webdav/**"/>
+ <mkdir dir="${catalina.dist}/slide"/>
+ <copy todir="${catalina.dist}/slide" overwrite="yes">
+ <fileset dir="src/conf/webapp">
+ <include name="Domain.xml"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${catalina.dist}/slide/WEB-INF"/>
+ <copy todir="${catalina.dist}/slide/WEB-INF" overwrite="yes">
+ <fileset dir="${slide.dist}/slide/catalina-conf">
+ <include name="web.xml"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${catalina.dist}/slide/db-schema" overwrite="yes">
+ <fileset dir="src/conf/schema"/>
+ </copy>
+
+ <!-- also copy general information into Slide directory -->
+ <copy todir="${catalina.dist}/slide" overwrite="yes">
+ <fileset dir=".">
+ <include name="README"/>
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ <include name="${release-notes}"/>
+ </fileset>
+ </copy>
+
+ <!-- install jars in common lib and remove older Tomcat versions -->
+ <copy todir="${catalina.dist}/common/lib">
+ <fileset dir="${slide.dist}/slide/lib">
+ <exclude name="${servlet.jar}"/>
+ <!-- use local version -->
+ <exclude name="${slide-kernel.jar}"/>
+ <!-- use version with different properties instead -->
+ </fileset>
+ <fileset dir="${slide.dist}/slide/catalina-conf">
+ <include name="${slide-kernel-bundle.jar}"/>
+ <!-- use version with different properties -->
+ </fileset>
+ </copy>
+ <delete>
+ <fileset dir="${catalina.dist}/common/lib">
+ <include name="commons-collections.jar"/>
+ <!-- we might have a newer version -->
+ <include name="commons-dbcp-1.1.jar"/>
+ <!-- we have a patched version -->
+ <include name="jta.jar"/>
+ <!-- use geronimo version -->
+ <include name="${slide-kernel.jar}"/>
+ <!-- in case it has been copied here before -->
+ </fileset>
+ </delete>
+ <!-- install wrapper in server lib -->
+ <copy todir="${catalina.dist}/server/lib">
+ <fileset dir="${slide.dist}/slide/wrappers"/>
+ </copy>
+
+ <copy file="${slide.dist}/slide/webapp/slide-doc.war" tofile="${catalina.dist}/webapps/slide-doc.war"/>
+ <ant antfile="build.xml" dir="projector" target="tomcat-install"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Testsuite build, distribution & package -->
+ <!-- =================================================================== -->
+ <target name="testsuite-dist-prepare">
+ <mkdir dir="${testsuite.dist}"/>
+ </target>
+ <target name="testsuite-dist" depends="webdavclient,testsuite-dist-prepare">
+ <ant dir="testsuite" inheritall="false"/>
+ <copy todir="${testsuite.dist}">
+ <fileset dir="${basedir}/testsuite" excludes="**/dist/**,**/CVS/**,**/testCasesResults.xml,**/testErrorsReport.txt"/>
+ </copy>
+ <copy todir="${testsuite.dist}">
+ <fileset dir="${slide.dist}">
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ </fileset>
+ </copy>
+ </target>
+ <target name="package-testsuite-zip" depends="testsuite-dist">
+ <zip zipfile="${slide.dist}/${testsuite.archive}.zip">
+ <zipfileset dir="${testsuite.dist}" prefix="${testsuite.name}"/>
+ </zip>
+ </target>
+ <target name="package-testsuite-tgz" depends="testsuite-dist">
+ <tar tarfile="${slide.dist}/${testsuite.archive}.tar" longfile="gnu">
+ <tarfileset dir="${testsuite.dist}" mode="755" prefix="${testsuite.name}"/>
+ </tar>
+ <gzip zipfile="${slide.dist}/${testsuite.archive}.tar.gz" src="${slide.dist}/${testsuite.archive}.tar"/>
+ <delete file="${slide.dist}/${testsuite.archive}.tar"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Full distribution -->
+ <!-- =================================================================== -->
+ <target name="full-dist" depends="dist, webapp-dist,catalina-wrapper, testsuite-dist" description="Make a full distribution (with all optional components)"/>
+ <!-- =================================================================== -->
+ <!-- Packages the distribution with ZIP -->
+ <!-- =================================================================== -->
+ <target name="package-zip" depends="full-dist">
+ <zip zipfile="${slide.dist}/${slide.archive}.zip">
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="slide/**"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="client/**"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="server/**"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="doc/**"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="webdav-testsuite/**"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="LICENSE"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="NOTICE"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="RUNNING.txt"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="README"/>
+ <zipfileset dir="${slide.dist}" prefix="${final.name}" includes="${release-notes}"/>
+ </zip>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Packages the distribution with TAR-GZIP -->
+ <!-- =================================================================== -->
+ <target name="package-tgz" depends="full-dist">
+ <mkdir dir="${slide.dist}/${final.name}"/>
+ <copy todir="${slide.dist}/${final.name}">
+ <fileset dir="${slide.dist}">
+ <include name="slide/**"/>
+ <include name="client/**"/>
+ <include name="server/**"/>
+ <include name="doc/**"/>
+ <include name="webdav-testsuite/**"/>
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ <include name="RUNNING.txt"/>
+ <include name="README"/>
+ <include name="${release-notes}"/>
+ </fileset>
+ </copy>
+ <tar tarfile="${slide.dist}/${slide.archive}.tar" longfile="gnu">
+ <tarfileset dir="${slide.dist}" mode="755">
+ <include name="${final.name}/server/bin/catalina.sh"/>
+ <include name="${final.name}/server/bin/startup.sh"/>
+ <include name="${final.name}/server/bin/shutdown.sh"/>
+ </tarfileset>
+ <tarfileset dir="${slide.dist}">
+ <include name="${final.name}/**"/>
+ <exclude name="${final.name}/server/bin/catalina.sh"/>
+ <exclude name="${final.name}/server/bin/startup.sh"/>
+ <exclude name="${final.name}/server/bin/shutdown.sh"/>
+ </tarfileset>
+ </tar>
+ <delete dir="${slide.dist}/${final.name}"/>
+ <gzip zipfile="${slide.dist}/${slide.archive}.tar.gz" src="${slide.dist}/${slide.archive}.tar"/>
+ <delete file="${slide.dist}/${slide.archive}.tar"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Packages the distribution with ZIP and TAR-GZIP -->
+ <!-- =================================================================== -->
+ <target name="release" depends="package-zip, package-tgz, package-src-all,package-testsuite-zip,package-testsuite-tgz" description="Packages the distribution with ZIP and TAR-GZIP">
+ <property name="slide.release.bin" value="${slide.dist}/release/${version}/bin"/>
+ <property name="slide.release.src" value="${slide.dist}/release/${version}/src"/>
+ <patternset id="slide.packages.bin">
+ <include name="*-bin-*"/>
+ <include name="*-testsuite-*"/>
+ </patternset>
+ <patternset id="slide.packages.src">
+ <include name="*-src-*"/>
+ </patternset>
+ <!-- create release directories -->
+ <mkdir dir="${slide.release.bin}"/>
+ <mkdir dir="${slide.release.src}"/>
+ <!-- move server releases -->
+ <move todir="${slide.release.bin}">
+ <fileset dir="${slide.dist}">
+ <patternset refid="slide.packages.bin"/>
+ </fileset>
+ </move>
+ <move todir="${slide.release.src}">
+ <fileset dir="${slide.dist}">
+ <patternset refid="slide.packages.src"/>
+ </fileset>
+ </move>
+ <!-- move client releases -->
+ <ant antfile="build.xml" dir="webdavclient" target="release" inheritall="false"/>
+ <move todir="${slide.release.bin}">
+ <fileset dir="${slide.clientlib.dist}">
+ <patternset refid="slide.packages.bin"/>
+ </fileset>
+ </move>
+ <move todir="${slide.release.src}">
+ <fileset dir="${slide.clientlib.dist}">
+ <patternset refid="slide.packages.src"/>
+ </fileset>
+ </move>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Prepares a source distribution for packaging -->
+ <!-- =================================================================== -->
+ <target name="package-src-prepare" depends="dist">
+ <echo message="Preparing source distribution"/>
+ <mkdir dir="${slide.dist}/${slide-src.archive}"/>
+ <copy todir="${slide.dist}/${slide-src.archive}">
+ <fileset dir=".">
+ <include name="lib/**"/>
+ <include name="src/**"/>
+ <include name="projector/**"/>
+ <include name="build.xml"/>
+ <include name="build.properties.sample"/>
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ <include name="README"/>
+ <include name="RUNNING.txt"/>
+ <include name="${release-notes}"/>
+ </fileset>
+ </copy>
+ <copy todir="${slide.dist}/${slide-src.archive}">
+ <fileset dir="${slide.dist}">
+ <include name="doc/**"/>
+ </fileset>
+ </copy>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Packages the source code with ZIP -->
+ <!-- =================================================================== -->
+ <target name="package-src-zip" depends="package-src-prepare">
+ <zip zipfile="${slide.dist}/${slide-src.archive}.zip">
+ <zipfileset dir="${slide.dist}/${slide-src.archive}" prefix="${slide-src.archive}" includes="**"/>
+ </zip>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Packages the source code with TAR-GZIP -->
+ <!-- =================================================================== -->
+ <target name="package-src-tgz" depends="package-src-prepare">
+ <!-- guarantee that the <tar> task notices that the files have changed -->
+ <copy todir="${slide.dist}/temp">
+ <fileset dir="${slide.dist}/${slide-src.archive}">
+ <include name="**"/>
+ </fileset>
+ </copy>
+ <tar tarfile="${slide.dist}/${slide-src.archive}.tar.gz" longfile="gnu" compression="gzip">
+ <tarfileset dir="${slide.dist}/temp" prefix="${slide-src.archive}">
+ <include name="**"/>
+ </tarfileset>
+ </tar>
+ <delete dir="${slide.dist}/temp"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Packages the source code with ZIP and TAG-GZIP -->
+ <!-- =================================================================== -->
+ <target name="package-src-all" depends="package-src-prepare, package-src-zip, package-src-tgz">
+ <!-- cleanup -->
+ <delete dir="${slide.dist}/${slide-src.archive}"/>
+ </target>
+
+ <target name="deploy" depends="webapp-jaas-dist">
+ <delete dir="${deploy.dir}/slide"/>
+ <delete file="${deploy.dir}/slide.war"/>
+ <copy todir="${deploy.dir}" file="${slide.dist}/slide/webapp/slide.war" />
+ </target>
+
+</project>
Added: jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/CollectionInfo.java
URL: http://svn.apache.org/viewvc/jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/CollectionInfo.java?view=auto&rev=524298
==============================================================================
--- jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/CollectionInfo.java (added)
+++ jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/CollectionInfo.java Fri Mar 30 15:24:26 2007
@@ -0,0 +1,38 @@
+
+package com.ibm.db2.purexml;
+
+public class CollectionInfo{
+ private String _tableSchema;
+ private String _tableName;
+ private String _columnIDName;
+
+ public CollectionInfo(String tableSchema,String tableName, String columnIDName){
+ this._tableSchema = tableSchema;
+ this._tableName = tableName;
+ this._columnIDName = columnIDName;
+ }
+
+ public CollectionInfo(String uri){
+ this._tableSchema = "WEBDAV";
+ if(uri.startsWith("/history")){
+ this._tableName = "HISTORY";
+ this._columnIDName = "URI";
+ }
+ else{
+ this._tableName = "DATADEFAULT";
+ this._columnIDName = "ID";
+ }
+ }
+
+ public String getTableSchema(){
+ return this._tableSchema;
+ }
+
+ public String getTableName(){
+ return this._tableName;
+ }
+
+ public String getColumnIDName(){
+ return this._columnIDName;
+ }
+}
\ No newline at end of file
Added: jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/DB2PureXML.java
URL: http://svn.apache.org/viewvc/jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/DB2PureXML.java?view=auto&rev=524298
==============================================================================
--- jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/DB2PureXML.java (added)
+++ jakarta/slide/trunk/proposals/purexmladapter/slide/com/ibm/db2/purexml/DB2PureXML.java Fri Mar 30 15:24:26 2007
@@ -0,0 +1,703 @@
+
+package com.ibm.db2.purexml;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+import org.apache.slide.common.*;
+import org.apache.slide.content.*;
+import org.apache.slide.lock.*;
+import org.apache.slide.security.NodePermission;
+import org.apache.slide.structure.*;
+import org.apache.slide.util.logger.Logger;
+
+public class DB2PureXML extends PureXMLAdapter {
+
+ public DB2PureXML(Service service, Logger logger){
+ super(service, logger);
+ }
+
+ // Object
+ /** Retrive an object from the Descriptors Store.
+ *
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ * @exception ObjectNotFoundException The object to retrieve was not found
+ */
+ public ObjectNode retrieveObject(Connection cnn, Uri uri) throws ServiceAccessException, ObjectNotFoundException {
+ this.uri = uri.toString();
+ load(cnn);
+ if (object == null) {
+ throw new ObjectNotFoundException(uri.toString());
+ }
+ return object.cloneObject();
+ }
+
+ public void createObject(Connection cnn, Uri uri, ObjectNode aObject) throws ServiceAccessException, ObjectAlreadyExistsException{
+ this.uri = uri.toString();
+ //try{
+ //TODO: Original file system has a load here---why??
+ if(metadataExists(cnn))
+ throw new ObjectAlreadyExistsException(uri.toString());
+ init();
+ object = aObject.cloneObject();
+ save(cnn);
+ //}catch(ObjectNotFoundException e){
+ //should not happen
+ //throw createException(e,uri.toString());
+ //}
+ }
+
+ /**
+ * Store an object in the Descriptors Store.
+ *
+ * @param object Object to update
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ * @exception ObjectNotFoundException The object to update was not found
+ */
+ public void storeObject(Connection cnn, Uri uri, ObjectNode aObject)throws ServiceAccessException, ObjectNotFoundException {
+ this.uri = uri.toString();
+ load(cnn);
+ object = aObject.cloneObject();
+ this.save(cnn);
+ }
+
+ /**
+ * Remove an object from the Descriptors Store.
+ *
+ * @param object Object to remove
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ * @exception ObjectNotFoundException The object to remove was not found
+ */
+ public void removeObject(Connection cnn, Uri uri, ObjectNode aObject) throws ServiceAccessException, ObjectNotFoundException {
+ this.uri = uri.toString();
+ load(cnn); //TODO: Check why this is done in removeObject(...,...);
+ delete(cnn);
+ object = null;
+ }
+
+ //Locks
+ /**
+ * Returns the list of locks put on a subject.
+ *
+ * @param subject Subject
+ * @return Enumeration List of locks which have been put on the subject
+ * @exception ServiceAccessException Service access error
+ */
+ public Enumeration enumerateLocks(Connection cnn, Uri uri) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (locks == null)
+ locks = new Vector();
+ return locks.elements();
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ return null; //XXX fake (it is never called)
+ }
+ }
+
+ public void killLock(Connection connection, Uri uri, NodeLock lock) throws ServiceAccessException, LockTokenNotFoundException {
+ removeLock(connection, uri, lock);
+ }
+
+ /**
+ * Puts a lock on a subject.
+ *
+ * @param lock Lock token
+ * @exception ServiceAccessException Service access error
+ */
+ public void putLock(Connection cnn, Uri uri, NodeLock lock) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (locks == null)
+ locks = new Vector();
+ locks.addElement(lock.cloneObject());
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Renews a lock.
+ *
+ * @param lock Token to renew
+ * @exception ServiceAccessException Service access error
+ * @exception LockTokenNotFoundException Lock token was not found
+ */
+ public void renewLock(Connection connection, Uri uri, NodeLock lock) throws ServiceAccessException, LockTokenNotFoundException {
+ this.uri = uri.toString();
+ try{
+ load(connection);
+ if (locks == null)
+ locks = new Vector();
+ boolean wasPresent = locks.removeElement(lock);
+ if (!wasPresent) {
+ throw new LockTokenNotFoundException(lock);
+ }
+ locks.addElement(lock.cloneObject());
+ save(connection);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Removes (cancels) a lock.
+ *
+ * @param lock Token to remove
+ * @exception ServiceAccessException Service access error
+ * @exception LockTokenNotFoundException Lock token was not found
+ */
+ public void removeLock(Connection cnn, Uri uri, NodeLock lock) throws LockTokenNotFoundException, ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (locks == null) {
+ throw new LockTokenNotFoundException(lock);
+ }
+ boolean wasPresent = locks.removeElement(lock);
+ if (!wasPresent) {
+ throw new LockTokenNotFoundException(lock);
+ }
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ //Permissions
+ /**
+ * Store an object permissions in the Descriptors Store.
+ *
+ * @param permission Permission we want to create
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ */
+ public Enumeration enumeratePermissions(Connection connection, Uri uri) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(connection);
+ if (permissions == null)
+ permissions = new Vector();
+ return permissions.elements();
+ }catch(ObjectNotFoundException e){
+ createException(e,uri.toString());
+ return null; //should never happen
+ }
+ }
+
+ /**
+ * Store an object permissions in the Descriptors Store.
+ *
+ * @param permission Permission we want to create
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ */
+ public void grantPermission(Connection connection, Uri uri, NodePermission permission) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(connection);
+ if (permissions == null)
+ permissions = new Vector();
+ permissions.addElement(permission.cloneObject());
+ save(connection);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Store an object permissions in the Descriptors Store.
+ *
+ * @param permission Permission we want to create
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ */
+ public void revokePermission(Connection cnn, Uri uri, NodePermission permission) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (permissions != null)
+ permissions.removeElement(permission);
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Revoke all the permissions on the object .
+ *
+ * @param permission Permission we want to create
+ * @exception ServiceAccessException Error accessing the Descriptors Store
+ */
+ public void revokePermissions(Connection cnn, Uri uri) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (permissions != null)
+ permissions.removeAllElements();
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+
+ }
+
+ /**
+ * Create new revision descriptor.
+ *
+ * @param revisionDescriptor Node revision descriptor
+ * @exception ServiceAccessException Service access error
+ */
+ public void createRevisionDescriptor(Connection cnn, Uri uri, NodeRevisionDescriptor aRevisionDescriptor)throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (descriptor == null)
+ descriptor = new Hashtable();
+ descriptor.put(aRevisionDescriptor.getRevisionNumber().toString(), aRevisionDescriptor.cloneObject());
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ public void removeRevisionContent(Connection cnn, Uri uri, NodeRevisionDescriptor revisionDescriptor) throws ServiceAccessException {
+ String revisionUri = uri.toString() + "_" + revisionDescriptor.getRevisionNumber();
+ if(revisionUri.endsWith("_0.0"))
+ return;
+ this.uri = uri.toString();
+ String tmpUri = (revisionUri.startsWith("/history")) ? revisionUri : this.getLoadPath();
+ CollectionInfo cInfo = null;
+ try{
+ PreparedStatement statement = null;
+ try{
+ cInfo = PureXMLUtilities.getCollectionInfo(PureXMLUtilities.getParentUri(this.getLoadPath(), cnn),cnn);
+ if(cInfo==null)
+ return;
+ String strSQL = "DELETE FROM " + cInfo.getTableSchema() + "." + cInfo.getTableName() + " WHERE " +
+ cInfo.getColumnIDName() + " = ?";
+ statement = cnn.prepareStatement(strSQL);
+ statement.setString(1,PureXMLUtilities.getResourceID(tmpUri,cnn));
+ statement.executeUpdate();
+ }finally{close(statement);}
+ }catch(SQLException e){
+ throw createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Remove revision descriptor.
+ *
+ * @param revisionNumber Revision number
+ * @exception ServiceAccessException Service access error
+ */
+ public void removeRevisionDescriptor(Connection cnn, Uri uri, NodeRevisionNumber number) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (descriptor == null)
+ return;
+ descriptor.remove(number.toString());
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ this.createException(e,uri.toString());
+ }
+ }
+
+ /**
+ * Remove revision descriptors.
+ *
+ * @exception ServiceAccessException Service access error
+ */
+ public void removeRevisionDescriptors(Connection cnn, Uri uri) throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ revisionDescriptors = null;
+ save(cnn);
+ }catch(ObjectNotFoundException e){
+ throw new ServiceAccessException(service, e);
+ }
+ }
+
+ public NodeRevisionContent retrieveRevisionContent(Connection connection, Uri uri, NodeRevisionDescriptor revisionDescriptor,
+ boolean temporaryConnection)throws ServiceAccessException, RevisionNotFoundException {
+
+ String revisionUri = uri.toString() + "_" + revisionDescriptor.getRevisionNumber();
+ this.uri = uri.toString();
+ String tmpUri = this.getLoadPath().startsWith("/history") ? revisionUri : this.getLoadPath();
+ NodeRevisionContent result = null;
+ try{
+ PreparedStatement statement = null;
+ //PureXMLUtilities.print(connection); //zeus
+ ResultSet res = null;
+ InputStream is = null;
+ boolean isDocXML = PureXMLUtilities.isDocXML(revisionDescriptor.getContentType());
+ boolean isExcelDoc = false; //if the XML document being retrived is Microsoft Excel Generated
+ String strSQL = null;
+ CollectionInfo cInfo = PureXMLUtilities.getCollectionInfo(PureXMLUtilities.getParentUri(this.getLoadPath(),connection), connection);
+ ResourceInfo rInfo = PureXMLUtilities.getResourceInfo(tmpUri, connection);//PureXMLUtilities.getResourceInfo(this.getLoadPath(), connection);
+
+ try{
+ if(rInfo == null || rInfo.getColumnContentName() == null) //file not found for such uri, may be a collection
+ throw new RevisionNotFoundException(uri.toString(),revisionDescriptor.getRevisionNumber());
+ if(isDocXML){
+ isExcelDoc = PureXMLUtilities.isExcelDoc(connection,cInfo,rInfo);//PureXMLUtilities.getResourceID(this.getLoadPath(), connection));
+ strSQL = PureXMLUtilities.getXMLQueryString(isExcelDoc,cInfo,rInfo);
+ }
+ else
+ strSQL = "SELECT " + rInfo.getColumnContentName() + " FROM " + cInfo.getTableSchema() + "." +
+ cInfo.getTableName() + " WHERE " + cInfo.getColumnIDName() + " = ?";//ATTACHMENT FROM WEBDAV.DATADEFAULT WHERE ID = ?";//zeus
+ statement = connection.prepareStatement(strSQL);
+ statement.setString(1,rInfo.getDocID());//PureXMLUtilities.getResourceID(this.getLoadPath(), connection));
+ res = statement.executeQuery();
+ if(!res.next())
+ throw new RevisionNotFoundException(uri.toString(),revisionDescriptor.getRevisionNumber());
+ revisionDescriptor.setContentLength(res.getBytes(1).length);
+ is = res.getBinaryStream(1);
+ if(is == null){
+ throw new RevisionNotFoundException(uri.toString(), revisionDescriptor.getRevisionNumber());
+ }
+ result = new NodeRevisionContent();
+ if (bcompress && !isDocXML) {
+ getLogger().log("DeCompressing the data", LOG_CHANNEL, Logger.DEBUG);
+ StoreContentZip ziputil = new StoreContentZip();
+ ziputil.UnZip(is);
+ revisionDescriptor.setContentLength(ziputil.getContentLength());
+ is = ziputil.getInputStream();
+ result.setContent(is);
+ }else{
+ if (temporaryConnection) {
+ result.setContent(new JDBCAwareInputStream(is, statement, res, connection));
+ } else {
+ result.setContent(new JDBCAwareInputStream(is, statement, res, null));
+ }
+ }
+ }finally{
+ try{
+ close(statement,res);
+ }finally{
+ if(bcompress && !isDocXML){ //XXX is "isXML" needed???
+ if(temporaryConnection){
+ try{
+ connection.commit();
+ }finally{
+ connection.close();
+ }
+ }
+ }
+ }
+ }
+ }catch(SQLException e){
+ throw createException(e, uri.toString());
+ }catch(RevisionNotFoundException e){
+ throw e;
+ }catch(Exception e){
+ getLogger().log(e, LOG_CHANNEL, Logger.ERROR);
+ throw new ServiceAccessException(service, e);
+ }
+ return result;
+ }
+
+ public NodeRevisionDescriptor retrieveRevisionDescriptor(Connection connection, Uri uri, NodeRevisionNumber revisionNumber)
+ throws ServiceAccessException, RevisionDescriptorNotFoundException {
+ this.uri = uri.toString();
+ Object result = null;
+ try{
+ this.load(connection);
+ if (descriptor != null && revisionNumber != null)
+ result = descriptor.get(revisionNumber.toString());
+
+ if (result == null) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ }catch(ObjectNotFoundException e){
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ return ((NodeRevisionDescriptor) result).cloneObject();
+ }
+
+ /**
+ * Retrieve a revision descriptors.
+ *
+ * @exception ServiceAccessException Service access error
+ * @exception RevisionDescriptorNotFoundException Revision descriptor
+ * was not found
+ */
+ public NodeRevisionDescriptors retrieveRevisionDescriptors(Connection cnn, Uri uri)
+ throws ServiceAccessException, RevisionDescriptorNotFoundException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (revisionDescriptors == null) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ }catch(ObjectNotFoundException e){
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ return revisionDescriptors.cloneObject();
+ }
+
+ /**
+ * Create new revision descriptors.
+ *
+ * @param revisionDescriptors Node revision descriptors
+ * @exception ServiceAccessException Service access error
+ */
+ public void createRevisionDescriptors(Connection cnn, Uri uri, NodeRevisionDescriptors aRevisionDescriptors)
+ throws ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ revisionDescriptors = aRevisionDescriptors.cloneObject();
+ this.save(cnn);
+ }catch(ObjectNotFoundException e){
+ throw createException(e, uri.toString());
+ }
+ }
+
+ public void createRevisionContent(Connection connection, Uri uri, NodeRevisionDescriptor revisionDescriptor,
+ NodeRevisionContent revisionContent)throws ServiceAccessException, RevisionAlreadyExistException {
+
+ String revisionUri = uri.toString() + "_" + revisionDescriptor.getRevisionNumber();
+ this.uri = uri.toString();
+ String tmpUri = (this.getLoadPath().startsWith("/history")) ? revisionUri : this.getLoadPath();
+ //try{PureXMLUtilities.print(connection);}
+ //catch(SQLException e){System.out.println(e.toString());}
+ boolean contentExists = contentExists(connection,tmpUri);
+ if(contentExists)
+ throw new RevisionAlreadyExistException(uri.toString(), revisionDescriptor.getRevisionNumber());
+ //boolean create = !contentExists; //if content==false then create/insert file else overwrite/update
+
+ storeRevisionContent(connection, uri, revisionDescriptor, revisionContent, true);
+ }
+
+ public void storeRevisionContent(Connection connection, Uri uri, NodeRevisionDescriptor revisionDescriptor,
+ NodeRevisionContent revisionContent)throws ServiceAccessException, RevisionNotFoundException {
+
+ String revisionUri = uri.toString() + "_" + revisionDescriptor.getRevisionNumber();
+ this.uri = uri.toString();
+ String tmpUri = (this.getLoadPath().startsWith("/history")) ? revisionUri : this.getLoadPath();
+
+ boolean contentExists = contentExists(connection,tmpUri);
+ if(!contentExists)
+ throw new RevisionNotFoundException(uri.toString(), revisionDescriptor.getRevisionNumber());
+
+ storeRevisionContent(connection, uri, revisionDescriptor, revisionContent, false);
+ }
+
+ public boolean storeRevisionContent(Connection connection, Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent,
+ boolean create)throws ServiceAccessException {
+
+ String revisionUri = uri.toString() + "_" + revisionDescriptor.getRevisionNumber();
+ this.uri = uri.toString();
+ try{
+ PreparedStatement statement = null;
+ String columnName = null;
+ InputStream is = revisionContent.streamContent();
+ try{
+ boolean isXML = PureXMLUtilities.isDocXML(revisionDescriptor.getContentType());
+ columnName = isXML ? "DATA" : "ATTACHMENT";
+ if(is != null){
+ long contentLength = 0;
+ if (bcompress && !isXML) {
+ getLogger().log("Compressing the data", LOG_CHANNEL, Logger.DEBUG);
+ StoreContentZip ziputil = new StoreContentZip();
+ ziputil.Zip(is);
+ is = ziputil.getInputStream();
+ contentLength = ziputil.getContentLength();
+ } else {
+ contentLength = revisionDescriptor.getContentLength();
+ }
+ if(contentLength==0)
+ return true; //XXX: method gets called twice when storing a new file through MS Office may be a bug, so ignore first time since file content==0
+ byte buffer[] = new byte[2048];
+ File tempFile = null;
+ if (contentLength == -1) {
+ try {
+ tempFile = File.createTempFile("content", null);
+ FileOutputStream fos = new FileOutputStream(tempFile);
+ do {
+ int nChar = is.read(buffer);
+ if (nChar == -1)
+ break;
+ fos.write(buffer, 0, nChar);
+ } while (true);
+ fos.close();
+ is.close();
+ is = new FileInputStream(tempFile);
+ contentLength = tempFile.length();
+ } catch (IOException ex) {
+ getLogger().log(
+ ex.toString() + " during the calculation of the content length.",
+ LOG_CHANNEL,
+ Logger.ERROR);
+ getLogger().log("tempFile: " + tempFile.getAbsolutePath(), LOG_CHANNEL, Logger.ERROR);
+ throw ex;
+ }
+ }
+ if(create){
+ String docID = null;
+ ResultSet rs = null;
+ String strSQL = null;
+ if(this.getLoadPath().startsWith("/history")){
+ strSQL = "INSERT INTO WEBDAV.HISTORY(URI,DATA,ATTACHMENT) VALUES(?,?,?)";
+ statement = connection.prepareStatement(strSQL);
+ statement.setString(1, revisionUri);
+ if(isXML){//reset contentLength, will happen only with XML docs that length won't coincide because of whitespaces
+ revisionDescriptor.setContentLength(revisionContent.getContentBytes().length);
+ statement.setBytes(2, revisionContent.getContentBytes());
+ statement.setNull(3,java.sql.Types.BLOB);
+ }
+ else{
+ statement.setString(2,null);
+ statement.setBinaryStream(3, is, (int)contentLength);
+ }
+ statement.executeUpdate();
+ }
+ else{
+ if(PureXMLUtilities.isExposedCollection(PureXMLUtilities.getParentUri(this.getLoadPath(),connection), connection)){
+ CollectionInfo cInfo = PureXMLUtilities.getCollectionInfo(PureXMLUtilities.getParentUri(this.getLoadPath(), connection),connection);
+ columnName = PureXMLUtilities.getExposedColumnContentName(PureXMLUtilities.getParentUri(this.getLoadPath(), connection), connection);
+ int type = PureXMLUtilities.getColumnSQLType(connection, cInfo.getTableSchema(), cInfo.getTableName(), cInfo.getColumnIDName()) ;
+ if(type == Types.VARCHAR || type == Types.LONGVARBINARY){
+ strSQL = "INSERT INTO " +
+ cInfo.getTableSchema()+"."+cInfo.getTableName()+"("+cInfo.getColumnIDName()+","+columnName+") VALUES(?,?)";
+ statement = connection.prepareStatement(strSQL);
+ statement.setString(1, revisionUri);
+ statement.setBinaryStream(2,is,(int)contentLength);
+ statement.executeUpdate();
+ PureXMLUtilities.updateResourceInfo(new ResourceInfo(revisionUri,columnName), this.getLoadPath(), connection);
+ }
+ else{ //
+ strSQL = "SELECT " + cInfo.getColumnIDName() + " FROM FINAL TABLE (INSERT INTO " +
+ cInfo.getTableSchema()+"."+cInfo.getTableName()+"("+columnName+") VALUES(?))";
+ statement = connection.prepareStatement(strSQL);
+ statement.setBinaryStream(1,is,(int)contentLength);
+ rs = statement.executeQuery();
+ while(rs.next()){
+ docID = rs.getString(1);
+ PureXMLUtilities.updateResourceInfo(new ResourceInfo(docID,columnName), this.getLoadPath(), connection);
+ }
+ }
+ }
+ else{
+ strSQL = "SELECT ID FROM FINAL TABLE (INSERT INTO " +
+ "WEBDAV.DATADEFAULT(DATA,ATTACHMENT) VALUES(?,?))";
+ statement = connection.prepareStatement(strSQL);
+ if(isXML){
+ statement.setBinaryStream(1,is,(int)contentLength);
+ statement.setNull(2,java.sql.Types.BLOB);
+ }else{
+ statement.setString(1,null);
+ statement.setBinaryStream(2, is, (int)contentLength);
+ }
+ rs = statement.executeQuery();
+ while(rs.next()){
+ docID = rs.getString(1);
+ PureXMLUtilities.updateResourceInfo(new ResourceInfo(docID,columnName), this.getLoadPath(), connection);
+ }
+ }
+ }
+ }
+ else{
+ CollectionInfo cInfo = PureXMLUtilities.getCollectionInfo(PureXMLUtilities.getParentUri(this.getLoadPath(),connection), connection);
+ ResourceInfo rInfo = PureXMLUtilities.getResourceInfo(this.getLoadPath(), connection);
+
+ String strSQL = "UPDATE " + cInfo.getTableSchema() + "." + cInfo.getTableName() +
+ " SET " + rInfo.getColumnContentName() + " = ? WHERE " + cInfo.getColumnIDName() + " = ?";
+ statement = connection.prepareStatement(strSQL);
+ statement.setBinaryStream(1,is,(int)contentLength);
+ int sqlType = PureXMLUtilities.getColumnSQLType(connection, cInfo.getTableSchema(), cInfo.getTableName(), cInfo.getColumnIDName());
+ if(sqlType == Types.VARCHAR || sqlType == Types.LONGVARBINARY){
+ statement.setString(2,rInfo.getDocID());
+ }
+ else { //assume it is of type INTEGER
+ statement.setInt(2,Integer.parseInt(rInfo.getDocID()));
+ }
+ statement.executeUpdate();
+ }
+ if (tempFile != null) {
+ is.close();
+ is = null;
+ tempFile.delete();
+ }
+ }
+ }finally{
+ try{
+ close(statement);
+ }finally {
+ try {
+ close(statement);
+ } finally {
+ if (is != null) {
+ // XXX some JDBC drivers seem to close the stream upon closing of
+ // the statement; if so this will raise an IOException
+ // silently ignore it...
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ logger.log("Could not close stream", ioe, LOG_CHANNEL, Logger.DEBUG);
+ }
+ }
+ }
+ }
+ }
+ }catch (SQLException e) {
+ throw createException(e, uri.toString());
+ } catch (IOException e) {
+ getLogger().log(e, LOG_CHANNEL, Logger.ERROR);
+ throw new ServiceAccessException(service, e);
+ }
+ return true;
+ }
+
+ /**
+ * Update revision descriptor.
+ *
+ * @param revisionDescriptors Node revision descriptor
+ * @exception ServiceAccessException Service access error
+ * @exception RevisionDescriptorNotFoundException Revision descriptor
+ * was not found
+ */
+ public void storeRevisionDescriptor(Connection cnn, Uri uri, NodeRevisionDescriptor aRevisionDescriptor)
+ throws RevisionDescriptorNotFoundException, ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ String key = aRevisionDescriptor.getRevisionNumber().toString();
+ if (descriptor == null || !descriptor.containsKey(key)) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ descriptor.put(key, aRevisionDescriptor.cloneObject());
+ save(cnn);
+ }catch (ObjectNotFoundException e) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ }
+
+ /**
+ * Update revision descriptors.
+ *
+ * @param revisionDescriptors Node revision descriptors
+ * @exception ServiceAccessException Service access error
+ * @exception RevisionDescriptorNotFoundException Revision descriptor
+ * was not found
+ */
+ public void storeRevisionDescriptors(Connection cnn, Uri uri, NodeRevisionDescriptors aRevisionDescriptors)
+ throws RevisionDescriptorNotFoundException, ServiceAccessException {
+ this.uri = uri.toString();
+ try{
+ load(cnn);
+ if (!revisionDescriptors.getUri().equals(uri.toString())) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ revisionDescriptors = aRevisionDescriptors.cloneObject();
+ save(cnn);
+ }catch (ObjectNotFoundException e) {
+ throw new RevisionDescriptorNotFoundException(uri.toString());
+ }
+ }
+}