Commit [r143] Maximize Restore History

Kleine Modifikationen wegen neue Linux Rechner

karaca 2014-07-29

changed /cluster/trunk/dependency-reduced-pom.xml
changed /cluster/trunk/src/main/resources/log4j.xml
changed /cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/EpicurImporter.java
changed /cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/EpicurImporter2.java
changed /cluster/trunk/pom.xml
copied /cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/SynchronizeTest.java -> /cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/Synchronizer.java
/cluster/trunk/dependency-reduced-pom.xml Diff Switch to side-by-side view
Loading...
/cluster/trunk/src/main/resources/log4j.xml Diff Switch to side-by-side view
Loading...
/cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/EpicurImporter.java Diff Switch to side-by-side view
Loading...
/cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/EpicurImporter2.java Diff Switch to side-by-side view
Loading...
/cluster/trunk/pom.xml Diff Switch to side-by-side view
Loading...
/cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/SynchronizeTest.java to /cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/Synchronizer.java
--- a/cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/SynchronizeTest.java
+++ b/cluster/trunk/src/main/java/org/persid/id/dataimport/dnb/Synchronizer.java
@@ -1,7 +1,7 @@
 /* *********************************************************************
  * Class EpicurImporter
  * 
- * Copyright (c) 2013, German National Library/Deutsche Nationalbibliothek
+ * Copyright (c) 2013-2014, German National Library/Deutsche Nationalbibliothek
  * Adickesallee 1, D-60322 Frankfurt am Main, Federal Republic of Germany 
  *
  * This program is free software.
@@ -34,15 +34,14 @@
  * Copies the contents of the productive Sybase Database to PersID cluster.
  * 
  */
-public class SynchronizeTest {
-	private static final Log LOGGER = LogFactory.getLog(SynchronizeTest.class);
+public class Synchronizer {
+	private static final Log LOGGER = LogFactory.getLog(Synchronizer.class);
 	private static final int  ONE_HOUR = 60 * 60 * 1000; //one hour in milliseconds
     private static final long ONE_DAY  = 24 * ONE_HOUR;    //one day in milliseconds/** 4 times 365 + 1 x 29. February */
     /** One month in miliseconds (30 days) */
     public  static final long ONE_MONTH = 30 * ONE_DAY;
     /** 4 times 365 + 1 x 29. February */
 	public  static final long FOUR_YEARS = 1461 * ONE_DAY;
-    private static final boolean PRODUCTION = true;
     private static final boolean FULLUPDATE = true;
 	static String target = "Unknown Database";
 	
@@ -56,20 +55,24 @@
         String url  = "";
         String user = "";
         String password = "";
+        String clusterUri = "";
+        boolean production = false;
         
-        if(args != null && args.length == 3) {
+        if(args != null && args.length == 5) {
             url = args[0];
             user = args[1];
             password = args[2];
+            clusterUri = args[3];
+            if (args[4].equalsIgnoreCase("p")) production = true;         
         } else {
-            System.err.println("usage: main() <url> <user> <password>");
+            System.err.println("usage: main() <database URI> <user name> <password> <Cluster URI> <t|a|p>");
             System.exit(1);
         }
         
 		Date started = new Date();
 		Connection conn = null;
 		try {
-		    if (PRODUCTION) {
+		    if (production) {
 		        LOGGER.info("Loading JTDS Driver for SYBASE");
 	            Class.forName("net.sourceforge.jtds.jdbc.Driver");
 		    } else {
@@ -82,18 +85,18 @@
 
 			target = conn.getMetaData().getDatabaseProductName();
 			
-			EpicurImporter2 importer = new EpicurImporter2();
+			EpicurImporter importer = new EpicurImporter();
 			if (!FULLUPDATE) {
 			    Date syncronizeFrom = new Date (started.getTime() - (2 * ONE_HOUR));
 //			    java.util.Calendar c = new java.util.GregorianCalendar(2004, 0, 1); //January 1st, 2004
 			    //Date syncronizeFrom = new Date(1072911600001L);
 			    
-			    importer.synchronizeData(syncronizeFrom, conn); 
+			    importer.synchronizeData(conn, clusterUri, syncronizeFrom); 
 			} else {
 			    //first copy all database
-	            importer.synchronizeData(null, conn);
+	            importer.synchronizeData(conn, clusterUri, null);
                 //then the difference since start
-                //if (PRODUCTION) importer.synchronizeData(started, conn);
+                if (production) importer.synchronizeData(conn, clusterUri, started);
 			}
 		} catch (Exception e) {
 			LOGGER.error("ERROR: ", e);