<commit_before><?xml version="1.0"?>

<!--
  - Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
  - Institute of Technology.  All rights reserved.
  - 
  - Redistribution and use in source and binary forms, with or without
  - modification, are permitted provided that the following conditions are
  - met:
  - 
  - - Redistributions of source code must retain the above copyright
  - notice, this list of conditions and the following disclaimer.
  - 
  - - Redistributions in binary form must reproduce the above copyright
  - notice, this list of conditions and the following disclaimer in the
  - documentation and/or other materials provided with the distribution.
  - 
  - - Neither the name of the Hewlett-Packard Company nor the name of the
  - Massachusetts Institute of Technology nor the names of their
  - contributors may be used to endorse or promote products derived from
  - this software without specific prior written permission.
  - 
  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  - HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  - DAMAGE.
  -->

<!--
  - 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>

	<!-- ============================================================= -->
	<!-- Will be using various environment variables                   -->
	<!-- ============================================================= -->

	<property environment="env" />


	<!-- ============================================================= -->
	<!-- Build parameters that are likely to need tweaking             -->
	<!-- ============================================================= -->

	<!-- 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}" />


	<!-- ============================================================= -->
	<!-- 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>


	<!-- ============================================================= -->
	<!-- 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 installed code without touching your config or data" />
		<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, including the databases &amp; config" />
		<echo message="setup_database  --> Create database tables" />
		<echo message="load_registries --> Load metadata &amp; file format registries into the database" />
		<echo message="" />
		<echo message="clean_database  --> Remove DSpace database tables, destroying data" />

	</target>

	<!-- ============================================================= -->
	<!-- Update an installation (except database)                      -->
	<!-- ============================================================= -->

	<target name="update" description="Update installed code (without clobbering data/config)">

		<tstamp>
			<format property="build.date" pattern="yyyyMMdd-HHmmss" />
		</tstamp>

		<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}/etc" preservelastmodified="true">
			<fileset dir="etc" />
		</copy>

		<move todir="${dspace.dir}/etc.bak-${build.date}" failonerror="no">
			<fileset dir="${dspace.dir}/etc">
				<include name="**/*"/>
			</fileset>
		</move>

		<copy todir="${dspace.dir}/lib" preservelastmodified="true">
			<fileset dir="lib" />
		</copy>

		<echo>
====================================================================
 ${dspace.dir}/lib was backed up to
			
 ${dspace.dir}/lib.bak-${build.date}
			
 Please review this directory and delete it if its no longer needed.
====================================================================
		</echo>

		<move todir="${dspace.dir}/webapps.bak-${build.date}" failonerror="no">
			<fileset dir="${dspace.dir}/webapps">
				<include name="**/*.war"/>
			</fileset>
		</move>

		<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>

		<echo>
====================================================================
 ${dspace.dir}/webapps was backed up to
					
 ${dspace.dir}/webapps.bak-${build.date}
					
 Please review this directory and delete it if its no longer needed.
====================================================================
		</echo>

		<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>


	<!-- ============================================================= -->
	<!-- 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}/webapps" />

		<mkdir dir="${assetstore.dir}" />

		<mkdir dir="${handle.dir}" />

		<mkdir dir="${history.dir}" />

		<mkdir dir="${search.dir}" />

		<mkdir dir="${log.dir}" />

		<mkdir dir="${upload.temp.dir}" />

		<mkdir dir="${report.dir}" />

	</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"/>
			<filterchain>
				<expandproperties/>
			</filterchain>
		</copy>

		<copy file="${config}" tofile="${dspace.dir}/config/dspace.cfg" preservelastmodified="true" />

	</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.storage.rdbms.InitializeDatabase" 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>

		<!-- Add the browse tables -->
        <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="-t -x" />
        </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.storage.rdbms.InitializeDatabase" 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>

	</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" />
		</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>
		
	</target>


	<!-- ============================================================= -->
	<!-- Do a fresh system install                                     -->
	<!-- ============================================================= -->

	<target name="fresh_install" depends="init_installation,init_configs,setup_database,load_registries" description="Do a fresh install of the system, overwriting 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>
		
		<delete failonerror="no">
			<fileset dir="${dspace.dir}/etc" includes="**/*"/>
		</delete>
		
		<copy todir="${dspace.dir}/etc" preservelastmodified="true">
			<fileset dir="etc" />
		</copy>

		<delete failonerror="no">
			<fileset dir="${dspace.dir}/webapps" includes="**/*"/>
		</delete>

		<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>

		<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/create-administrator
   
 * Start up your servlet container (Tomcat etc.)

 You should then be able to access your DSpace's 'home page':
 
   ${dspace.url}
 
 You should also be able to access the administrator UI:
 
   ${dspace.url}/dspace-admin
====================================================================
    	</echo>

	</target>

</project>
<commit_msg>Fixing order of copy processes in 'ant update'.  Previously it was overwriting everything in [dspace]/etc, and *then* backing that up to [dspace]/etc.back-{build.date}.   Fixed it to perform backup of /etc first!<commit_after><?xml version="1.0"?>

<!--
  - Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
  - Institute of Technology.  All rights reserved.
  - 
  - Redistribution and use in source and binary forms, with or without
  - modification, are permitted provided that the following conditions are
  - met:
  - 
  - - Redistributions of source code must retain the above copyright
  - notice, this list of conditions and the following disclaimer.
  - 
  - - Redistributions in binary form must reproduce the above copyright
  - notice, this list of conditions and the following disclaimer in the
  - documentation and/or other materials provided with the distribution.
  - 
  - - Neither the name of the Hewlett-Packard Company nor the name of the
  - Massachusetts Institute of Technology nor the names of their
  - contributors may be used to endorse or promote products derived from
  - this software without specific prior written permission.
  - 
  - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  - HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  - DAMAGE.
  -->

<!--
  - 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>

	<!-- ============================================================= -->
	<!-- Will be using various environment variables                   -->
	<!-- ============================================================= -->

	<property environment="env" />


	<!-- ============================================================= -->
	<!-- Build parameters that are likely to need tweaking             -->
	<!-- ============================================================= -->

	<!-- 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}" />


	<!-- ============================================================= -->
	<!-- 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>


	<!-- ============================================================= -->
	<!-- 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 installed code without touching your config or data" />
		<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, including the databases &amp; config" />
		<echo message="setup_database  --> Create database tables" />
		<echo message="load_registries --> Load metadata &amp; file format registries into the database" />
		<echo message="" />
		<echo message="clean_database  --> Remove DSpace database tables, destroying data" />

	</target>

	<!-- ============================================================= -->
	<!-- Update an installation (except database)                      -->
	<!-- ============================================================= -->

	<target name="update" description="Update installed code (without clobbering data/config)">

		<tstamp>
			<format property="build.date" pattern="yyyyMMdd-HHmmss" />
		</tstamp>

		<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>

		<echo>
====================================================================
 ${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>

		<move todir="${dspace.dir}/webapps.bak-${build.date}" failonerror="no">
			<fileset dir="${dspace.dir}/webapps">
				<include name="**/*.war"/>
			</fileset>
		</move>

		<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>

		<echo>
====================================================================
 ${dspace.dir}/webapps was backed up to
					
 ${dspace.dir}/webapps.bak-${build.date}
					
 Please review this directory and delete it if its no longer needed.
====================================================================
		</echo>

		<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>


	<!-- ============================================================= -->
	<!-- 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}/webapps" />

		<mkdir dir="${assetstore.dir}" />

		<mkdir dir="${handle.dir}" />

		<mkdir dir="${history.dir}" />

		<mkdir dir="${search.dir}" />

		<mkdir dir="${log.dir}" />

		<mkdir dir="${upload.temp.dir}" />

		<mkdir dir="${report.dir}" />

	</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"/>
			<filterchain>
				<expandproperties/>
			</filterchain>
		</copy>

		<copy file="${config}" tofile="${dspace.dir}/config/dspace.cfg" preservelastmodified="true" />

	</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.storage.rdbms.InitializeDatabase" 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>

		<!-- Add the browse tables -->
        <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="-t -x" />
        </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.storage.rdbms.InitializeDatabase" 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>

	</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" />
		</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>
		
	</target>


	<!-- ============================================================= -->
	<!-- Do a fresh system install                                     -->
	<!-- ============================================================= -->

	<target name="fresh_install" depends="init_installation,init_configs,setup_database,load_registries" description="Do a fresh install of the system, overwriting 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>
		
		<delete failonerror="no">
			<fileset dir="${dspace.dir}/etc" includes="**/*"/>
		</delete>
		
		<copy todir="${dspace.dir}/etc" preservelastmodified="true">
			<fileset dir="etc" />
		</copy>

		<delete failonerror="no">
			<fileset dir="${dspace.dir}/webapps" includes="**/*"/>
		</delete>

		<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>

		<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/create-administrator
   
 * Start up your servlet container (Tomcat etc.)

 You should then be able to access your DSpace's 'home page':
 
   ${dspace.url}
 
 You should also be able to access the administrator UI:
 
   ${dspace.url}/dspace-admin
====================================================================
    	</echo>

	</target>

</project>

{'fraction_non_alphanumeric': 0.2612877838342029, 'fraction_numerical': 0.0013991313726061736, 'mean_word_length': 3.7829360100376412, 'pattern_counts': {'":': 0, '<': 501, '<?xml version=': 2, '>': 515, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4502622', 'n_tokens_mistral': 10070, 'n_tokens_neox': 8951, 'n_words': 2507}