diff --git a/dspace/bin/etd2marc-mail b/dspace/bin/etd2marc-mail deleted file mode 100755 index 350baf8fac1e..000000000000 --- a/dspace/bin/etd2marc-mail +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl - -##################################################################### -# Copyright 2006, The University of Maryland. All rights reserved. -# -# Program: edt2marc-mail -# -# Author: Ben Wallberg -# -# Purpose: mail notification of new etd marc records -# -# Usage: See PrintUsageAndExit() -# -# Comments: -# -# Revision History: -# -# 2006/04/21: Ben -# - initial version. -# -##################################################################### - -use Getopt::Std; -use Mail::Sendmail; - -$count = $ARGV[0]; -$file = $ARGV[1]; - -# Get directories -chomp($bindir = `dirname $0`); - - -%mail = (); -chomp($mail{To} = `$bindir/dspace dsprop -property drum.mail.etdmarc.recipient`); -chomp($mail{From} = `$bindir/dspace dsprop -property mail.from.address`); -chomp($mail{Smtp} = `$bindir/dspace dsprop -property mail.server`); -$mail{Subject} = "ETD MARC records are available"; -$mail{Message} = "$count ETD MARC records are available in $file"; - -if (! (sendmail %mail)) { - die "Error sending email notice:\n" . $Mail::Sendmail::error; -} - -exit 0; - diff --git a/dspace/bin/etd2marc-transfer b/dspace/bin/etd2marc-transfer deleted file mode 100755 index ae7741310075..000000000000 --- a/dspace/bin/etd2marc-transfer +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Get the DSPACE/bin directory -BINDIR=`dirname $0` - -AUTH=${BINDIR}/../config/etd2marc-transfer - -/usr/bin/smbclient '//libdoc.umd.edu/department$' -A ${AUTH} -D 'Special Project\ETD MARC records' -c "put $1" - - diff --git a/dspace/bin/load-etd b/dspace/bin/load-etd index bd8a05b6277d..02034cc99934 100755 --- a/dspace/bin/load-etd +++ b/dspace/bin/load-etd @@ -29,9 +29,7 @@ chomp($bindir = `dirname $0`); $ENV{UMD_DSPACE_CLI_LOG_CONFIG} = "-Dlog4j2.configurationFile=log4j2-etdloader.xml"; $ENV{JAVA_OPTS} .= " -Ddspace.log.init.disable=true"; $ENV{JAVA_OPTS} .= " -Detdloader.zipfile=$zipfile"; -$ENV{JAVA_OPTS} .= " -Detdloader.marcfile=$marcfile" if (defined $marcfile); $ENV{JAVA_OPTS} .= " -Detdloader.singleitem=$item" if (defined $item); -$ENV{JAVA_OPTS} .= " -Detdloader.csvfile=$csvfile" if (defined $csvfile); # Add additions jar to front of classpath to ensure the overlay files # has precedence over stock implementation @@ -62,7 +60,7 @@ sub GetCmdLine { PrintUsageAndExit(); } - if ( ! getopts('i:o:r:c:')) { + if ( ! getopts('i:r:')) { print "Error in option processing\n\n"; PrintUsageAndExit(); } @@ -72,18 +70,10 @@ sub GetCmdLine { } $zipfile = $opt_i; - if (defined $opt_o) { - $marcfile = $opt_o; - } - if (defined $opt_r) { $item = $opt_r; } - if (defined $opt_c) { - $csvfile = $opt_c; - } - } @@ -101,11 +91,9 @@ sub PrintUsageAndExit { } print <<'EOS'; -Usage: load-etd -i [-o ] [-r ] [-c ] +Usage: load-etd -i [-r ] : zip file containing items to load - : output marc file : process a single item, not the entire zip file - : CSV output file with author,title,handle of each item EOS exit 1; diff --git a/dspace/bin/load-etd-nightly b/dspace/bin/load-etd-nightly index 41709e1293cb..b9f21ed1f707 100755 --- a/dspace/bin/load-etd-nightly +++ b/dspace/bin/load-etd-nightly @@ -1,7 +1,7 @@ #!/bin/csh # load-etd-nightly -# +# # Check for new upload files in the incoming directory and load # them into dspace. # @@ -17,37 +17,22 @@ set datadir = `cd $argv[1]; pwd` set bindir = `dirname $0` set incomingdir = $datadir/incoming set processeddir = $datadir/processed -set marcdir = $datadir/marc -set marcfile = `date '+%Y%m%d'`.dat -set csvdir = $datadir/csv -set csvfile = `date '+%Y%m%d'`.csv -set transfermarc = `$bindir/dspace dsprop -property etdloader.transfermarc`; # Check for incoming files ls $incomingdir/etdadmin_upload_*.zip >& /dev/null if ($status == 0) then echo Files found in $incomingdir - if (! -d $marcdir ) then - mkdir -p $marcdir - endif - if (! -d $csvdir ) then - mkdir -p $csvdir - endif - - touch $marcdir/$marcfile - touch $csvdir/$csvfile - @ count = 0 foreach upload ($incomingdir/etdadmin_upload_*.zip) set zipfile = `basename $upload` - # Load the files from this archive - echo + # Load the files from this archive + echo echo ====================================================================== - echo Loading archive file: $incomingdir/$zipfile - $bindir/load-etd -i $incomingdir/$zipfile -o $marcdir/$marcfile -c $csvdir/$csvfile + echo Loading archive file: $incomingdir/$zipfile + $bindir/load-etd -i $incomingdir/$zipfile # Move archive to the processed directory if (! -d $processeddir ) then @@ -59,23 +44,6 @@ if ($status == 0) then @ count = $count + 1 end - - # Marc processing - if ($count > 0) then - if ($transfermarc == "true") then - echo - echo ====================================================================== - echo Transfering marc file - cd $marcdir - $bindir/etd2marc-transfer $marcfile - - echo - echo Sending email notification - $bindir/etd2marc-mail $count $marcfile - else - echo Upload of the marc file is not enabled - endif - endif endif diff --git a/dspace/config/load/etd2marc.xsl b/dspace/config/load/etd2marc.xsl deleted file mode 100644 index 53c7898bfac7..000000000000 --- a/dspace/config/load/etd2marc.xsl +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - 00000nam 22 ka 4500 - - cr n - - - s - - mdu sbm eng d - - - - UMC - UMC - - - - UMCP - - - - - - - . - - - - - - - [electronic resource] / - - - - - . - - - - - College Park, Md.: - University of Maryland, - - - . - - - - - - - Thesis research directed by: - - . - - - - - - Title from t.p. of PDF. - - - - - - Thesis ( - - ) -- University of Maryland, College Park, - - . - - - - - - Includes bibliographical references. - - - - - - - - Also available in paper. - Published by UMI Dissertation Services, Ann Arbor, Mich. - - - - - - - - - - 1 - CPSPE - MDTHS - LD3231.M70d - - - - - - - - - 1.1 - 03 - - MT:BOOK - - - - 2 - CPNET - WWW - LD3231.M70d - - - - - - - - - 2.1 - 04 - - MT:WWW - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dspace/config/local.cfg.EXAMPLE b/dspace/config/local.cfg.EXAMPLE index bc97cd97b9f8..c5549b89193e 100644 --- a/dspace/config/local.cfg.EXAMPLE +++ b/dspace/config/local.cfg.EXAMPLE @@ -402,7 +402,6 @@ drum.mail.duplicate_title = mohideen@umd.edu drum.eperson.subscription.limiteperson = # Used by etd loader cron job -drum.etdloader.transfermarc = false drum.etdloader.eperson = load_diss@drum.umd.edu # UUID of "UMD Theses and Dissertations" collection drum.etdloader.collection = ba3ddc3f-7a58-4fd3-bde5-304938050ea2 diff --git a/dspace/modules/additions/src/main/java/edu/umd/lib/dspace/app/EtdLoader.java b/dspace/modules/additions/src/main/java/edu/umd/lib/dspace/app/EtdLoader.java index 1d5c76db63ff..5a5100ffad7a 100644 --- a/dspace/modules/additions/src/main/java/edu/umd/lib/dspace/app/EtdLoader.java +++ b/dspace/modules/additions/src/main/java/edu/umd/lib/dspace/app/EtdLoader.java @@ -6,12 +6,8 @@ package edu.umd.lib.dspace.app; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.StringReader; import java.io.StringWriter; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -88,9 +84,6 @@ import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.sort.OrderFormat; import org.dspace.util.UUIDUtils; -import org.marc4j.MarcStreamWriter; -import org.marc4j.MarcXmlReader; -import org.marc4j.marc.Record; import org.xml.sax.InputSource; // SQL // IO @@ -144,8 +137,6 @@ private EtdLoader() { static Transformer tDC = null; - static Transformer tMeta2Marc = null; - static Map namespace = new HashMap(); static Map mXPath = new HashMap(); @@ -158,10 +149,6 @@ private EtdLoader() { static SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); - static MarcStreamWriter marcwriter = null; - - static PrintWriter csvwriter = null; - static Pattern pZipEntry = Pattern .compile(".*_umd_0117._(\\d+)(.pdf|_DATA.xml)"); @@ -216,8 +203,6 @@ public static void main(String args[]) throws Exception { String strZipFile = props.getProperty("etdloader.zipfile", null); String strSingleItem = props.getProperty("etdloader.singleitem", null); - String strMarcFile = props.getProperty("etdloader.marcfile", null); - String strCsvFile = props.getProperty("etdloader.csvfile", null); // dspace dir String strDspace = configurationService.getProperty("dspace.dir"); @@ -226,34 +211,14 @@ public static void main(String args[]) throws Exception { String strCollection = configurationService .getProperty("drum.etdloader.collection"); - String transferMarc = configurationService - .getProperty("drum.etdloader.transfermarc"); - log.info("DSpace directory : " + strDspace); log.info("ETD Loaeder Eperson : " + strEPerson); log.info("ETD Loader Collection: " + strCollection); - log.info("ETD Loader Transfer Marc: " + transferMarc); // the transformers TransformerFactory tFactory = TransformerFactory.newInstance(); tDC = tFactory.newTransformer(new StreamSource(new File(strDspace + "/config/load/etd2dc.xsl"))); - tMeta2Marc = tFactory.newTransformer(new StreamSource(new File( - strDspace + "/config/load/etd2marc.xsl"))); - - // open the marc output file - if (strMarcFile != null) { - FileOutputStream fos = new FileOutputStream(new File( - strMarcFile), true); - marcwriter = new MarcStreamWriter(fos, "UTF-8"); - } - - // open the csv output file - if (strCsvFile != null) { - FileOutputStream fos = new FileOutputStream(strCsvFile, true); - OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); - csvwriter = new PrintWriter(osw); - } // Get DSpace values Context context = new Context(); @@ -299,22 +264,6 @@ public static void main(String args[]) throws Exception { } catch (Exception e) { log.error("Uncaught exception: " + e.getMessage(), e); } finally { - if (marcwriter != null) { - try { - marcwriter.close(); - } catch (Exception e) { - log.error("Error closing marcwriter", e); - } - } - - if (csvwriter != null) { - try { - csvwriter.close(); - } catch (Exception e) { - log.error("Error closing csvwriter", e); - } - } - log.info("=====================================\n" + "Records read: " + lRead + "\n" + "Records written: " + lWritten + "\n" + "Embargoes: " + lEmbargo); @@ -601,92 +550,6 @@ private static void checkTitle(Context c, Item item, Set sCollections) } } - /*********************************************************** createMarc */ - /** - * Create a marc record from the etd metadata. - */ - - public static void createMarc(Document meta, String strHandle, List files) - throws Exception { - - if (marcwriter != null) { - log.debug("Creating marc"); - - // Convert etd metadata to marc xml - DocumentSource source = new DocumentSource(meta); - DocumentResult result = new DocumentResult(); - - tMeta2Marc.setParameter("files", getFileTypes(files)); - tMeta2Marc.setParameter("handle", strHandle); - tMeta2Marc.transform(source, result); - - // Convert marc xml to marc - StringWriter sw = new StringWriter(); - XMLWriter writer = new XMLWriter(sw); - writer.write(result.getDocument()); - writer.flush(); - InputSource is = new InputSource(new StringReader(sw.toString())); - MarcXmlReader convert = new MarcXmlReader(is); - Record record = convert.next(); - - // Write out the marc record - marcwriter.write(record); - } - } - - /************************************************************ createCsv */ - /** - * Add an entry in the CSV files for this item: title, author, handle - */ - - public static void createCsv(Item item, String strHandle) throws Exception { - - if (csvwriter != null) { - log.debug("Creating CSV"); - - // Build the line - StringBuffer sb = new StringBuffer(); - - sb.append('"'); - - // Get the title(s) - List titles = itemService.getMetadata(item, MetadataSchemaEnum.DC.getName(), "title", null, - Item.ANY); - - for (int i = 0; i < titles.size(); i++) { - if (i > 0) { - sb.append("; "); - } - - sb.append(titles.get(i).getValue().replaceAll("\"", "\"\"")); - } - - sb.append("\",\""); - - // Get the author(s) - List authors = itemService.getMetadata(item, MetadataSchemaEnum.DC.getName(), "contributor", - "author", Item.ANY); - - for (int i = 0; i < authors.size(); i++) { - if (i > 0) { - sb.append("; "); - } - - sb.append(authors.get(i).getValue().replaceAll("\"", "\"\"")); - } - - sb.append("\",\""); - - // Add the handle - sb.append(strHandle); - - sb.append('"'); - - // Write out the csv line - csvwriter.println(sb.toString()); - } - } - /******************************************************* getCollections */ /** * Get additional mapped collections. @@ -871,12 +734,6 @@ public static void loadItem(ZipFile zip, String strItem, List files) { if (sCollections.size() == 0) { reportCollections(context, item); } - - // Create marc record for upload to TSD - createMarc(meta, strHandle, files); - - // Create csv entry for this item - createCsv(item, strHandle); } catch (Exception e) { log.error("Error loading item " + strItem + ": " + e.getMessage());