← Back to team overview

slub.team team mailing list archive

[Merge] lp:~henning-gerhardt/goobi-production/bug-953003 into lp:goobi-production

 

Henning Gerhardt has proposed merging lp:~henning-gerhardt/goobi-production/bug-953003 into lp:goobi-production.

Requested reviews:
  Ralf Claussnitzer (ralf-claussnitzer)
Related bugs:
  Bug #953003 in Goobi.Production: "standard meta data file is pointless"
  https://bugs.launchpad.net/goobi-production/+bug/953003

For more details, see:
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-953003/+merge/97182
-- 
https://code.launchpad.net/~henning-gerhardt/goobi-production/bug-953003/+merge/97182
Your team Saxon State Library Team is subscribed to branch lp:goobi-production.
=== removed file 'config/standard.xml'
--- config/standard.xml	2011-12-20 08:07:09 +0000
+++ config/standard.xml	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ This file is part of the Goobi Application - a Workflow tool for the support of
-  ~ mass digitization.
-  ~
-  ~ Visit the websites for more information.
-  ~     - http://gdz.sub.uni-goettingen.de
-  ~     - http://www.goobi.org
-  ~     - http://launchpad.net/goobi-production
-  ~
-  ~ This program is free software; you can redistribute it and/or modify it under
-  ~ the terms of the GNU General Public License as published by the Free Software
-  ~ Foundation; either version 2 of the License, or (at your option) any later
-  ~ version.
-  ~
-  ~ This program is distributed in the hope that it will be useful, but WITHOUT ANY
-  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-  ~ PARTICULAR PURPOSE. See the GNU General Public License for more details. You
-  ~ should have received a copy of the GNU General Public License along with this
-  ~ program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-  ~ Suite 330, Boston, MA 02111-1307 USA
-  -->
-
-<RDF:RDF xmlns:AGORA="GDZ:DMSDB-Semantics" xmlns:RDF="http://www.w3c.org/RDF";><AGORA:DocStrct AGORA:Type="AGORA:Periodical"><AGORA:DocStrct AGORA:Type="AGORA:PeriodicalVolume"><AGORA:RefImageSetRange><AGORA:RefImageSet RDF:HREF="#Imageset001"/><AGORA:ImageSetPageStart>9999</AGORA:ImageSetPageStart><AGORA:ImageSetPageEnd>0</AGORA:ImageSetPageEnd></AGORA:RefImageSetRange></AGORA:DocStrct></AGORA:DocStrct><AGORA:ImageSet/></RDF:RDF>
\ No newline at end of file

=== modified file 'src/de/sub/goobi/beans/Prozess.java'
--- src/de/sub/goobi/beans/Prozess.java	2012-03-06 13:42:19 +0000
+++ src/de/sub/goobi/beans/Prozess.java	2012-03-13 10:35:21 +0000
@@ -665,7 +665,11 @@
 
 	public Fileformat readMetadataFile() throws ReadException, IOException, InterruptedException, PreferencesException, SwapException, DAOException,
 			WriteException {
-		checkForMetadataFile();
+
+		if (! checkForMetadataFile()) {
+		    throw new IOException("Can't open metadata file: " + getMetadataFilePath() + "!");
+		}
+
 		/* prüfen, welches Format die Metadaten haben (Mets, xstream oder rdf */
 		String type = MetadatenHelper.getMetaFileType(getMetadataFilePath());
 		myLogger.debug("current meta.xml file type for id " + getId() + ": " + type);
@@ -727,40 +731,18 @@
 		}
 	}
 
-	private void checkForMetadataFile() throws IOException, InterruptedException, SwapException, DAOException, WriteException, PreferencesException {
-		/* prüfen ob die xml-Datei überhaupt existiert, wenn nicht, neu anlegen */
-		File f = new java.io.File(getMetadataFilePath());
+	private boolean checkForMetadataFile() throws IOException, InterruptedException, SwapException, DAOException, WriteException, PreferencesException {
+		boolean result = true;
+		File f = new File(getMetadataFilePath());
+
 		if (!f.exists()) {
-
-			// TODO: diese Meldung als Fehlermeldung direkt nach dem Neuanlegen???
-			myLogger.warn(Helper.getTranslation("metadataFileNotFound") + f.getAbsolutePath());
-			storeDefaultMetaFile(f);
-		}
-	}
-
-	private void storeDefaultMetaFile(File f) throws IOException {
-		/* wenn Verzeichnis angelegt wurde, jetzt die xml-Datei anlegen */
-		File fstandard = new java.io.File(help.getGoobiDataDirectory() + "standard.xml");
-
-		if (!fstandard.exists()) {
-			URL standardURL = Helper.class.getClassLoader().getResource("standard.xml");
-			if (standardURL != null) {
-				try {
-					Helper.copyFile(new File(standardURL.toURI()), fstandard);
-				} catch (URISyntaxException e) {
-					throw new IOException("Fehler beim Anlegen der Metdaten-Datei meta.xml (IOException): " + e.getMessage());
-				}
-			}
-		}
-
-		if (fstandard.exists()) {
-			try {
-				Helper.copyFile(fstandard, f);
-			} catch (IOException e) {
-				throw new IOException("Fehler beim Anlegen der Metdaten-Datei meta.xml (IOException): " + e.getMessage());
-			}
-		} else
-			throw new IOException("Fehler beim Anlegen der Metadaten-Datei, standard.xml nicht vorhanden (" + fstandard.getAbsolutePath() + ")");
+			String errorMessage = Helper.getTranslation("metadataFileNotFound") + " " + f.getAbsolutePath();
+			myLogger.warn(errorMessage);
+			Helper.setFehlerMeldung(errorMessage);
+			result = false;
+		}
+
+		return result;
 	}
 
 	public void writeMetadataFile(Fileformat gdzfile) throws IOException, InterruptedException, SwapException, DAOException, WriteException,

=== modified file 'src/messages/messages_de.properties'
--- src/messages/messages_de.properties	2012-02-21 08:31:02 +0000
+++ src/messages/messages_de.properties	2012-03-13 10:35:21 +0000
@@ -405,7 +405,7 @@
 metaDataError=Es gab einen schweren Fehler in der Metadaten-Datei. M\u00F6glicherweise gingen Daten verloren. Benachrichtigen Sie Ihren Administrator, damit der sich dieses Problem ansehen kann.
 metadata=Metadaten
 metadataDurchschnitt=Metadaten Durchschnitt
-metadataFileNotFound=Metadaten-Datei existiert nicht und wird daher neu angelegt\:
+metadataFileNotFound=Metadaten-Datei existiert nicht \:
 metadataGesamt=Metadaten gesamt
 metadataValid=Die Metadaten sind valide
 metadaten=Metadaten

=== modified file 'src/messages/messages_en.properties'
--- src/messages/messages_en.properties	2012-02-21 08:31:02 +0000
+++ src/messages/messages_en.properties	2012-03-13 10:35:21 +0000
@@ -405,7 +405,7 @@
 metaDataError=
 metadata=Metadata
 metadataDurchschnitt=Metadata average
-metadataFileNotFound=Metadata file not found and therefore newly created
+metadataFileNotFound=Metadata file not found \:
 metadataGesamt=Metadata total
 metadataValid=metadata are valid
 metadaten=Metadata


Follow ups