slub.team team mailing list archive
-
slub.team team
-
Mailing list archive
-
Message #00214
lp:~zeutschel/goobi-production/replacing-goobi-api-jar-by-source-code into lp:goobi-production
Matthias Ronge has proposed merging lp:~zeutschel/goobi-production/replacing-goobi-api-jar-by-source-code into lp:goobi-production.
Requested reviews:
Saxon State Library Team (slub.team)
For more details, see:
https://code.launchpad.net/~zeutschel/goobi-production/replacing-goobi-api-jar-by-source-code/+merge/104708
I replaced the goobi-api.jar by the java source. The XML-RPC libraries, which had been contained unziped and mixed up with the other class files in goobi-api.jar, have been added in their original form.
--
https://code.launchpad.net/~zeutschel/goobi-production/replacing-goobi-api-jar-by-source-code/+merge/104708
Your team Saxon State Library Team is requested to review the proposed merge of lp:~zeutschel/goobi-production/replacing-goobi-api-jar-by-source-code into lp:goobi-production.
=== removed file 'lib/goobi-api.jar'
Binary files lib/goobi-api.jar 2011-07-19 16:50:14 +0000 and lib/goobi-api.jar 1970-01-01 00:00:00 +0000 differ
=== added file 'lib/ws-commons-util-1.0.2.jar'
Binary files lib/ws-commons-util-1.0.2.jar 1970-01-01 00:00:00 +0000 and lib/ws-commons-util-1.0.2.jar 2012-05-04 10:08:33 +0000 differ
=== added file 'lib/xmlrpc-client-3.1.3.jar'
Binary files lib/xmlrpc-client-3.1.3.jar 1970-01-01 00:00:00 +0000 and lib/xmlrpc-client-3.1.3.jar 2012-05-04 10:08:33 +0000 differ
=== added file 'lib/xmlrpc-common-3.1.3.jar'
Binary files lib/xmlrpc-common-3.1.3.jar 1970-01-01 00:00:00 +0000 and lib/xmlrpc-common-3.1.3.jar 2012-05-04 10:08:33 +0000 differ
=== added file 'lib/xmlrpc-server-3.1.3.jar'
Binary files lib/xmlrpc-server-3.1.3.jar 1970-01-01 00:00:00 +0000 and lib/xmlrpc-server-3.1.3.jar 2012-05-04 10:08:33 +0000 differ
=== added directory 'src/de/unigoettingen/goobi'
=== added directory 'src/de/unigoettingen/goobi/module'
=== added directory 'src/de/unigoettingen/goobi/module/api'
=== added directory 'src/de/unigoettingen/goobi/module/api/dataprovider'
=== added directory 'src/de/unigoettingen/goobi/module/api/dataprovider/process'
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessClient.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessClient.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessClient.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,155 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleParameter;
+
+/**
+ *
+ * Dieser Class wird von dem Module benutzt um die Anfragen an Goobi zu
+ * schicken.
+ *
+ */
+public class ProcessClient {
+ private static final Logger myLogger = Logger.getLogger(ProcessClient.class);
+
+ public static String getImageDir (String serverUrl, String sessionID) throws XmlRpcException, GoobiException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+ myLogger.debug("Process.getImageDir");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionID);
+ String returnString = (String) client.execute("Process.getImageDir", v);
+ myLogger.debug("Result: " + returnString);
+ v.clear();
+ return returnString;
+
+ }
+
+ public static String getMetadataFile (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ //DEBUG
+ myLogger.debug("Process.getMetadataFile:");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ String returnString = (String) client.execute("Process.getMetadataFile", v);
+ myLogger.debug("Result:" + returnString);
+ v.clear();
+ return returnString;
+ }
+
+ public static String getFullTextFile (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ //DEBUG
+ myLogger.debug("Process.getFullTextFile:");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ String returnString = (String) client.execute("Process.getFullTextFile", v);
+ myLogger.debug("Result:" + returnString);
+ v.clear();
+ return returnString;
+ }
+
+ public static String get (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ //DEBUG
+ myLogger.debug("Methode: Process.get");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ String returnString = (String) client.execute("Process.get", v);
+ myLogger.debug("Result:" + returnString);
+ v.clear();
+ return returnString;
+ }
+
+ public static String getTitle (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ //DEBUG
+ myLogger.debug("Process.getTitle:");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ String returnString = (String) client.execute("Process.getTitle", v);
+ myLogger.debug("Result " + returnString);
+ v.clear();
+ return returnString;
+ }
+
+ public static String getProject (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ //DEBUG
+ myLogger.debug("Process.getProject:");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ String returnString = (String) client.execute("Process.getProject", v);
+ myLogger.debug("Result: " + returnString);
+ v.clear();
+ return returnString;
+ }
+
+ public static GoobiModuleParameter getParams (String serverUrl, String sessionId) throws XmlRpcException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Process.getParams:");
+ Vector<String> v = new Vector<String>();
+ v.add(sessionId);
+ HashMap<String, Object> hm = (HashMap<String, Object>) client.execute("Process.getParams", v);
+ return new GoobiModuleParameter(hm);
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessImpl.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessImpl.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessImpl.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,166 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process;
+
+import java.util.HashMap;
+import java.util.Random;
+
+import de.unigoettingen.goobi.module.api.engine.goobi.Engine;
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+
+/**
+ * Das ist die Implementierung von ProcessInterface. Wird auf Goobi-Seiter
+ * Ausgeführt Ist auch vorläufer für GoobiEngine
+ *
+ * @author Igor Toker
+ *
+ */
+public class ProcessImpl implements ProcessInterface {
+
+ /**
+ * Diese Methode wird benötigt um die mit der Session ID verbundene Prozess
+ * ID zu erhalten. Die Implementierung dieser Methode ist optional.
+ *
+ * @param SessionID
+ * @return ProzessID
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400
+ * ====================================
+ * ============================
+ */
+ public String get (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return "test antwort auf Process.get";
+ }
+
+ /**
+ * Diese Methode wird benötigt um die Volltextdatei zu erhalten.
+ *
+ * @param SessionID
+ * @return Pfad zur XML Datei (String)
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400, 1401
+ * ==============================
+ * ==================================
+ */
+ public String getFullTextFile (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return "test Antwort auf Process.getFullTextFile";
+ }
+
+ /**
+ * Diese Methode wird benötigt um das relative Arbeisverzeichnis zu
+ * erhalten.
+ *
+ * @param SessionID
+ * @return Arbeitsverzeichnis (String)
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400, 1401
+ * ==============================
+ * ==================================
+ */
+ public String getImageDir (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ // DEBUG
+ Random rand = new Random();
+ int n = 5;
+ int i = rand.nextInt(n);
+ return "C:\\Hotburn\\Quelle\\" + String.valueOf(i);
+ // return "C:\\Hotburn\\Quelle\\1";
+ //return "/home/hotburn/cd_hotfolder/1";
+ // return "Test Antwort auf getImageDir";
+ }
+
+ /**
+ * Diese Methode wird benötigt um die Metadatendatei zu erhalten.
+ *
+ * @param SessionID
+ * @return Pfad zur XML Datei (String)
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400, 1401
+ * ==============================
+ * ==================================
+ */
+ public String getMetadataFile (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return "Test. Pfad zu XML-Datei!";
+ }
+
+ /**
+ * Diese Methode wird benutzt um die Parameter für den Aufruf des Moduls zu
+ * bekommen. Die Implementierung dieser Methode ist optional.
+ *
+ * @param SessionID
+ * @return Parameter Struktur
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254
+ * ==========================================
+ * ======================
+ */
+ public HashMap getParams (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return new HashMap();
+ }
+
+ /**
+ * Diese Methode liefert das Projekt eines Prozesses. Die Implementierung
+ * dieser Methode ist optional.
+ *
+ * @param SessionID
+ * @return Projekttitel (String)
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400
+ * ====================================
+ * ============================
+ */
+ public String getProject (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return "TIB_Hannover_2007"; // DEBUG test !
+ }
+
+ /**
+ * Diese Methode liefert den Titel eines Prozesses. Die Implementierung
+ * dieser Methode ist optional.
+ *
+ * @param SessionID
+ * @return Prozesstitel (String)
+ * @throws GoobiException
+ * : 1, 2, 4, 5, 6, 254, 1400
+ * ====================================
+ * ============================
+ */
+ public String getTitle (String sessionId) throws GoobiException {
+ validateSessionId(sessionId);
+ return "Test Title für Test Project";
+ }
+
+ private void validateSessionId (String sessionId) throws GoobiException {
+ if (sessionId == null || sessionId.length() == 0) {
+ throw new GoobiException(6, "Paramter erforderlich!");
+ }
+ if (!(Engine.sessions.contains(sessionId))) {
+ throw new GoobiException(1004, "Ungültige Session!");
+ }
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessInterface.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessInterface.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/ProcessInterface.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,103 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process;
+
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+
+public interface ProcessInterface {
+
+ /**
+ * Wir brauchen diese Methode um ProcessId zu erhalten. Rückgabe :
+ * processId von laufender Session(sessionId)
+ *
+ * @param sessionID
+ * @return String mit processId
+ * @throws GoobiException
+ */
+ public String get (String sessionID) throws GoobiException;
+
+ /**
+ * Diese Methode liefert den titel eines Prozesses Rückgabewert :String
+ *
+ * @param sessionId
+ * @return
+ * @throws GoobiException
+ */
+ public String getTitle (String sessionId) throws GoobiException;
+
+ /**
+ * Diese Methode liefert das Projekt eines Prozesses Rückgabe : Project
+ * //TODO: String ?
+ *
+ * @param sessionId
+ * @return
+ * @throws GoobiException
+ */
+ public String getProject (String sessionId) throws GoobiException;
+
+ /**
+ * Diese Methode gibt uns das relative Arbeitsverzeichnis. Rückgabe : Pfad
+ * zum Ordner(String)
+ *
+ * @param sessionId
+ * @param processId
+ * @return Pfad zum Ordner
+ * @throws GoobiException
+ */
+ public String getImageDir (String sessionId) throws GoobiException;
+
+ /**
+ * Diese Methode gibt uns das relative Arbeitsverzeichnis.
+ *
+ * @param sessionId
+ * @param processId
+ * @return Pfad zu XML-Datei(String)
+ * @throws GoobiException
+ */
+ public String getMetadataFile (String sessionId) throws GoobiException;
+
+ /**
+ * Diese Methode gibt uns Pfad zur XML-Datei(String) Rückgabe : Pfad zu
+ * XML-Datei(String)
+ *
+ * @param sessionId
+ * @param processId
+ * @return Fehlernummer
+ * @throws GoobiException
+ */
+ public String getFullTextFile (String sessionId) throws GoobiException;
+
+ //TODO :Gehört diese Methode hierher ?
+ /**
+ * Diese Methode wird benutzt um die Parameter für diesen Module zu
+ * bekommen Rückgabe : Parameter Struktur
+ *
+ * @param sessionId
+ * @return
+ * @throws GoobiException
+ */
+ public HashMap getParams (String sessionId) throws GoobiException;
+
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/dataprovider/process/data'
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataImpl.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataImpl.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataImpl.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,117 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process.data;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.engine.goobi.Engine;
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.types.GoobiProcessProperty;
+
+/**
+ * Implementierung des DataInterface.
+ *
+ * @author Igor Toker
+ *
+ */
+public class DataImpl implements DataInterface {
+
+ /**
+ * Diese Methode wird benötigt um Metadaten zu schreiben.
+ *
+ * @param SessionID
+ * , Type, Count, Property
+ * @return Status (Fehler)
+ * @throws GoobiException
+ * : 1, 2, 6, 7, 254, 1500, 1501, 1502
+ * ==========================
+ * ======================================
+ */
+ public int add (String sessionId, String type, int count, HashMap pp) throws GoobiException {
+ if (!(Engine.sessions.contains(sessionId))) {
+ throw new GoobiException(1004, "Ungültige Session!");
+ }
+ return 0;
+ }
+
+ /**
+ * Diese Methode wird benötigt um feste Eigenschaften von Metadaten
+ * auszulesen. Da die festen Eigenschaften nicht doppelt vorhanden sein
+ * können, erfolgt die Rückgabe als HashMap
+ *
+ * @param SessionID
+ * , Type, Count
+ * @return Liste von Namen–Wert Paaren in Form einer HashMap
+ * @throws GoobiException
+ * : 1, 2, 6, 254, 1500, 1501, 1502
+ * ==============================
+ * ==================================
+ */
+ public HashMap<String, String> getData (String sessionId, String type, int count) throws GoobiException {
+ if (!(Engine.sessions.contains(sessionId))) {
+ throw new GoobiException(1004, "Ungültige Session!");
+ }
+ return new HashMap<String, String>();
+ }
+
+ /**
+ * Diese Methode wird benötigt um Eigenschaften von Metadaten auszulesen,
+ * Da Eigenschaften doppelt vorhanden sein können, erfolgt die Rückgabe
+ * nicht als HashMap sondern als Array von GoobiProcessProperty (Name, Wert,
+ * ID)
+ *
+ * @param SessionID
+ * , Type, Count
+ * @return Liste von Namen–Wert-ID Paaren
+ * @throws GoobiException
+ * : 1, 2, 6, 254, 1501, 1502
+ * ====================================
+ * ============================
+ */
+ public ArrayList<GoobiProcessProperty> getProperties (String sessionId, String type, int count) throws GoobiException {
+ if (!(Engine.sessions.contains(sessionId))) {
+ throw new GoobiException(1004, "Ungültige Session!");
+ }
+ return new ArrayList<GoobiProcessProperty>();
+ }
+
+ /**
+ * Diese Methode wird benötigt um Metadaten zu schreiben.
+ *
+ * @param SessionID
+ * , Type, Count, Property
+ * @return Status (Fehler)
+ * @throws GoobiException
+ * : 1, 2, 6, 7, 254, 1501, 1502
+ * ================================
+ * ================================
+ */
+ public int set (String sessionId, String type, int count, HashMap pp) throws GoobiException {
+ if (!(Engine.sessions.contains(sessionId))) {
+ throw new GoobiException(1004, "Ungültige Session!");
+ }
+ return 0;
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataInterface.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataInterface.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/data/DataInterface.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,83 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process.data;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.types.GoobiProcessProperty;
+
+public interface DataInterface {
+ /**
+ * Diese Methode wird benötigt um feste Eigenschaften von Prozessmetadaten
+ * auszulesen
+ *
+ * @param sessionId
+ * @param processId
+ * @param type
+ * @param count
+ * @return Name-Wert Paare (HashMap)
+ * @throws GoobiException
+ */
+ public HashMap getData (String sessionId, String type, int count) throws GoobiException;
+
+ /**
+ * Diese Methode wird benötigt um die Eigenschaften von Prozessmetadaten
+ * auszulesen
+ *
+ * @param sessionId
+ * @param ProcessId
+ * @param type
+ * @param count
+ * @return Name-Wert Paare.
+ * @throws GoobiException
+ */
+ public ArrayList<GoobiProcessProperty> getProperties (String sessionId, String type, int count) throws GoobiException;
+
+ /**
+ * Diese Methode wird benötigt um Prozessmetadaten zu schreiben
+ *
+ * @param sessionId
+ * @param processId
+ * @param type
+ * @param count
+ * @param pp
+ * @return Fehlernummer
+ * @throws GoobiException
+ */
+ public int set (String sessionId, String type, int count, HashMap pp) throws GoobiException;
+
+ /**
+ * Diese Methode wird benötigt um Prozessmetadaten hinzufügen.
+ *
+ * @param sessionId
+ * @param processId
+ * @param type
+ * @param count
+ * @param pp
+ * @return Fehlernummer
+ * @throws GoobiException
+ */
+ public int add (String sessionId, String type, int count, HashMap pp) throws GoobiException;
+}
=== added file 'src/de/unigoettingen/goobi/module/api/dataprovider/process/data/ProcessDataClient.java'
--- src/de/unigoettingen/goobi/module/api/dataprovider/process/data/ProcessDataClient.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/dataprovider/process/data/ProcessDataClient.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,119 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.dataprovider.process.data;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.types.GoobiProcessProperty;
+
+public class ProcessDataClient {
+ private static final Logger myLogger = Logger.getLogger(ProcessDataClient.class);
+
+ public static int add (String serverUrl, String sessionID, String type, int count, GoobiProcessProperty pp) throws XmlRpcException, GoobiException, MalformedURLException {
+
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Methode: Process.Data.add.");
+ Vector v = new Vector();
+ v.add(sessionID);
+ v.add(type);
+ v.add(count);
+ v.add(pp);
+ client.execute("Process.Data.add", v);
+ v.clear();
+
+ return 0;
+ }
+
+ public static int set (String serverUrl, String sessionId, String type, int count, GoobiProcessProperty pp) throws MalformedURLException, XmlRpcException {
+
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Methode : Process.Data.set.");
+ Vector v = new Vector();
+ v.add(sessionId);
+ v.add(type);
+ v.add(count);
+ v.add(pp);
+ client.execute("Process.Data.set", v);
+ v.clear();
+
+ return 0;
+ }
+
+ public static ArrayList<GoobiProcessProperty> getProperties (String serverUrl, String sessionId, String type, int count) throws MalformedURLException, XmlRpcException {
+
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Process.Data.getProperties");
+ Vector v = new Vector();
+ v.add(sessionId);
+ v.add(type);
+ v.add(count);
+ Object[] response = (Object[]) client.execute("Process.Data.getProperties", v);
+ ArrayList<GoobiProcessProperty> gpps = new ArrayList<GoobiProcessProperty>();
+ for (int i = 0; i < response.length; i++) {
+ gpps.add(new GoobiProcessProperty((HashMap) response[i]));
+ }
+ v.clear();
+ return gpps;
+ }
+
+ public static HashMap getData (String serverUrl, String sessionId, String type, int count) throws MalformedURLException, XmlRpcException {
+
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(serverUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Process.Data.getData:");
+ Vector v = new Vector();
+ v.add(sessionId);
+ v.add(type);
+ v.add(count);
+ HashMap antwortData = (HashMap) client.execute("Process.Data.getData", v);
+ v.clear();
+
+ return antwortData;
+ }
+
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/engine'
=== added directory 'src/de/unigoettingen/goobi/module/api/engine/goobi'
=== added file 'src/de/unigoettingen/goobi/module/api/engine/goobi/Engine.java'
--- src/de/unigoettingen/goobi/module/api/engine/goobi/Engine.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/engine/goobi/Engine.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,41 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.engine.goobi;
+
+import java.util.ArrayList;
+
+import de.unigoettingen.goobi.module.api.dataprovider.process.ProcessImpl;
+
+/**
+ * Dieser Klass ist einer der Namensräume für XMLRPC Das besondere an ihm,
+ * dass der Programmierer, der dieses API benutzt, die möglichkeit hat den zu
+ * erben und überladen
+ *
+ * @author Igor Toker
+ *
+ */
+public class Engine extends ProcessImpl {
+
+ public static ArrayList sessions = new ArrayList<String>();
+ public static String longsessionID = null;
+}
=== added file 'src/de/unigoettingen/goobi/module/api/engine/goobi/GoobiServer.java'
--- src/de/unigoettingen/goobi/module/api/engine/goobi/GoobiServer.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/engine/goobi/GoobiServer.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,94 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.engine.goobi;
+
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.server.PropertyHandlerMapping;
+import org.apache.xmlrpc.server.XmlRpcServer;
+import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
+import org.apache.xmlrpc.webserver.WebServer;
+
+import de.unigoettingen.goobi.module.api.dataprovider.process.ProcessInterface;
+import de.unigoettingen.goobi.module.api.dataprovider.process.data.DataInterface;
+
+/**
+ * Diese Klasse wird als XML-RPC Server von Goobi-Seite benutzt Als Handler muss
+ * die passende Engine gesetzt werden.
+ *
+ */
+public class GoobiServer {
+ private static final Logger myLogger = Logger.getLogger(GoobiServer.class);
+ public static WebServer webServer;
+
+ /**
+ * Mit dieser Methode wird der XMLRPC Server gestartet
+ *
+ * @param process_class
+ * - Dataprovider.process Klass wird übergeben
+ * @param port
+ * - Port von XMLRPC Server
+ * @param data_class
+ * - Dataprovider.process.data Klass
+ */
+ public static void start (ProcessInterface process_class, int port, DataInterface data_class) {
+
+ webServer = new WebServer(port);
+ XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
+ PropertyHandlerMapping phm = new PropertyHandlerMapping();
+
+ try {
+ phm.addHandler("Process", process_class.getClass());
+ /* Hier werden alle restlichen Namensräume, die von diesem
+ * Sever benutzt werden,
+ * erwähnt..
+ */
+ phm.addHandler("Information", de.unigoettingen.goobi.module.api.information.InformationImpl.class);
+ phm.addHandler("Process.Data", data_class.getClass());
+ phm.addHandler("Message", de.unigoettingen.goobi.module.api.message.MessageImpl.class);
+ phm.addHandler("system", org.apache.xmlrpc.metadata.XmlRpcSystemImpl.class);
+ // XmlRpcSystemImpl xrsi = new XmlRpcSystemImpl(phm);
+ // for (String method : xrsi.listMethods()) {
+ // myLogger.debug(method);
+ // }
+ xmlRpcServer.setHandlerMapping(phm);
+ XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
+ serverConfig.setEnabledForExtensions(true);
+ serverConfig.setContentLengthOptional(false);
+ webServer.getXmlRpcServer().setConfig(serverConfig);
+ webServer.start();
+ } catch (XmlRpcException e) {
+ myLogger.error("start(ProcessInterface, int, DataInterface)", e);
+ } catch (IOException e) {
+ myLogger.error("start(ProcessInterface, int, DataInterface)", e);
+ }
+
+ }
+
+ public static void stop () {
+ webServer.shutdown();
+ }
+
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/engine/modules'
=== added file 'src/de/unigoettingen/goobi/module/api/engine/modules/Engine.java'
--- src/de/unigoettingen/goobi/module/api/engine/modules/Engine.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/engine/modules/Engine.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,79 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.engine.modules;
+
+import java.util.ArrayList;
+
+import org.apache.log4j.Logger;
+
+import de.unigoettingen.goobi.module.api.module.ModuleImpl;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleInformation;
+import de.unigoettingen.goobi.module.api.util.UniqueID;
+
+/**
+ * Dieser Klass ist für die Schnittstelle für die Interaktion mit XML-RPC
+ * Server (der im GoobiClient gestartet wird) Er ist subclass von Module und
+ * wird vom XmlRpcServer benutzt. Nur Namensraum : Module ! Gleichzeitig wird
+ * dieser Klass auch vom "Module" selber benutzt um an Goobi die Anfragen zu
+ * schicken.
+ */
+public class Engine extends ModuleImpl {
+ private static final Logger myLogger = Logger.getLogger(Engine.class);
+
+ public GoobiModuleInformation modInfo = new GoobiModuleInformation("Beispiel Modul", "asdfgh", "0.1 beta", 1, 1);
+
+ public static String longsessionID = null;
+ public static ArrayList<String> sessions = null;
+ public static String status = "not active";
+
+ /**
+ * longsessionID wird generiert und static gespeichert! diese longsessionID
+ * wird auch zurückgegeben.
+ */
+ @Override
+ public String initialize (String input_secret) {
+ Engine.longsessionID = UniqueID.generate(input_secret);
+ sessions = new ArrayList<String>();
+ myLogger.debug("initialize(String) - Initializierung: " + Engine.longsessionID);
+ status = "active";
+ return Engine.longsessionID;
+ }
+
+ @Override
+ public String shutdown (String geheimnis) {
+ if (geheimnis.equals(Engine.longsessionID)) {
+ myLogger.debug("shutdown(String) - server is stopped!");
+ status = "not active";
+ try {
+ Thread.sleep(505);
+ } catch (InterruptedException e) {
+ myLogger.error("shutdown(String)", e);
+ }
+ de.unigoettingen.goobi.module.api.engine.modules.ModuleServer.stop();
+ } else {
+ myLogger.debug("falsches secret: " + geheimnis + ", erwartetes geheimnis: " + Engine.longsessionID);
+ }
+ return "";
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/engine/modules/ModuleServer.java'
--- src/de/unigoettingen/goobi/module/api/engine/modules/ModuleServer.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/engine/modules/ModuleServer.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,93 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.engine.modules;
+
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.server.PropertyHandlerMapping;
+import org.apache.xmlrpc.server.XmlRpcServer;
+import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
+import org.apache.xmlrpc.webserver.WebServer;
+
+/**
+ * Diese Klasse wird als XML-RPC Server von beiden Seiten benutzt. Mann muss nur
+ * den Handler und Port setzen
+ *
+ */
+public class ModuleServer {
+ private static final Logger myLogger = Logger.getLogger(ModuleServer.class);
+ public static WebServer webServer;
+ private static boolean running = false;
+
+ private static void initialize (String handler_name, Class handler, int port) {
+ webServer = new WebServer(port);
+ XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
+ PropertyHandlerMapping phm = new PropertyHandlerMapping();
+
+ try {
+ phm.addHandler(handler_name, handler);
+ // Hier werden alle restlichen Namensraeume erwaehnt
+ phm.addHandler("Information", de.unigoettingen.goobi.module.api.information.InformationImpl.class);
+ phm.addHandler("system", org.apache.xmlrpc.metadata.XmlRpcSystemImpl.class);
+ // XmlRpcSystemImpl xrsi = new XmlRpcSystemImpl(phm);
+ // for (String method : xrsi.listMethods()) {
+ // myLogger.debug(method);
+ // }
+ xmlRpcServer.setHandlerMapping(phm);
+ XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
+ serverConfig.setEnabledForExtensions(true);
+ serverConfig.setContentLengthOptional(false);
+ webServer.getXmlRpcServer().setConfig(serverConfig);
+ webServer.start();
+ running = true;
+ } catch (XmlRpcException e) {
+ myLogger.error("initialize(String, Class, int) XmlRpcException", e);
+ } catch (IOException e) {
+ myLogger.error("initialize(String, Class, int) IOException", e);
+ }
+
+ }
+
+ public static void stop () {
+ ModuleServer.webServer.shutdown();
+ running = false;
+ }
+
+ /**
+ * Mit dieser Methode startet man WebServer von Module. (longsession!)
+ *
+ * @param Class
+ * der Engine
+ * @param Port
+ * des Webservers.
+ */
+ public static void start (Class handler, int port) {
+ ModuleServer.initialize("Module", handler, port);
+ }
+
+ public static boolean isRunning () {
+ return running;
+ }
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/exception'
=== added file 'src/de/unigoettingen/goobi/module/api/exception/GoobiException.java'
--- src/de/unigoettingen/goobi/module/api/exception/GoobiException.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/exception/GoobiException.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,82 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.exception;
+
+import java.util.ArrayList;
+
+import org.apache.xmlrpc.XmlRpcException;
+
+public class GoobiException extends XmlRpcException {
+
+ private static final long serialVersionUID = -1687598731712487372L;
+
+ private static ArrayList<String> errorList;
+
+ public GoobiException(int pCode, String pMessage) {
+ super(pCode, pMessage);
+ }
+
+ public GoobiException(int pCode) {
+ super(pCode, errorList.get(pCode));
+ }
+
+ public GoobiException(int pCode, String pMessage, Throwable pLinkedException) {
+ super(pCode, pMessage, pLinkedException);
+ }
+
+ public static String getMessage (int code) {
+ errorList = new ArrayList<String>();
+ errorList.add(-1, "Methode nicht gefunden");
+ errorList.add(0, "Erfolgreich");
+ errorList.add(1, "Interner Fehler");
+ errorList.add(2, "Zugriff verweigert");
+ errorList.add(3, "Abgebrochen");
+ errorList.add(4, "Nicht implementiert");
+ errorList.add(5, "Parameter ungültig");
+ errorList.add(6, "Parameter erfolgreich");
+ errorList.add(7, "Schreibzugriff fehlgeschlagen(zB Festplatte voll)");
+ errorList.add(254, "Sonstiger Fehler");
+ //ab 1000 - Module
+ errorList.add(1000, "Nicht initialisiert");
+ errorList.add(1001, "Bereits initialisiert");
+ errorList.add(1003, "Nur eine Modulinstanz möglich(Singleton)");
+ errorList.add(1002, "Redirekt");
+ errorList.add(1004, "Ungültige Session");
+ errorList.add(1005, "Der Module unterstützt diese API Version nicht");
+ //ab 1100 Information
+ errorList.add(1100, "Prozess existiert nicht");
+ //ab 1200 Message
+ errorList.add(1200, "Empfänger unbekannt");
+ //ab 1300 File
+ errorList.add(1300, "Ressource existiert nicht");
+ errorList.add(1301, "Ressource existiert bereit");
+ errorList.add(1400, "Prozess exisitert nicht");
+ errorList.add(1401, "Prozessverzeichniss konnte nicht angelegt werden");
+ errorList.add(1500, "Schlüssel existiert nicht");
+ errorList.add(1501, "Wert kann nicht geschrieben werden(Schreibschutz)");
+ errorList.add(1502, "Wert kann nicht geschrieben werden(Typfehler)");
+
+ return errorList.get(code);
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/exception/GoobiMessageException.java'
--- src/de/unigoettingen/goobi/module/api/exception/GoobiMessageException.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/exception/GoobiMessageException.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.exception;
+
+public class GoobiMessageException extends GoobiException {
+ private static final long serialVersionUID = 328999667361972953L;
+
+ public GoobiMessageException(int pCode, String pMessage) {
+ super(pCode, pMessage);
+ }
+
+ public GoobiMessageException(int pCode, String pMessage, Throwable pLinkedException) {
+ super(pCode, pMessage, pLinkedException);
+ }
+}
=== added file 'src/de/unigoettingen/goobi/module/api/exception/GoobiModuleException.java'
--- src/de/unigoettingen/goobi/module/api/exception/GoobiModuleException.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/exception/GoobiModuleException.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,36 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.exception;
+
+public class GoobiModuleException extends GoobiException {
+ private static final long serialVersionUID = 2942926015863031597L;
+
+ public GoobiModuleException(int pCode, String pMessage) {
+ super(pCode, pMessage);
+ }
+
+ public GoobiModuleException(int pCode, String pMessage, Throwable pLinkedException) {
+ super(pCode, pMessage, pLinkedException);
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/exception/GoobiProcessException.java'
--- src/de/unigoettingen/goobi/module/api/exception/GoobiProcessException.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/exception/GoobiProcessException.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,37 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.exception;
+
+public class GoobiProcessException extends GoobiException {
+
+ private static final long serialVersionUID = -6257800735140709560L;
+
+ public GoobiProcessException(int pCode, String pMessage) {
+ super(pCode, pMessage);
+ }
+
+ public GoobiProcessException(int pCode, String pMessage, Throwable pLinkedException) {
+ super(pCode, pMessage, pLinkedException);
+ }
+
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/information'
=== added file 'src/de/unigoettingen/goobi/module/api/information/InformationClient.java'
--- src/de/unigoettingen/goobi/module/api/information/InformationClient.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/information/InformationClient.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,45 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.information;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Vector;
+
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiModuleException;
+
+public class InformationClient {
+ public static String getAPIVersion (String url) throws XmlRpcException, GoobiModuleException, MalformedURLException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(url));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ return (String) client.execute("Information.getAPIVersion", new Vector());
+
+ }
+}
=== added file 'src/de/unigoettingen/goobi/module/api/information/InformationImpl.java'
--- src/de/unigoettingen/goobi/module/api/information/InformationImpl.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/information/InformationImpl.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,31 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.information;
+
+public class InformationImpl implements InformationInterface {
+
+ public String getAPIVersion () {
+ return "1.01";
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/information/InformationInterface.java'
--- src/de/unigoettingen/goobi/module/api/information/InformationInterface.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/information/InformationInterface.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,32 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.information;
+
+public interface InformationInterface {
+ /**
+ * liefert die Version der API Muss auf beiden Seiten implementiert werden.
+ *
+ * @return API Version
+ */
+ public String getAPIVersion ();
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/message'
=== added file 'src/de/unigoettingen/goobi/module/api/message/Message.java'
--- src/de/unigoettingen/goobi/module/api/message/Message.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/Message.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,99 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.message;
+
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiMessageException;
+
+/**
+ * Diese Struktur wird benutzt um die Nachrichten auszutauschen. Man kann
+ * entweder Nachrichten an Workflowkern schicken (Trigger), oder die
+ * Fehlermeldungen ueberbringen.
+ *
+ * Als Inhalt kann man entweder Struktur MessageBody oder String inhalt
+ * benutzen.
+ *
+ */
+public class Message extends HashMap<String, Object> {
+
+ private static final long serialVersionUID = 4052290910967535633L;
+
+ public String to;
+ public String from;
+ public MessageBody body;
+ public String inhalt;
+
+ /**
+ * Constructor fuer Message. Ihnalt ist String.
+ *
+ * @param to
+ * @param from
+ * @param inhalt
+ */
+ public Message(String to, String from, String inhalt) {
+ this.to = to;
+ this.from = from;
+ this.inhalt = inhalt;
+
+ this.put("to", this.to);
+ this.put("from", this.from);
+ this.put("inhalt", this.inhalt);
+ }
+
+ /**
+ * Constructor fuer Message. Inhalt ist MessageBody.
+ *
+ * @param to
+ * @param from
+ * @param body
+ */
+ public Message(String to, String from, MessageBody body) {
+ this.to = to;
+ this.from = from;
+ this.body = body;
+
+ this.put("to", this.to);
+ this.put("from", this.from);
+ this.put("body", this.body);
+
+ }
+
+ /*
+ public Message(Map<String, Object> m) {
+ super(m);
+ }
+ */
+
+ public Message(HashMap hm) throws GoobiMessageException {
+ this.from = (String) hm.get("from");
+ this.to = (String) hm.get("to");
+
+ if (hm.containsKey("inhalt")) {
+ this.inhalt = (String) hm.get("inhalt");
+ } else {
+ this.body = new MessageBody((HashMap) hm.get("body"));
+ }
+
+ }
+}
=== added file 'src/de/unigoettingen/goobi/module/api/message/MessageBody.java'
--- src/de/unigoettingen/goobi/module/api/message/MessageBody.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/MessageBody.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,72 @@
+/*
+ * 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
+ */
+
+/**
+ *
+ */
+package de.unigoettingen.goobi.module.api.message;
+
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiMessageException;
+import de.unigoettingen.goobi.module.api.types.GoobiError;
+
+public class MessageBody extends HashMap<String, Object> {
+
+ final int logLevelDebug = 0;
+ final int logLevelInfo = 1;
+ final int logLevelWarn = 2;
+ final int logLevelError = 3;
+
+ public final static String trigger = "trigger";
+ public final static String log = "log";
+
+ private static final long serialVersionUID = -5250660110945575858L;
+ public String type; // "trigger" oder "log"
+ public int number; // Wenn trigger - sessionId, wenn log - LogLevel
+ public GoobiError error; // Wenn log..
+
+ public MessageBody(String type, int number, GoobiError error) {
+ this.type = type;
+ this.number = number;
+ this.error = error;
+
+ this.put("type", this.type);
+ this.put("number", this.number);
+ this.put("error", this.error);
+ }
+
+ //public MessageBody(Map<String, Object> m) {
+ // super(m);
+ //}
+
+ public MessageBody(HashMap hm) throws GoobiMessageException {
+
+ if ((hm.containsKey("type")) && (hm.containsKey("error")) && (hm.containsKey("number"))) {
+ this.type = (String) hm.get("type");
+ this.error = new GoobiError((HashMap) hm.get("error"));
+ this.number = (Integer) hm.get("number");
+ } else {
+ throw new GoobiMessageException(1502, "Wert kann nicht" + " als MessageBody geschrieben werden (Typfehler)");
+ }
+ }
+}
\ No newline at end of file
=== added file 'src/de/unigoettingen/goobi/module/api/message/MessageClient.java'
--- src/de/unigoettingen/goobi/module/api/message/MessageClient.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/MessageClient.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,67 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.message;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+public class MessageClient {
+ private static final Logger myLogger = Logger.getLogger(MessageClient.class);
+
+ public static void put (String goobiUrl, String sessionId, Message message) throws MalformedURLException, XmlRpcException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(goobiUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("Module send message an Goobi:" + message);
+
+ Vector v = new Vector();
+ v.add(sessionId);
+ v.add(message);
+ String returnString = (String) client.execute("Message.put", v);
+ myLogger.debug(returnString);
+ v.clear();
+ }
+
+ public static void put (String goobiUrl, String sessionId, MessageBody message) throws MalformedURLException, XmlRpcException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(goobiUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ Vector v = new Vector();
+ v.add(sessionId);
+ v.add(message);
+ String returnString = (String) client.execute("Message.put", v);
+ myLogger.debug(returnString);
+ v.clear();
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/message/MessageContainer.java'
--- src/de/unigoettingen/goobi/module/api/message/MessageContainer.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/MessageContainer.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,72 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.message;
+
+import java.util.ArrayList;
+
+/**
+ * Dieser Class beinhaltet einen statischen MessageContainer für Goobi.
+ *
+ * @author Igor Toker
+ *
+ */
+public class MessageContainer {
+
+ /**
+ * Der Container
+ */
+ static ArrayList<Message> messageList = new ArrayList<Message>();
+
+ /**
+ * Fügt eine Message an.
+ *
+ * @param message
+ * @return boolean.
+ */
+ public static boolean push (Message message) {
+ return messageList.add(message);
+
+ }
+
+ /**
+ * Holt die Letzte Message aus dem Container und löscht die.
+ *
+ * @return Message
+ */
+ public static Message pop () {
+ Message message = null;
+ message = messageList.get(messageList.size() - 1);
+ messageList.remove(messageList.size() - 1);
+ return message;
+ }
+
+ /**
+ * Gibt die grösse des Containers zurück
+ *
+ * @return int
+ */
+ static public int size () {
+ return messageList.size();
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/message/MessageImpl.java'
--- src/de/unigoettingen/goobi/module/api/message/MessageImpl.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/MessageImpl.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.message;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.exception.GoobiMessageException;
+
+/**
+ * Nur die Modules schicken Messages an Goobi
+ */
+public class MessageImpl implements MessageInterface {
+ private static final Logger myLogger = Logger.getLogger(MessageImpl.class);
+
+ //in Theorie kann unser Module damit die Messages abholen. Darf er das ?
+ public String get (String Session) throws GoobiMessageException, GoobiException {
+ throw new GoobiException(4, "Nicht implementiert");
+ }
+
+ /**
+ * Diese Methode wird von Goobi benutzt. Damit empfaengt Goobi die Messages.
+ */
+ public String put (String Session, HashMap msg_map) throws GoobiMessageException {
+ Message message = new Message(msg_map);
+ //TODO: Was machen wir mit Message weiter ?
+ myLogger.debug("put(String, HashMap) - Goobi Got Message!:" + msg_map);
+ //if (!(message.inhalt.equals(null))) System.out.println(message.inhalt);
+ MessageContainer.push(message);
+
+ return "";
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/message/MessageInterface.java'
--- src/de/unigoettingen/goobi/module/api/message/MessageInterface.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/message/MessageInterface.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,51 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.message;
+
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.exception.GoobiMessageException;
+
+public interface MessageInterface {
+
+ /**
+ * Mit dieser Methode können wir die Nachrichten überbringen.
+ *
+ * @param Session
+ * @param message
+ * @return ""
+ * @throws de.unigoettingen.goobi.module.api.exception.GoobiMessageException
+ * @throws GoobiMessageException
+ */
+ public String put (String Session, HashMap message) throws de.unigoettingen.goobi.module.api.exception.GoobiMessageException, GoobiMessageException;
+
+ /**
+ * Mit dieser Methode können Module Nachrichten vom Workflowkern abrufen. *
+ * Rückgabe: Message
+ *
+ * @throws GoobiMessageException
+ * @throws GoobiException
+ */
+ public String get (String Session) throws GoobiMessageException, GoobiException;
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/module'
=== added file 'src/de/unigoettingen/goobi/module/api/module/ModuleClient.java'
--- src/de/unigoettingen/goobi/module/api/module/ModuleClient.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module/ModuleClient.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,149 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+
+import de.unigoettingen.goobi.module.api.engine.goobi.Engine;
+import de.unigoettingen.goobi.module.api.exception.GoobiException;
+import de.unigoettingen.goobi.module.api.exception.GoobiModuleException;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleParameter;
+import de.unigoettingen.goobi.module.api.util.UniqueID;
+
+public class ModuleClient {
+ private static final Logger myLogger = Logger.getLogger(ModuleClient.class);
+
+ public String longsessionID;
+ public String status = "not active";
+ private URL url;
+
+ public ModuleClient(URL url) {
+ this.url = url;
+ }
+
+ /**
+ * Open the long session..
+ *
+ * @throws XmlRpcException
+ */
+ public void initialize () throws XmlRpcException, GoobiModuleException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(url);
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("initialize() - URL:" + url);
+ longsessionID = UniqueID.generate();
+ Vector v = new Vector();
+ v.add(longsessionID);
+ longsessionID = (String) client.execute("Module.initialize", v);
+ myLogger.debug("initialize() - InitializeID:" + longsessionID);
+ v.clear();
+ status = "active";
+ }
+
+ /**
+ * Open the short session Man muss auch sessionId für später merken !
+ *
+ * @param modParam
+ * - GoobiModuleParameter
+ * @throws XmlRpcException
+ * , GoobiException
+ * @throws XmlRpcException
+ * @throws GoobiModuleException
+ */
+ public String start (GoobiModuleParameter modParam) throws XmlRpcException, GoobiException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(url);
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+
+ myLogger.debug("start(GoobiModuleParameter) - start");
+ Engine.sessions.add(modParam.sessionId);
+ Vector v = new Vector();
+ v.add(modParam);
+ return (String) client.execute("Module.start", v);
+ //v.clear();
+ }
+
+ /**
+ * Beendet die "short Session"
+ *
+ * @param modParam
+ * GoobiModuleParameter
+ * @throws XmlRpcException
+ * , GoobiModuleException
+ */
+ public void stop (GoobiModuleParameter modParam) throws XmlRpcException, GoobiModuleException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(url);
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+ Engine.sessions.remove(modParam.sessionId);
+ myLogger.debug("stop(GoobiModuleParameter) - stop");
+ Vector v = new Vector();
+ v.add(modParam);
+ client.execute("Module.stop", v);
+ v.clear();
+
+ }
+
+ public void shutdown () throws XmlRpcException, GoobiModuleException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(url);
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+ myLogger.debug("shutdown() - down");
+ Vector v = new Vector();
+ v.add(longsessionID);
+ status = "not active";
+ client.execute("Module.shutdown", v);
+ v.clear();
+
+ }
+
+ public HashMap getInfo () throws XmlRpcException {
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(url);
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+ return (HashMap) client.execute("Module.getInfo", new Vector());
+
+ }
+
+ public String getStatus () {
+ return status;
+ }
+
+ public void setStatus (String status) {
+ this.status = status;
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/module/ModuleImpl.java'
--- src/de/unigoettingen/goobi/module/api/module/ModuleImpl.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module/ModuleImpl.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,99 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+
+import de.unigoettingen.goobi.module.api.engine.modules.Engine;
+import de.unigoettingen.goobi.module.api.exception.GoobiModuleException;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleInformation;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleParameter;
+
+public class ModuleImpl implements ModuleInterface {
+ private static final Logger myLogger = Logger.getLogger(ModuleImpl.class);
+ public GoobiModuleInformation modInfo = null;
+
+ /**
+ * Gibt Infos ueber ein Modul zurueck. Name, InterneId, Version, Type,
+ * APIVersion. Type : 0 - Interaktive Module 1 - Batchmodule
+ *
+ * @return Fehler
+ * @throws GoobiModuleException
+ */
+ public HashMap getInfo () throws GoobiModuleException {
+ if (modInfo == null) {
+ throw new GoobiModuleException(1, "Interner Fehler");
+ }
+ return modInfo;
+ }
+
+ public String initialize (String input_secret) {
+ //muss im Engine definiert sein !
+ return null;
+ }
+
+ public String shutdown (String geheimnis) {
+ //muss im Engine implementiert werden!
+ return null;
+ }
+
+ /**
+ * Meldet die Session an.
+ */
+ public String start (HashMap m) {
+ GoobiModuleParameter mp = new GoobiModuleParameter(m);
+ if (Engine.longsessionID.equals(mp.longsessionId)) {
+ Engine.sessions.add(mp.sessionId);
+ myLogger.debug("start(HashMap) - Session opened:" + mp.sessionId);
+ }
+ return "";
+
+ }
+
+ public String status (GoobiModuleParameter mp) throws GoobiModuleException {
+ throw new GoobiModuleException(4, "Nicht implementiert");
+ }
+
+ /**
+ * Die Session wird abgemeldet und damit abgeschlossen.
+ *
+ * @throws GoobiModuleException
+ */
+ public String stop (HashMap m) throws GoobiModuleException {
+ GoobiModuleParameter mp = new GoobiModuleParameter(m);
+ if (Engine.longsessionID.equals(mp.longsessionId)) {
+ if (Engine.sessions.contains(mp.sessionId)) {
+ Engine.sessions.remove(mp.sessionId);
+ myLogger.debug("stop(HashMap) - Session closed:" + mp.sessionId);
+ } else {
+ myLogger.debug("stop(HashMap) - There is no Session " + mp.sessionId);
+ throw new GoobiModuleException(1004, "Invalid Session");
+ }
+ }
+ return "";
+
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/module/ModuleInterface.java'
--- src/de/unigoettingen/goobi/module/api/module/ModuleInterface.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module/ModuleInterface.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,89 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module;
+
+import java.util.HashMap;
+
+import de.unigoettingen.goobi.module.api.exception.GoobiModuleException;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleParameter;
+
+public interface ModuleInterface {
+
+ /**
+ * Diese Methode wird als erste aufgerufen, als antwort auf POST/GET
+ *
+ * @return Fehler
+ */
+ public String initialize (String geheimnis);
+
+ /**
+ * Diese Methode beendet den Module komplett
+ *
+ * @return Fehler
+ */
+ public String shutdown (String geheimnis);
+
+ /**
+ * Gibt Infos über ein Modul zurück. Name, InterneId, Version, Type,
+ * APIVersion. Type : 0 - Interaktive Module 1 - Batchmodule
+ *
+ * @return Fehler
+ * @throws de.unigoettingen.goobi.module.api.exception.GoobiModuleException
+ * @throws GoobiModuleException
+ */
+ public HashMap getInfo () throws de.unigoettingen.goobi.module.api.exception.GoobiModuleException, GoobiModuleException;
+
+ /**
+ * Diese Methode gibt den Status des Modules zurück. Das muss noch auch
+ * weiter bearbeitet werden. Was genau geben wir zurück ?
+ *
+ * @throws GoobiModuleException
+ */
+ public String status (GoobiModuleParameter mp) throws GoobiModuleException;
+
+ /**
+ * Damit wird der Module gestartet. Obligatorische Methode. Damit Module
+ * weisst, dass ab jetzt ist die Kontrolle ihm überlassen.
+ *
+ * @param processID
+ * @param SessionId
+ * @param language
+ * - sprache des Modules, wenn nicht relevant - null.
+ * @param comments
+ * - sonstige Commentar und Befehle
+ * @return Fehlernummer
+ */
+ public String start (HashMap m);
+
+ /**
+ * Damit wird der Module gestoppt. //TODO Module.stop() frage Notbremse ?
+ * Abbruch des Vorgangs ?
+ *
+ * @param processID
+ * @param sessionId
+ * @return
+ * @throws GoobiModuleException
+ */
+ public String stop (HashMap m) throws GoobiModuleException;
+
+}
=== added directory 'src/de/unigoettingen/goobi/module/api/module_manager'
=== added file 'src/de/unigoettingen/goobi/module/api/module_manager/DefaultGoobiEngine.java'
--- src/de/unigoettingen/goobi/module/api/module_manager/DefaultGoobiEngine.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module_manager/DefaultGoobiEngine.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,29 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module_manager;
+
+import de.unigoettingen.goobi.module.api.engine.goobi.Engine;
+
+public class DefaultGoobiEngine extends Engine {
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/module_manager/GoobiModuleManager.java'
--- src/de/unigoettingen/goobi/module/api/module_manager/GoobiModuleManager.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module_manager/GoobiModuleManager.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,161 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module_manager;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+import de.unigoettingen.goobi.module.api.dataprovider.process.ProcessImpl;
+import de.unigoettingen.goobi.module.api.dataprovider.process.data.DataImpl;
+import de.unigoettingen.goobi.module.api.engine.goobi.GoobiServer;
+import de.unigoettingen.goobi.module.api.module.ModuleClient;
+
+/**
+ * Diesen ModuleManager benutzt Goobi um Modules zu verwalten! Dieser Class ist
+ * eine Liste von Modulen, die von Goobi ausgefüllt wird. In dieser Liste
+ * befinden sich alle, von Goobi benutzte Module.
+ *
+ */
+public class GoobiModuleManager extends ArrayList<ModuleDesc> {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7586698657377170571L;
+ private static final Logger myLogger = Logger.getLogger(GoobiModuleManager.class);
+
+ public GoobiModuleManager(int port, ProcessImpl pi, DataImpl di) {
+ super();
+ GoobiServer.start(pi, port, di);
+ }
+
+ /**
+ * Damit startet man auch den WebServer von Goobi..
+ *
+ * @param port
+ */
+ public GoobiModuleManager(int port) {
+ super();
+
+ //Klassen die von XML-RPC Server von Goobi mitbenutzt werden.
+ ProcessImpl processimpl = new ProcessImpl();
+ DataImpl dataImpl = new DataImpl();
+
+ GoobiServer.start(processimpl, port, dataImpl);
+
+ }
+
+ public void shutdown () {
+ GoobiServer.stop();
+ }
+
+ @Override
+ public boolean add (ModuleDesc md) {
+ try {
+ ModuleClient module = new ModuleClient(new URL(md.getUrl()));
+ md.setModuleClient(module);
+ } catch (MalformedURLException e) {
+ // TODO Fehlerbearbeitung!!!
+ myLogger.error("add(ModuleDesc) - Ungültige URL von dem Module " + md.getName(), e);
+ return false;
+ }
+
+ return super.add(md);
+ }
+
+ @Override
+ public void add (int index, ModuleDesc md) {
+ try {
+ ModuleClient module = new ModuleClient(new URL(md.getUrl()));
+ md.setModuleClient(module);
+ } catch (MalformedURLException e) {
+ // TODO Fehlerbearbeitung!!!
+ myLogger.error("add(int, ModuleDesc) - Ungültige URL von dem Module " + md.getName(), e);
+ }
+
+ super.add(index, md);
+ }
+
+ @Override
+ public boolean addAll (Collection<? extends ModuleDesc> c) {
+ for (ModuleDesc desc : c) {
+ try {
+ ModuleClient module = new ModuleClient(new URL(desc.getUrl()));
+ desc.setModuleClient(module);
+ } catch (MalformedURLException e) {
+ // TODO Fehlerbearbeitung!!!
+ myLogger.error("add(Collection) - Ungültige URL von dem Module " + desc.getName(), e);
+ return false;
+ }
+
+ }
+ return super.addAll(c);
+ }
+
+ @Override
+ public boolean addAll (int index, Collection<? extends ModuleDesc> c) {
+ for (ModuleDesc desc : c) {
+ try {
+ ModuleClient module = new ModuleClient(new URL(desc.getUrl()));
+ desc.setModuleClient(module);
+ } catch (MalformedURLException e) {
+ // TODO Fehlerbearbeitung!!!
+ myLogger.error("add(int, Collection) - Ungültige URL von dem Module " + desc.getName(), e);
+ return false;
+ }
+ }
+ return super.addAll(index, c);
+ }
+
+ public boolean remove (ModuleDesc md) {
+ if (md.getModuleClient().status.equals("not active")) {
+ return super.remove(md);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public ModuleDesc remove (int index) {
+ if (this.get(index).getModuleClient().status.equals("not active")) {
+ return super.remove(index);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean removeAll (Collection<?> c) {
+ for (Object desc : c) {
+ ModuleDesc d = (ModuleDesc) desc;
+ if (!(d.getModuleClient().status.equals("not active"))) {
+ return false;
+ }
+ }
+ return super.removeAll(c);
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/module_manager/ModuleDesc.java'
--- src/de/unigoettingen/goobi/module/api/module_manager/ModuleDesc.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/module_manager/ModuleDesc.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,85 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.module_manager;
+
+import java.util.ArrayList;
+
+import de.unigoettingen.goobi.module.api.module.ModuleClient;
+import de.unigoettingen.goobi.module.api.types.GoobiModuleParameter;
+
+public class ModuleDesc {
+ private String name = null;
+ private String url = null;
+ private ModuleClient moduleClient = null;
+ private String comments = null;
+ private ArrayList<GoobiModuleParameter> gmps = new ArrayList<GoobiModuleParameter>();
+
+ public ModuleDesc(String name, String url, ModuleClient moduleClient, String comments) {
+ super();
+ this.name = name;
+ this.url = url;
+ this.moduleClient = moduleClient;
+ this.comments = comments;
+ }
+
+ public String getComments () {
+ return comments;
+ }
+
+ public void setComments (String comments) {
+ this.comments = comments;
+ }
+
+ public ArrayList<GoobiModuleParameter> getGmps () {
+ return gmps;
+ }
+
+ public void setGmps (ArrayList<GoobiModuleParameter> gmps) {
+ this.gmps = gmps;
+ }
+
+ public ModuleClient getModuleClient () {
+ return moduleClient;
+ }
+
+ public void setModuleClient (ModuleClient moduleClient) {
+ this.moduleClient = moduleClient;
+ }
+
+ public String getName () {
+ return name;
+ }
+
+ public void setName (String name) {
+ this.name = name;
+ }
+
+ public String getUrl () {
+ return url;
+ }
+
+ public void setUrl (String url) {
+ this.url = url;
+ }
+
+}
\ No newline at end of file
=== added directory 'src/de/unigoettingen/goobi/module/api/types'
=== added file 'src/de/unigoettingen/goobi/module/api/types/GoobiError.java'
--- src/de/unigoettingen/goobi/module/api/types/GoobiError.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/types/GoobiError.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,47 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.types;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class GoobiError extends HashMap<String, Object> {
+
+ private static final long serialVersionUID = 5079025457251570832L;
+ public int faultCode;
+ public String faultString;
+
+ public GoobiError(int faultCode, String faultString) {
+ this.faultCode = faultCode;
+ this.faultString = faultString;
+
+ this.put("faultCode", faultCode);
+ this.put("faultString", faultString);
+ }
+
+ public GoobiError(Map<String, Object> m) {
+ this.faultCode = (Integer) m.get("faultCode");
+ this.faultString = (String) m.get("faultString");
+ }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/types/GoobiModuleInformation.java'
--- src/de/unigoettingen/goobi/module/api/types/GoobiModuleInformation.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/types/GoobiModuleInformation.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,80 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.types;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class GoobiModuleInformation extends HashMap {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1952070010075587795L;
+ /* TODO: Ggf. Namen gross schreiben */
+ public String ModuleName;
+ public String ID;
+ public String Version;
+ public int Type;
+ public int ApiVersion;
+
+ /*
+ * Dieser Konstruktor ist fuer den XML-RPC Empfaenger
+ */
+ public GoobiModuleInformation(Map<String, Object> m) {
+ super(m);
+ //this.putAll(m);
+ }
+
+ /**
+ * @param ModuleName
+ * @param ID
+ * @param Version
+ * @param Type
+ * : 0 kein Interface, 1 mit Interface
+ * @param ApiVersion
+ */
+ public GoobiModuleInformation(String ModuleName, String ID, String Version, int Type, int ApiVersion) {
+ this.ModuleName = ModuleName;
+ this.ID = ID;
+ this.Version = Version;
+ this.Type = Type;
+ this.ApiVersion = ApiVersion;
+
+ this.put("ModuleName", ModuleName);
+ this.put("ID", ID);
+ this.put("Version", Version);
+ this.put("Type", Type);
+ this.put("ApiVersion", ApiVersion);
+ }
+
+ // @Override
+ // public void putAll(Map<? extends String, ? extends Object> t) {
+ // this.ModuleName = (String) t.get("ModuleName");
+ // this.ID = (String) t.get("ID");
+ // this.Version = (String) t.get("Version");
+ // this.Type = (Integer) t.get("Type");
+ // this.ApiVersion = (Integer) t.get("ApiVersion");
+ // }
+
+}
=== added file 'src/de/unigoettingen/goobi/module/api/types/GoobiModuleParameter.java'
--- src/de/unigoettingen/goobi/module/api/types/GoobiModuleParameter.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/types/GoobiModuleParameter.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,117 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.types;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * In dieser Struktur werden die Parameter für den Module gespeichert. Die
+ * Struktur besteht aus : - processId - sessionId (String, MD5Hash des
+ * Geheimnisses) - parameter (name,value)
+ */
+public class GoobiModuleParameter extends HashMap<String, Object> {
+
+ private static final long serialVersionUID = -1094606526828530574L;
+
+ public String processId = null;
+ public String sessionId = null;
+ public String longsessionId = null;
+
+ public GoobiModuleParameter(Map<String, Object> m) {
+ super(m);
+ }
+
+ public GoobiModuleParameter(HashMap<String, Object> hm) {
+ this.putAll(hm);
+ this.processId = (String) hm.get("processID");
+ //hm.remove("processId");
+ this.sessionId = (String) hm.get("sessionID");
+ //hm.remove("sessionID");
+ this.longsessionId = (String) hm.get("longsessionID");
+ //hm.remove("longsessionId");
+ //der Rest sind parameter
+ //this.putAll(hm);
+ }
+
+ /**
+ *
+ * @param processID
+ * Aktuelles Goobi-Process
+ * @param sessionID
+ * Aktuelles "short-session" Id
+ * @param longsessionID
+ * Aktuelles "long-session" Id
+ * @param parameters
+ * Parameter..
+ */
+ public GoobiModuleParameter(String processID, String sessionID, String longsessionID, Map<String, Object> parameters) {
+ gmp_start(processID, sessionID, longsessionID, parameters);
+ }
+
+ public GoobiModuleParameter(String processID, String sessionID, String longsessionID) {
+ gmp_start(processID, sessionID, longsessionID, null);
+ }
+
+ private void gmp_start (String processID, String sessionID, String longsessionID, Map<String, Object> parameters) {
+ this.processId = processID;
+ this.sessionId = sessionID;
+ this.longsessionId = longsessionID;
+
+ this.put("processID", this.processId);
+ this.put("sessionID", this.sessionId);
+ this.put("longsessionID", this.longsessionId);
+
+ //this.parameters.putAll(parameters);
+ if (!(parameters == null)) {
+ this.putAll(parameters);
+ }
+ }
+
+ public String getProcessId () {
+ return processId;
+ }
+
+ public void setProcessId (String processId) {
+ this.processId = processId;
+ }
+
+ public String getSessionId () {
+ return sessionId;
+ }
+
+ public void setSessionId (String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getLongsessionId () {
+ return longsessionId;
+ }
+
+ public void setLongsessionId (String longsessionId) {
+ this.longsessionId = longsessionId;
+ }
+
+ //noch ein konstruktor schreiben
+
+}
\ No newline at end of file
=== added file 'src/de/unigoettingen/goobi/module/api/types/GoobiProcessProperty.java'
--- src/de/unigoettingen/goobi/module/api/types/GoobiProcessProperty.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/types/GoobiProcessProperty.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,67 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.types;
+
+import java.util.HashMap;
+
+/**
+ * Diese Struktur repräsentiert definierbare Prozesseigenschaft Es hat 3
+ * Felder: Name der Eigenschaft, eindeutige ID, Value.
+ */
+public class GoobiProcessProperty extends HashMap<String, Object> {
+ private static final long serialVersionUID = 4580240032287567595L;
+ private String name = null;
+ private String id = null;
+ private String value = null;
+
+ public GoobiProcessProperty(String name, String id, String value) {
+ super();
+ this.name = name;
+ this.id = id;
+ this.value = value;
+
+ this.put("name", name);
+ this.put("id", id);
+ this.put("value", value);
+ }
+
+ public GoobiProcessProperty(HashMap hm) {
+ super(hm);
+ this.name = (String) hm.get("name");
+ this.id = (String) hm.get("id");
+ this.value = (String) hm.get("value");
+ }
+
+ public String getName () {
+ return name;
+ }
+
+ public String getId () {
+ return id;
+ }
+
+ public String getValue () {
+ return value;
+ }
+
+}
\ No newline at end of file
=== added directory 'src/de/unigoettingen/goobi/module/api/util'
=== added file 'src/de/unigoettingen/goobi/module/api/util/UniqueID.java'
--- src/de/unigoettingen/goobi/module/api/util/UniqueID.java 1970-01-01 00:00:00 +0000
+++ src/de/unigoettingen/goobi/module/api/util/UniqueID.java 2012-05-04 10:08:33 +0000
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+package de.unigoettingen.goobi.module.api.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Random;
+
+public class UniqueID {
+ private static Random rand = new Random(System.currentTimeMillis());
+
+ public static String generate () {
+ return generate(Long.toString(rand.nextLong()));
+ }
+
+ public static String generate (String seed) {
+ seed = Long.toString(rand.nextLong()) + seed;
+ MessageDigest md = null;
+ try {
+ md = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ md.update(seed.getBytes());
+ return md.digest().toString();
+ }
+
+ public static String generate_session () {
+ String session = "0";
+ for (int i = 0; i < 10; i++) {
+ int a = rand.nextInt(10);
+ session += String.valueOf(a);
+ }
+ return session;
+ }
+}