Skip to content

Instantly share code, notes, and snippets.

@hardyoyo
Created January 10, 2013 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hardyoyo/4506014 to your computer and use it in GitHub Desktop.
Save hardyoyo/4506014 to your computer and use it in GitHub Desktop.
added debug to load_registries target
<?xml version="1.0"?>
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
-->
<!--
- DSpace build file
-
- Version: $Revision$
- Date: $Date$
-->
<project name="DSpace" default="help">
<!-- ============================================================= -->
<!-- Description -->
<!-- ============================================================= -->
<description>
====================== DSpace platform build file ======================
Common usage:
Fresh install, including database setup and registry loading:
% ant fresh_install
Update existing installation, leaving data and configuration intact:
% ant -Dconfig=/installdir/config/dspace.cfg update
========================================================================
</description>
<!-- DS-1391: Ant 1.8.0+ is required, fail if not available. -->
<fail message="Ant 1.8.0+ is required, ${ant.version} is not supported">
<condition>
<not>
<antversion atleast="1.8.0"/>
</not>
</condition>
</fail>
<!-- ============================================================= -->
<!-- Will be using various environment variables -->
<!-- ============================================================= -->
<property environment="env" />
<!-- ============================================================= -->
<!-- Build parameters that are likely to need tweaking -->
<!-- ============================================================= -->
<!-- Default overwrite to true. This may be overridden. -->
<condition property="overwrite" value="true">
<not>
<isset property="overwrite"/>
</not>
</condition>
<!-- Default configuration to use. This may be overridden. -->
<property name="config" value="config/dspace.cfg" />
<!-- Give user a chance to override without editing this file
(and without typing -D each time s/he compiles it) -->
<property file="${user.home}/.dspace.properties" />
<!-- First, set the dspace.dir property so it can be
interpolated when loading the config file.
This crudely mimics the way ConfigurationManager interpolates properties.
Note that it ONLY works for directories that interpolate ${dspace.dir}
but that _should_ cover all cases used in this build configuration.
-->
<loadproperties srcFile="${config}">
<filterchain>
<linecontainsregexp>
<regexp pattern="^\s*dspace\.dir\s+" />
</linecontainsregexp>
</filterchain>
</loadproperties>
<!-- Load the configuration -->
<property file="${config}" />
<!-- Timestamp date used when creating backup directories -->
<tstamp>
<format property="build.date" pattern="yyyyMMdd-HHmmss" />
</tstamp>
<!-- Default location of GeoLiteCity.dat.gz to download. This may be overridden, if URL path changes. -->
<property name="geolite" value="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" />
<!-- ============================================================= -->
<!-- The DSpace class path for executing installation targets -->
<!-- ============================================================= -->
<!-- We will include the environment CLASSPATH -->
<path id="class.path">
<pathelement path="${env.CLASSPATH}" />
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- ============================================================= -->
<!-- Load various Ant libraries which define extra tasks. -->
<!-- ============================================================= -->
<!--Load/initialize all Ant-Contrib libraries from DSpace 'class.path' above.
For more info, see:
http://ant-contrib.sourceforge.net/tasks/index.html -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="class.path"/>
<!-- ============================================================= -->
<!-- Print some useful help text -->
<!-- ============================================================= -->
<target name="help">
<echo message="" />
<echo message="DSpace configuration file" />
<echo message="-----------------------------------" />
<echo message="" />
<echo message="Available targets are:" />
<echo message="" />
<echo message="update --> Update ${dspace.dir} config, etc, lib and web applications without " />
<echo message=" touching your data" />
<echo message="update_configs --> Update your configs directory with new configuration files"/>
<echo message="update_geolite --> Dowload and install GeoCity database into ${dspace.dir}/config" />
<echo message="update_code --> Update compiled code (bin, lib, and etc directories)" />
<echo message="update_webapps --> Update web applications" />
<echo message="" />
<echo message="init_configs --> Write the configuration files to ${dspace.dir}/config" />
<echo message="install_code --> Install compiled code into ${dspace.dir}" />
<echo message="" />
<echo message="fresh_install --> Perform a fresh installation of the software, " />
<echo message=" including the databases &amp; config" />
<echo message="setup_database --> Create database tables" />
<echo message="load_registries --> Load metadata &amp; file format registries into the " />
<echo message=" database" />
<echo message="" />
<echo message="clean_database --> Remove DSpace database tables, destroying data" />
<echo message="" />
<echo message="" />
<echo message="Available parameters are:" />
<echo message="" />
<echo message="-Dconfig=&lt;path/to/dspace.cfg&gt; -- Where your dspace.cfg configuration" />
<echo message=" is located" />
<echo message="-Doverwrite=false -- Will force update_configs to no longer copy existing"/>
<echo message=" config to .old files when they conflict with"/>
<echo message=" the new config. Instead, new conflicting"/>
<echo message=" file with be suffixed with .new."/>
<echo message="-Dwars=true -- Build .war files when updating web" />
<echo message=" applications" />
<echo message="" />
</target>
<!-- ============================================================= -->
<!-- clean out backup directories -->
<!-- ============================================================= -->
<target name="clean_backups">
<delete includeemptydirs="true">
<fileset dir="${dspace.dir}" includes="lib.bak-**/**" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${dspace.dir}" includes="etc.bak-**/**" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${dspace.dir}" includes="webapps.bak-**/**" />
</delete>
<delete includeemptydirs="true">
<fileset dir="${dspace.dir}" includes="bin.bak-**/**" />
</delete>
</target>
<!-- ============================================================= -->
<!-- Update an installation (except database) -->
<!-- ============================================================= -->
<target name="update" depends="update_configs,update_code,update_webapps" description="Update installed code and web applications (without clobbering data/config)">
</target>
<!-- ============================================================= -->
<!-- Update the config dir, only adds files, if a file is altered -->
<!-- in the target directory, the new file is suffixed wth *.new -->
<!-- and should be hand updated afterward . -->
<!-- ============================================================= -->
<target name="update_configs" depends="overwrite_configs,overwrite_solr_configs" description="Updates the Configuration Directory">
<antcall target="init_geolite" />
</target>
<target name="overwrite_configs" description="Overwrites a configuration directory." if="${overwrite}" depends="copy_configs_keep">
<!--
Copy files that are absent in target
-->
<copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config-temp" includes="**/*">
<present present="srconly" targetdir="${dspace.dir}/config" />
</fileset>
</copy>
<!--
Copy files that are different in target to *.old suffix
-->
<copy todir="${dspace.dir}/config" preservelastmodified="true" overwrite="true">
<fileset dir="${dspace.dir}/config">
<and>
<different targetdir="config-temp" ignoreFileTimes="true" />
<present present="both" targetdir="config-temp" />
</and>
<type type="file" />
</fileset>
<globmapper from="*" to="*-${build.date}.old" />
</copy>
<!--
Force overwrite of whats left
-->
<copy todir="${dspace.dir}/config" preservelastmodified="true" overwrite="true">
<fileset dir="config-temp">
<different targetdir="${dspace.dir}/config" ignoreFileTimes="true" />
<type type="file" />
</fileset>
</copy>
<!--
Remove the work directory
-->
<delete dir="config-temp" />
<echo>
====================================================================
The DSpace configuration has been updated.
During the upgrade process the build has attempted to overwrite the
previous configuration while preserving your previous changes in files
suffixed "*.old"
To complete installation, you should do the following:
* Check that you've properly merged any differences in the following files:
</echo>
<fileset dir="${dspace.dir}/config" id="config.files">
<include name="**/*.old"/>
</fileset>
<pathconvert pathsep="${line.separator}" property="configfiles" refid="config.files"/>
<echo>${configfiles}</echo>
<echo>
* To properly merge your previous configuration files, it's
best to try to take the newer version and copy your
previous changes into it.
====================================================================
</echo>
</target>
<target name="copy_configs_keep" unless="${overwrite}" depends="prepare_configs">
<!--
Copy files that are absent in target
-->
<copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config-temp" includes="**/*">
<present present="srconly" targetdir="${dspace.dir}/config" />
</fileset>
</copy>
<!--
Copy files that are different to target to *.new suffix
-->
<copy todir="${dspace.dir}/config" preservelastmodified="true">
<fileset dir="config-temp">
<different targetdir="${dspace.dir}/config" ignoreFileTimes="true" />
<type type="file" />
</fileset>
<globmapper from="*" to="*.new" />
</copy>
<!--
Remove the work directory
-->
<delete dir="config-temp" />
<echo>
====================================================================
The DSpace configuration has been updated.
During the upgrade process the build has preserved your original
configuration and placed any conflicting new files next to your
original suffixed with the "*.new" extension.
To complete installation, you should do the following:
* Check that you've properly merged any differences in the following files:
</echo>
<fileset dir="${dspace.dir}/config" id="config.files">
<include name="**/*.new"/>
</fileset>
<pathconvert pathsep="${line.separator}" property="configfiles" refid="config.files"/>
<echo>${configfiles}</echo>
<echo>
* To properly merge your previous configuration files, it's
best to try to take the newer version and copy your
previous changes into it. Delete the old and remove the
".new" suffix from the new file.
====================================================================
</echo>
</target>
<target name="prepare_configs" description="Updates a configuration directory.">
<mkdir dir="config-temp" />
<!--
Copy designated dspace.cfg
-->
<copy file="${config}" tofile="config-temp/dspace.cfg" preservelastmodified="true" />
<!--
If designated config isn't the one in config/dspace.cfg then lets put a copy of that next to it
-->
<copy todir="config-temp" preservelastmodified="true" overwrite="true" >
<fileset dir="config" includes="dspace.cfg">
<different targetdir="${dspace.dir}/config" ignoreFileTimes="true" />
</fileset>
<globmapper from="*" to="*.default" />
</copy>
<!--
Prepare properly filtered files
-->
<copy todir="config-temp" preservelastmodified="true" overwrite="true" failonerror="false">
<fileset dir="config" excludes="dspace.cfg" />
<filterchain>
<expandproperties />
</filterchain>
</copy>
</target>
<target name="overwrite_solr_configs" description="Overwrites a configuration directory." if="${overwrite}" depends="copy_solr_configs_keep">
<!--
Copy files that are absent in target
-->
<copy todir="${dspace.dir}/solr" preservelastmodified="true">
<fileset dir="solr-config-temp" includes="**/*">
<and>
<present present="srconly" targetdir="${dspace.dir}/solr" />
<!-- acts like <exclude name="**/data/**"/> -->
<filename negate="true" name="**/data/**"/>
</and>
</fileset>
</copy>
<!--
Copy files that are different in target to *.old suffix
-->
<copy todir="${dspace.dir}/solr" preservelastmodified="true" overwrite="true">
<fileset dir="${dspace.dir}/solr">
<and>
<different targetdir="solr-config-temp" ignoreFileTimes="true" />
<present present="both" targetdir="solr-config-temp" />
<!-- acts like <exclude name="**/data/**"/> -->
<filename negate="true" name="**/data/**"/>
</and>
<type type="file" />
</fileset>
<globmapper from="*" to="*-${build.date}.old" />
</copy>
<!--
Force overwrite of whats left
-->
<copy todir="${dspace.dir}/solr" preservelastmodified="true" overwrite="true">
<fileset dir="solr-config-temp">
<and>
<different targetdir="${dspace.dir}/solr" ignoreFileTimes="true" />
<!-- acts like <exclude name="**/data/**"/> -->
<filename negate="true" name="**/data/**"/>
</and>
<type type="file" />
</fileset>
</copy>
<!--
Remove the work directory
-->
<delete dir="solr-config-temp" />
<echo>
====================================================================
The DSpace configuration has been updated.
During the upgrade process the build has attempted to overwrite the
previous configuration while preserving your previous changes in files
suffixed "*.old"
To complete installation, you should do the following:
* Check that you've properly merged any differences in the following files:
</echo>
<fileset dir="${dspace.dir}/solr" id="config.files">
<include name="**/*.old"/>
</fileset>
<pathconvert pathsep="${line.separator}" property="configfiles" refid="config.files"/>
<echo>${configfiles}</echo>
<echo>
* To properly merge your previous configuration files, it's
best to try to take the newer version and copy your
previous changes into it.
====================================================================
</echo>
</target>
<target name="copy_solr_configs_keep" unless="${overwrite}" depends="prepare_solr_configs">
<!--
Copy files that are absent in target
-->
<copy todir="${dspace.dir}/solr" preservelastmodified="true">
<fileset dir="solr-config-temp" includes="**/*">
<and>
<present present="srconly" targetdir="${dspace.dir}/solr"/>
<!-- acts like <exclude name="**/data/**"/> -->
<filename negate="true" name="**/data/**"/>
</and>
</fileset>
</copy>
<!--
Copy files that are different to target to *.new suffix
-->
<copy todir="${dspace.dir}/solr" preservelastmodified="true">
<fileset dir="solr-config-temp">
<and>
<different targetdir="${dspace.dir}/solr" ignoreFileTimes="true"/>
<!-- acts like <exclude name="**/data/**"/> -->
<filename negate="true" name="**/data/**"/>
</and>
<type type="file" />
</fileset>
<globmapper from="*" to="*.new" />
</copy>
<!--
Remove the work directory
-->
<delete dir="solr-config-temp" />
<echo>
====================================================================
The DSpace configuration has been updated.
During the upgrade process the build has preserved your original
configuration and placed any conflicting new files next to your
original suffixed with the "*.new" extension.
To complete installation, you should do the following:
* Check that you've properly merged any differences in the following files:
</echo>
<fileset dir="${dspace.dir}/solr" id="config.files">
<include name="**/*.new"/>
</fileset>
<pathconvert pathsep="${line.separator}" property="configfiles" refid="config.files"/>
<echo>${configfiles}</echo>
<echo>
* To properly merge your previous configuration files, it's
best to try to take the newer version and copy your
previous changes into it. Delete the old and remove the
".new" suffix from the new file.
====================================================================
</echo>
</target>
<target name="prepare_solr_configs" description="Prepares solr configuration directory.">
<mkdir dir="solr-config-temp" />
<!--
Prepare properly filtered files
-->
<copy todir="solr-config-temp" preservelastmodified="true" overwrite="true" failonerror="false">
<fileset dir="solr">
<!-- exclude all "data" directories from being overwritten -->
<exclude name="**/data/**"/>
</fileset>
<filterchain>
<expandproperties />
</filterchain>
</copy>
</target>
<!-- ============================================================= -->
<!-- Update an installation (except database) -->
<!-- ============================================================= -->
<target name="update_code" description="Update installed code (without clobbering data/config)">
<move todir="${dspace.dir}/bin.bak-${build.date}" failonerror="no">
<fileset dir="${dspace.dir}/bin">
<include name="**/*" />
</fileset>
</move>
<copy todir="${dspace.dir}/bin" preservelastmodified="true">
<fileset dir="bin" />
</copy>
<chmod dir="${dspace.dir}/bin" perm="u+x" includes="**/*" />
<move todir="${dspace.dir}/lib.bak-${build.date}" failonerror="no">
<fileset dir="${dspace.dir}/lib">
<include name="**/*" />
</fileset>
</move>
<copy todir="${dspace.dir}/lib" preservelastmodified="true">
<fileset dir="lib" />
</copy>
<move todir="${dspace.dir}/etc.bak-${build.date}" failonerror="no">
<fileset dir="${dspace.dir}/etc">
<include name="**/*" />
</fileset>
</move>
<copy todir="${dspace.dir}/etc" preservelastmodified="true">
<fileset dir="etc" />
</copy>
<copy todir="${dspace.dir}/solr" preservelastmodified="true">
<fileset dir="solr"/>
</copy>
<echo>
====================================================================
${dspace.dir}/bin was backed up to
${dspace.dir}/bin.bak-${build.date}
${dspace.dir}/lib was backed up to
${dspace.dir}/lib.bak-${build.date}
${dspace.dir}/etc was backed up to
${dspace.dir}/etc.bak-${build.date}
Please review these directories and delete if no longer needed.
====================================================================
</echo>
</target>
<!-- ============================================================= -->
<!-- Update Web Applications only -->
<!-- ============================================================= -->
<target name="update_webapps" description="Update Web Applications (without clobbering data/config)">
<move todir="${dspace.dir}/webapps.bak-${build.date}" failonerror="no">
<fileset dir="${dspace.dir}/webapps">
<include name="**/*" />
</fileset>
</move>
<echo>
====================================================================
${dspace.dir}/webapps was backed up to
${dspace.dir}/webapps.bak-${build.date}
Please review this directory and delete it if it's no longer needed.
====================================================================
</echo>
<antcall target="copy_webapps" />
<echo>
====================================================================
Updated DSpace Web application directories are in the
'${dspace.dir}/webapps' directory.
* Stop your Web servlet container (Tomcat, Jetty, Resin etc.)
* If your Web servlet container already loads the DSpace
UI web applications from ${dspace.dir}/webapps/, then you
can jump straight to restarting your Web servlet container
* Otherwise, you will need to copy any web applications from
${dspace.dir}/webapps/ to the appropriate place for your servlet
container. (e.g. '$CATALINA_HOME/webapps' for Tomcat)
If you're using Tomcat, you should first delete any existing
DSpace directories in '$CATALINA_HOME/webapps/' (e.g. you would
delete an existing $CATALINA_HOME/webapps/dspace/ directory).
Otherwise, Tomcat may continue to use old code in that directory.
* Start up your Web servlet container again.
====================================================================
</echo>
</target>
<!-- ============================================================= -->
<!-- Copy Web Applications to Runtime Location -->
<!-- ============================================================= -->
<target name="copy_webapps">
<copy todir="${dspace.dir}/webapps" preservelastmodified="true" failonerror="no">
<fileset dir="webapps">
<exclude name="**/web.xml" />
</fileset>
</copy>
<copy todir="${dspace.dir}/webapps" preservelastmodified="false" failonerror="no">
<fileset dir="webapps">
<include name="**/web.xml" />
</fileset>
<filterchain>
<expandproperties />
</filterchain>
</copy>
<antcall target="build_webapps_wars"/>
</target>
<!-- ============================================================= -->
<!-- Compress Web Applications -->
<!-- (Only executes if the "wars" property is defined) -->
<!-- ============================================================= -->
<target name="build_webapps_wars" description="Compress Web Applications into .war files" if="wars">
<war destfile="${dspace.dir}/webapps/xmlui.war">
<fileset dir="${dspace.dir}/webapps/xmlui/" />
</war>
<war destfile="${dspace.dir}/webapps/oai.war">
<fileset dir="${dspace.dir}/webapps/oai/" />
</war>
<war destfile="${dspace.dir}/webapps/lni.war">
<fileset dir="${dspace.dir}/webapps/lni/" />
</war>
<war destfile="${dspace.dir}/webapps/jspui.war">
<fileset dir="${dspace.dir}/webapps/jspui/" />
</war>
<war destfile="${dspace.dir}/webapps/sword.war">
<fileset dir="${dspace.dir}/webapps/sword/" />
</war>
<war destfile="${dspace.dir}/webapps/solr.war">
<fileset dir="${dspace.dir}/webapps/solr/" />
</war>
</target>
<!-- ============================================================= -->
<!-- Install DSpace and Dependencies -->
<!-- ============================================================= -->
<target name="init_installation">
<mkdir dir="${dspace.dir}/bin" />
<mkdir dir="${dspace.dir}/config" />
<mkdir dir="${dspace.dir}/lib" />
<mkdir dir="${dspace.dir}/etc" />
<mkdir dir="${dspace.dir}/webapps" />
<mkdir dir="${org.dspace.app.itemexport.work.dir}" />
<mkdir dir="${org.dspace.app.itemexport.download.dir}" />
<mkdir dir="${assetstore.dir}" />
<mkdir dir="${handle.dir}" />
<mkdir dir="${search.dir}" />
<mkdir dir="${log.dir}" />
<mkdir dir="${upload.temp.dir}" />
<mkdir dir="${report.dir}" />
<mkdir dir="${dspace.dir}/solr" />
<!-- Runtime files (Could be erased - just for performing purposes) -->
<mkdir dir="${dspace.dir}/var" />
<!-- Runtime files for OAI 2.0 -->
<mkdir dir="${dspace.dir}/var/oai" />
</target>
<!-- ============================================================= -->
<!-- Fresh install of config files -->
<!-- ============================================================= -->
<!-- Writes the configuration files to ${dspace.dir}/config. It does *not*
run the install-configs script. The "log4j.build.properties" file is
copied to ${dspace.dir}/config so there's a simple log4j.properties
file present for the initial run of "install-configs". -->
<target name="init_configs" depends="init_installation">
<copy todir="${dspace.dir}/config" preservelastmodified="true" failonerror="false">
<fileset dir="config" excludes="dspace.cfg" />
<filterchain>
<expandproperties />
</filterchain>
</copy>
<copy file="${config}" tofile="${dspace.dir}/config/dspace.cfg" preservelastmodified="true" />
</target>
<!-- ============================================================= -->
<!-- Check the connection to the database -->
<!-- ============================================================= -->
<!-- Test the connection to the database -->
<target name="test_database">
<java classname="org.dspace.storage.rdbms.DatabaseManager" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
</java>
</target>
<!-- ============================================================= -->
<!-- Create the database tables -->
<!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system
- properties -->
<target name="setup_database" description="Create database tables">
<!-- Load the Schema -->
<java classname="org.dspace.app.launcher.ScriptLauncher" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg value="setup-database" />
<arg value="database_schema.sql" />
</java>
<!-- Add the browse tables -->
<java classname="org.dspace.browse.InitializeBrowseDatabase" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg value="database_schema.sql" />
</java>
</target>
<!-- ============================================================= -->
<!-- Remove the database tables -->
<!-- ============================================================= -->
<!-- We execute InitializeDatabase, passing in the simple log4j properties
- file in etc/ and the DSpace configuration file using system
- properties -->
<target name="clean_database" description="Removes DSpace database tables, destroying data">
<java classname="org.dspace.browse.InitializeBrowseDatabase" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg value="clean-database.sql" />
</java>
<java classname="org.dspace.app.launcher.ScriptLauncher" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg value="clean-database" />
<arg value="clean-database.sql" />
</java>
</target>
<!-- ============================================================= -->
<!-- Load the initial contents of the registries into the database -->
<!-- ============================================================= -->
<!-- Loads bitstream format and Dublin Core type registries -->
<target name="load_registries" description="Load initial contents of registries">
<!-- first import the bitstream registry -->
<java classname="org.dspace.administer.RegistryLoader" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg value="-bitstream" />
<arg value="${dspace.dir}/config/registries/bitstream-formats.xml" />
<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000" />
</java>
<!-- finally import the metadata elements -->
<java classname="org.dspace.administer.MetadataImporter" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg line="-f '${dspace.dir}/config/registries/dublin-core-types.xml'" />
</java>
<!-- FIXME: this should be more modular -->
<!-- import the SWORD required metadata -->
<java classname="org.dspace.administer.MetadataImporter" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg line="-f '${dspace.dir}/config/registries/sword-metadata.xml'" />
</java>
</target>
<!-- ============================================================= -->
<!-- Install fresh code but do not touch the database -->
<!-- ============================================================= -->
<target name="install_code"
depends="init_installation,init_configs"
description="Do a fresh install of the code, preserving any data."
>
<delete failonerror="no">
<fileset dir="${dspace.dir}/bin" includes="**/*" />
</delete>
<copy todir="${dspace.dir}/bin" preservelastmodified="true">
<fileset dir="bin" />
</copy>
<chmod dir="${dspace.dir}/bin" perm="u+x" includes="**/*" />
<delete failonerror="no">
<fileset dir="${dspace.dir}/lib" includes="**/*" />
</delete>
<copy todir="${dspace.dir}/lib" preservelastmodified="true">
<fileset dir="lib" />
</copy>
<!-- NB: no regular use is made of etc/ files in an installed
- system, so this step is 'deprecated', and will eventually
- be removed. -->
<delete failonerror="no">
<fileset dir="${dspace.dir}/etc" includes="**/*" />
</delete>
<copy todir="${dspace.dir}/etc" preservelastmodified="true">
<fileset dir="etc" />
</copy>
<copy todir="${dspace.dir}/solr" preservelastmodified="true">
<fileset dir="solr" />
</copy>
<echo>
====================================================================
The DSpace code has been installed.
====================================================================
</echo>
</target>
<!-- ============================================================= -->
<!-- Do a fresh system install -->
<!-- ============================================================= -->
<target name="fresh_install"
depends="init_installation,init_configs,test_database,setup_database,load_registries,install_code"
description="Do a fresh install of the system, overwriting any data">
<delete failonerror="no">
<fileset dir="${dspace.dir}/webapps" includes="**/*" />
</delete>
<antcall target="copy_webapps" />
<antcall target="init_geolite" />
<java classname="org.dspace.browse.IndexBrowse" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
<arg line="-f" />
</java>
<java classname="org.dspace.search.DSIndexer" classpathref="class.path" fork="yes" failonerror="yes">
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
<sysproperty key="dspace.log.init.disable" value="true" />
<sysproperty key="dspace.configuration" value="${config}" />
</java>
<echo>
====================================================================
The DSpace code has been installed, and the database initialized.
To complete installation, you should do the following:
* Setup your Web servlet container (e.g. Tomcat) to look for your
DSpace web applications in: ${dspace.dir}/webapps/
OR, copy any web applications from ${dspace.dir}/webapps/ to
the appropriate place for your servlet container.
(e.g. '$CATALINA_HOME/webapps' for Tomcat)
* Make an initial administrator account (an e-person) in DSpace:
${dspace.dir}/bin/dspace create-administrator
* Start up your servlet container (Tomcat etc.)
You should then be able to access your DSpace's 'home page':
${dspace.url}
====================================================================
</echo>
</target>
<!-- installes GeoCity resolution database -->
<target name="update_geolite">
<echo>Downloading: ${geolite}</echo>
<trycatch property="geolite.error">
<try>
<get src="${geolite}" dest="${dspace.dir}/config/GeoLiteCity.dat.gz" verbose="true"/>
<gunzip src="${dspace.dir}/config/GeoLiteCity.dat.gz" dest="${dspace.dir}/config/GeoLiteCity.dat" />
<delete file="${dspace.dir}/config/GeoLiteCity.dat.gz" />
</try>
<catch>
<echo>
====================================================================
WARNING : FAILED TO DOWNLOAD GEOLITE DATABASE FILE
(Used for DSpace Solr Usage Statistics)
Underlying Error: ${geolite.error}
In order to use DSpace Solr Usage Statistics, you will need to
manually re-run:
ant update_geolite
OR
You may manually install this file by following these steps:
(1) Download the file from ${geolite}
(2) Unzip it to create a file named 'GeoLiteCity.dat'
(3) Copy that file to '${dspace.dir}/config/GeoLiteCity.dat'
====================================================================
</echo>
</catch>
</trycatch>
</target>
<target name="check_geolite">
<condition property="need.geolite">
<not>
<available file="${dspace.dir}/config/GeoLiteCity.dat" />
</not>
</condition>
</target>
<target name="init_geolite" depends="check_geolite" if="need.geolite">
<antcall target="update_geolite" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment