diff --git a/.gitignore b/.gitignore
index 762bac2e3..c6becfe8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ dbptk-report-*
dbptk-app.log
dbptk-app.log.txt
exported-dbs/
+dbptk-model/src/main/resources/dbptk-version.json
**/pom.xml.versionsBackup
diff --git a/dbptk-bindings/pom.xml b/dbptk-bindings/pom.xml
index 2af6f4f3e..399f1ef5b 100644
--- a/dbptk-bindings/pom.xml
+++ b/dbptk-bindings/pom.xml
@@ -9,7 +9,7 @@
com.databasepreservation
dbptk
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
pom
diff --git a/dbptk-core/pom.xml b/dbptk-core/pom.xml
index 0ffc3d441..2293f17a5 100644
--- a/dbptk-core/pom.xml
+++ b/dbptk-core/pom.xml
@@ -6,11 +6,11 @@
dbptk-core
com.databasepreservation
dbptk-core
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-core/src/main/java/com/databasepreservation/Main.java b/dbptk-core/src/main/java/com/databasepreservation/Main.java
index 7df0c5ddc..d7c0031bd 100644
--- a/dbptk-core/src/main/java/com/databasepreservation/Main.java
+++ b/dbptk-core/src/main/java/com/databasepreservation/Main.java
@@ -29,6 +29,7 @@
import com.databasepreservation.modules.siard.SIARDDKModuleFactory;
import com.databasepreservation.modules.solr.SolrModuleFactory;
import com.databasepreservation.modules.sqlServer.SQLServerJDBCModuleFactory;
+import com.databasepreservation.utils.ConfigUtils;
import com.databasepreservation.utils.MiscUtils;
/**
@@ -36,6 +37,11 @@
* @author Bruno Ferreira
*/
public class Main {
+ static {
+ // initialize logging
+ ConfigUtils.initialize();
+ }
+
public static final int EXIT_CODE_OK = 0;
public static final int EXIT_CODE_GENERIC_ERROR = 1;
public static final int EXIT_CODE_COMMAND_PARSE_ERROR = 2;
@@ -183,8 +189,9 @@ private static int run(CLI cli) {
private static void logProgramStart() {
LOGGER.debug("#########################################################");
- LOGGER.debug("# START-ID-" + execID);
- LOGGER.debug("# START v" + MiscUtils.APP_VERSION);
+ LOGGER.debug("# START-ID-{}", execID);
+ LOGGER.debug("# START v{}", MiscUtils.APP_VERSION);
+ LOGGER.debug("# version info: {}", ConfigUtils.getVersionInfo());
LOGGER.debug("#########################################################");
}
diff --git a/dbptk-core/src/main/resources/logback.xml b/dbptk-core/src/main/resources/logback_manual.xml
similarity index 97%
rename from dbptk-core/src/main/resources/logback.xml
rename to dbptk-core/src/main/resources/logback_manual.xml
index 4f140a0c3..47490f40e 100644
--- a/dbptk-core/src/main/resources/logback.xml
+++ b/dbptk-core/src/main/resources/logback_manual.xml
@@ -25,7 +25,7 @@
DEBUG
- dbptk-app.log.txt
+ ${dbptk.home}/log/dbptk-app.log.txt
true
%d [%thread] %-5level \(%logger{5}\) %msg%n%exception{full}
diff --git a/dbptk-model/pom.xml b/dbptk-model/pom.xml
index 6f20e698a..a5f973592 100644
--- a/dbptk-model/pom.xml
+++ b/dbptk-model/pom.xml
@@ -5,12 +5,12 @@
dbptk-model
com.databasepreservation
dbptk-model
- 2.0.0-beta7.2
+ 2.0.0-rc1
jar
com.databasepreservation
dbptk
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
@@ -29,6 +29,10 @@
org.apache.commons
commons-lang3
+
+ commons-io
+ commons-io
+
joda-time
joda-time
@@ -38,4 +42,12 @@
logback-classic
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+
+
+
diff --git a/dbptk-model/src/main/java/com/databasepreservation/Constants.java b/dbptk-model/src/main/java/com/databasepreservation/Constants.java
new file mode 100644
index 000000000..9bf25e988
--- /dev/null
+++ b/dbptk-model/src/main/java/com/databasepreservation/Constants.java
@@ -0,0 +1,20 @@
+package com.databasepreservation;
+
+/**
+ * @author Bruno Ferreira
+ */
+public class Constants {
+ public static final String VERSION_INFO_FILE = "dbptk-version.json";
+
+ public static final String PROPERTY_KEY_HOME = "dbptk.home";
+
+ public static final String DEFAULT_HOME_DIRECTORY = "./dbptk";
+
+ public static final String SUBDIRECTORY_LOG = "log";
+ public static final String LOGBACK_FILE_NAME = "logback_manual.xml";
+
+ public static final String SUBDIRECTORY_MODULES = "modules";
+
+ public static final String SUBDIRECTORY_REPORTS = "reports";
+
+}
diff --git a/dbptk-model/src/main/java/com/databasepreservation/common/ModuleObserver.java b/dbptk-model/src/main/java/com/databasepreservation/common/ModuleObserver.java
new file mode 100644
index 000000000..956765880
--- /dev/null
+++ b/dbptk-model/src/main/java/com/databasepreservation/common/ModuleObserver.java
@@ -0,0 +1,36 @@
+package com.databasepreservation.common;
+
+import com.databasepreservation.model.structure.DatabaseStructure;
+import com.databasepreservation.model.structure.SchemaStructure;
+import com.databasepreservation.model.structure.TableStructure;
+
+/**
+ * Receives notifications about changes in modules
+ *
+ * @author Bruno Ferreira
+ */
+public interface ModuleObserver {
+ void notifyOpenDatabase();
+
+ void notifyStructureObtained(DatabaseStructure structure);
+
+ void notifyOpenSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas,
+ long completedTablesInSchema);
+
+ void notifyOpenTable(DatabaseStructure structure, TableStructure table, long completedSchemas,
+ long completedTablesInSchema);
+
+ /**
+ * Notify about progress in converting a table. Delta between 2 reports may be
+ * more than a single row.
+ */
+ void notifyTableProgress(DatabaseStructure structure, TableStructure table, long completedRows, long totalRows);
+
+ void notifyCloseTable(DatabaseStructure structure, TableStructure table, long completedSchemas,
+ long completedTablesInSchema);
+
+ void notifyCloseSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas,
+ long completedTablesInSchema);
+
+ void notifyCloseDatabase(DatabaseStructure structure);
+}
diff --git a/dbptk-model/src/main/java/com/databasepreservation/common/ObservableModule.java b/dbptk-model/src/main/java/com/databasepreservation/common/ObservableModule.java
new file mode 100644
index 000000000..f383b5338
--- /dev/null
+++ b/dbptk-model/src/main/java/com/databasepreservation/common/ObservableModule.java
@@ -0,0 +1,91 @@
+package com.databasepreservation.common;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.databasepreservation.model.structure.DatabaseStructure;
+import com.databasepreservation.model.structure.SchemaStructure;
+import com.databasepreservation.model.structure.TableStructure;
+
+/**
+ * Updates ModuleObservers about conversion events (e.g. progress)
+ *
+ * @author Bruno Ferreira
+ */
+public abstract class ObservableModule {
+ private final List observers;
+
+ public ObservableModule() {
+ super();
+ this.observers = new ArrayList<>();
+ }
+
+ public void addModuleObserver(ModuleObserver observer) {
+ observers.add(observer);
+ }
+
+ public void removeModuleObserver(ModuleObserver observer) {
+ observers.remove(observer);
+ }
+
+ /**************************************************************************
+ * Events notification
+ */
+
+ public void notifyOpenDatabase() {
+ for (ModuleObserver observer : observers) {
+ observer.notifyOpenDatabase();
+ }
+ }
+
+ public void notifyStructureObtained(DatabaseStructure structure) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyStructureObtained(structure);
+ }
+ }
+
+ public void notifyOpenSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas,
+ long completedTablesInSchema) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyOpenSchema(structure, schema, completedSchemas, completedTablesInSchema);
+ }
+ }
+
+ public void notifyOpenTable(DatabaseStructure structure, TableStructure table, long completedSchemas,
+ long completedTablesInSchema) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyOpenTable(structure, table, completedSchemas, completedTablesInSchema);
+ }
+ }
+
+ /**
+ * Notify about progress in converting a table. Delta between 2 reports may be
+ * more than a single row.
+ */
+ public void notifyTableProgress(DatabaseStructure structure, TableStructure table, long completedRows, long totalRows) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyTableProgress(structure, table, completedRows, totalRows);
+ }
+ }
+
+ public void notifyCloseTable(DatabaseStructure structure, TableStructure table, long completedSchemas,
+ long completedTablesInSchema) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyCloseTable(structure, table, completedSchemas, completedTablesInSchema);
+ }
+ }
+
+ public void notifyCloseSchema(DatabaseStructure structure, SchemaStructure schema, long completedSchemas,
+ long completedTablesInSchema) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyCloseSchema(structure, schema, completedSchemas, completedTablesInSchema);
+ }
+ }
+
+ public void notifyCloseDatabase(DatabaseStructure structure) {
+ for (ModuleObserver observer : observers) {
+ observer.notifyCloseDatabase(structure);
+ }
+ }
+
+}
diff --git a/dbptk-model/src/main/java/com/databasepreservation/model/NoOpReporter.java b/dbptk-model/src/main/java/com/databasepreservation/model/NoOpReporter.java
index 0de70c955..8809e9377 100644
--- a/dbptk-model/src/main/java/com/databasepreservation/model/NoOpReporter.java
+++ b/dbptk-model/src/main/java/com/databasepreservation/model/NoOpReporter.java
@@ -17,11 +17,9 @@ public class NoOpReporter extends Reporter {
public NoOpReporter() {
}
- public NoOpReporter(String directory) {
- }
-
@Override
- protected void initialize(String directory) {
+ protected void init(String directory, String name) {
+ // do nothing
}
@Override
diff --git a/dbptk-model/src/main/java/com/databasepreservation/model/Reporter.java b/dbptk-model/src/main/java/com/databasepreservation/model/Reporter.java
index badcf7ca8..9f9df31c6 100644
--- a/dbptk-model/src/main/java/com/databasepreservation/model/Reporter.java
+++ b/dbptk-model/src/main/java/com/databasepreservation/model/Reporter.java
@@ -18,6 +18,7 @@
import com.databasepreservation.model.structure.ColumnStructure;
import com.databasepreservation.model.structure.TableStructure;
import com.databasepreservation.model.structure.type.Type;
+import com.databasepreservation.utils.ConfigUtils;
import com.databasepreservation.utils.MiscUtils;
/**
@@ -59,34 +60,36 @@ public class Reporter implements Closeable {
private Path outputfile;
private BufferedWriter writer;
- /**
- * Creates a new reporter using the directory specified in
- * Reporter.REPORT_FOLDER
- */
public Reporter() {
- this(null);
+ this(null, null);
}
- public Reporter(String directory) {
- initialize(directory);
+ public Reporter(String directory, String name) {
+ init(directory, name);
}
- protected void initialize(String directory) {
- if (directory == null) {
- directory = ".";
+ protected void init(String directory, String name) {
+ // set defaults if needed
+ if (StringUtils.isBlank(name)) {
+ name = "dbptk-report-" + new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + ".txt";
}
- String filenamePrefix = "dbptk-report-";
- String filenameTimestamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
- String filenameSuffix = ".txt";
- outputfile = Paths.get(directory).toAbsolutePath().resolve(filenamePrefix + filenameTimestamp + filenameSuffix);
- try {
- outputfile = Files.createFile(outputfile);
- } catch (IOException e) {
- LOGGER.warn("Could not create report file in current working directory. Attempting to use a temporary file", e);
+
+ if (StringUtils.isBlank(directory)) {
+ outputfile = ConfigUtils.getReportsDirectory().resolve(name);
+ } else {
+ outputfile = Paths.get(directory).toAbsolutePath().resolve(name);
+ }
+
+ if (Files.notExists(outputfile)) {
try {
- outputfile = Files.createTempFile(filenamePrefix, filenameSuffix);
- } catch (IOException e1) {
- LOGGER.error("Could not create report temporary file. Reporting will not function.", e1);
+ outputfile = Files.createFile(outputfile);
+ } catch (IOException e) {
+ LOGGER.warn("Could not create report file in current working directory. Attempting to use a temporary file", e);
+ try {
+ outputfile = Files.createTempFile("dbptk-report-", ".txt");
+ } catch (IOException e1) {
+ LOGGER.error("Could not create report temporary file. Reporting will not function.", e1);
+ }
}
}
diff --git a/dbptk-model/src/main/java/com/databasepreservation/utils/ConfigUtils.java b/dbptk-model/src/main/java/com/databasepreservation/utils/ConfigUtils.java
index fde330d89..4f5c9c4cb 100644
--- a/dbptk-model/src/main/java/com/databasepreservation/utils/ConfigUtils.java
+++ b/dbptk-model/src/main/java/com/databasepreservation/utils/ConfigUtils.java
@@ -1,10 +1,23 @@
package com.databasepreservation.utils;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.databasepreservation.Constants;
+import com.databasepreservation.model.modules.DatabaseModuleFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.core.joran.spi.JoranException;
/**
* Obtain values from system environment variables or properties.
@@ -12,65 +25,119 @@
* @author Bruno Ferreira
*/
public class ConfigUtils {
- private static final Map retrievedProperties = new HashMap<>();
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfigUtils.class);
+ private static boolean initialized = false;
- private static String partsToEnvironment(String... parts) {
- return StringUtils.join(parts, '_').toUpperCase(Locale.ENGLISH);
+ private static Path homeDirectory, logDirectory, modulesDirectory, reportsDirectory;
+
+ public static void initialize() {
+ if (!initialized) {
+ String homeDirectoryAsString = getProperty(Constants.DEFAULT_HOME_DIRECTORY, Constants.PROPERTY_KEY_HOME);
+ initialize(Paths.get(homeDirectoryAsString).toAbsolutePath());
+ }
}
- private static String partsToProperty(String... parts) {
- return StringUtils.join(parts, '.').toLowerCase(Locale.ENGLISH);
+ public static void initialize(Path dbptkHome) {
+ if (!initialized) {
+ homeDirectory = dbptkHome;
+ System.setProperty(Constants.PROPERTY_KEY_HOME, homeDirectory.toAbsolutePath().toString());
+
+ logDirectory = homeDirectory.resolve(Constants.SUBDIRECTORY_LOG);
+ modulesDirectory = homeDirectory.resolve(Constants.SUBDIRECTORY_MODULES);
+ reportsDirectory = homeDirectory.resolve(Constants.SUBDIRECTORY_REPORTS);
+
+ instantiateEssentialDirectories(homeDirectory, logDirectory, modulesDirectory, reportsDirectory);
+
+ configureLogback();
+ initialized = true;
+ }
}
- /**
- * Same as getProperty(String defaultValue, String... parts), but attempts to
- * convert the String values to Integers via Integer.parseInt
- */
- public static Integer getProperty(Integer defaultValue, String... parts) {
- return Integer.parseInt(getProperty(defaultValue.toString(), parts));
+ public static Path getModuleDirectory(DatabaseModuleFactory moduleFactory) {
+ if (!initialized) {
+ initialize();
+ }
+
+ Path moduleDirectory = modulesDirectory.resolve(moduleFactory.getModuleName());
+ instantiateEssentialDirectories(moduleDirectory);
+ return moduleDirectory;
}
- /**
- * Get the value from the java properties (-Dxxx=yyy) or an environment
- * variable (in that order), ultimately returning the default value if one was
- * not found.
- *
- * @param defaultValue
- * the value to return if no other value is found
- * @param parts
- * used to build the environment variable and property names. Ex:
- * ["dbptk", "test"] becomes the environment variable "DBPTK_TEST"
- * and the property "dbptk.test"
- * @return the value associated with the java property, OR the value
- * associated with the environment variable, OR the default value (in
- * this order).
- */
- public static String getProperty(String defaultValue, String... parts) {
- String propKey = partsToProperty(parts);
+ public static Path getReportsDirectory() {
+ return reportsDirectory;
+ }
- String value = retrievedProperties.get(propKey);
- if (StringUtils.isNotBlank(value)) {
- return value;
+ private static void instantiateEssentialDirectories(Path... directories) {
+ for (Path path : directories) {
+ try {
+ if (!Files.exists(path)) {
+ Files.createDirectories(path);
+ }
+ } catch (IOException e) {
+ LOGGER.error("Unable to create " + path, e);
+ }
}
+ }
- value = System.getProperty(propKey, null);
- if (StringUtils.isNotBlank(value)) {
- retrievedProperties.put(propKey, value);
- return value;
- }
+ private static void configureLogback() {
+ // 20170314 hsilva: logback file was named differently from what logback
+ // usually expects in order to avoid auto-loading by logback as we want to
+ // place the log file under dbptk home
+ // 20170407 bferreira: since logback.xml is only available in dbptk-core, we
+ // should check if it present. If our logback file is not present, just
+ // leave logback to use whichever defaults are in place (since DBPTK are
+ // used in a modular way)
+ URL logbackFileResource = ClassLoader.getSystemResource(Constants.LOGBACK_FILE_NAME);
- String envKey = partsToEnvironment(parts);
- if (StringUtils.isNotBlank(value)) {
- return value;
+ try {
+ LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
+ JoranConfigurator configurator = new JoranConfigurator();
+ configurator.setContext(context);
+ context.reset();
+
+ if (logbackFileResource != null) {
+ configurator.doConfigure(logbackFileResource);
+ }
+ } catch (JoranException e) {
+ LOGGER.error("Error configuring logback", e);
}
+ }
- value = System.getenv(envKey);
- if (StringUtils.isNotBlank(value)) {
- retrievedProperties.put(propKey, value);
- return value;
+ public static String getVersionInfo() {
+ InputStream versionInfoAsStream = ConfigUtils.class.getClassLoader().getSystemResourceAsStream(
+ Constants.VERSION_INFO_FILE);
+ String ret;
+ try {
+ ret = IOUtils.toString(versionInfoAsStream);
+ } catch (IOException e) {
+ LOGGER.debug("Could not obtain resource {}" + Constants.VERSION_INFO_FILE);
+ ret = "";
+ } finally {
+ IOUtils.closeQuietly(versionInfoAsStream);
}
+ return ret;
+ }
+
+ /**
+ * Same as getProperty, but attempts to convert the String values to Integers
+ * via Integer.parseInt
+ */
+ public static Integer getProperty(Integer defaultValue, String propertyKey) {
+ return Integer.parseInt(getProperty(defaultValue.toString(), propertyKey));
+ }
- retrievedProperties.put(propKey, defaultValue);
- return defaultValue;
+ /**
+ * Get the value from the java properties (-Dxxx=yyy) and return the default
+ * value if the property is not defined.
+ *
+ * @param defaultValue
+ * the value to return if no other value is found
+ * @param propertyKey
+ * The java property key
+ * @return the value associated with the java property, or the default value.
+ */
+ public static String getProperty(String defaultValue, String propertyKey) {
+ String value = System.getProperty(propertyKey, null);
+ return StringUtils.isNotBlank(value) ? value : defaultValue;
}
}
diff --git a/dbptk-modules/dbptk-module-db2/pom.xml b/dbptk-modules/dbptk-module-db2/pom.xml
index 0cf62e647..f3e282449 100644
--- a/dbptk-modules/dbptk-module-db2/pom.xml
+++ b/dbptk-modules/dbptk-module-db2/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-db2
com.databasepreservation
dbptk-module-db2
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-dbml/pom.xml b/dbptk-modules/dbptk-module-dbml/pom.xml
index 3ef0ea70a..757fa1b32 100644
--- a/dbptk-modules/dbptk-module-dbml/pom.xml
+++ b/dbptk-modules/dbptk-module-dbml/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-dbml
com.databasepreservation
dbptk-module-dbml
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-jdbc/pom.xml b/dbptk-modules/dbptk-module-jdbc/pom.xml
index 928f4eece..848503d60 100644
--- a/dbptk-modules/dbptk-module-jdbc/pom.xml
+++ b/dbptk-modules/dbptk-module-jdbc/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-jdbc
com.databasepreservation
dbptk-module-jdbc
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-jdbc/src/main/java/com/databasepreservation/modules/jdbc/in/JDBCImportModule.java b/dbptk-modules/dbptk-module-jdbc/src/main/java/com/databasepreservation/modules/jdbc/in/JDBCImportModule.java
index d51de6579..da4b6ed89 100644
--- a/dbptk-modules/dbptk-module-jdbc/src/main/java/com/databasepreservation/modules/jdbc/in/JDBCImportModule.java
+++ b/dbptk-modules/dbptk-module-jdbc/src/main/java/com/databasepreservation/modules/jdbc/in/JDBCImportModule.java
@@ -75,12 +75,11 @@
*/
public class JDBCImportModule implements DatabaseImportModule {
// if fetch size is zero, then the driver decides the best fetch size
- protected static final Integer DEFAULT_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(0, "dbptk", "jdbc",
- "fetchsize", "default");
- protected static final Integer SMALL_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(10, "dbptk", "jdbc", "fetchsize",
- "small");
- protected static final Integer MINIMUM_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(1, "dbptk", "jdbc",
- "fetchsize", "minimum");
+ protected static final Integer DEFAULT_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(0,
+ "dbptk.jdbc.fetchsize.default");
+ protected static final Integer SMALL_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(10, "dbptk.jdbc.fetchsize.small");
+ protected static final Integer MINIMUM_ROW_FETCH_BLOCK_SIZE = ConfigUtils.getProperty(1,
+ "dbptk.jdbc.fetchsize.minimum");
protected static final String DEFAULT_DATA_TIMESPAN = "(...)";
diff --git a/dbptk-modules/dbptk-module-list-tables/pom.xml b/dbptk-modules/dbptk-module-list-tables/pom.xml
index aa4420155..a3852a5f8 100644
--- a/dbptk-modules/dbptk-module-list-tables/pom.xml
+++ b/dbptk-modules/dbptk-module-list-tables/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-list-tables
com.databasepreservation
dbptk-module-list-tables
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-ms-access/pom.xml b/dbptk-modules/dbptk-module-ms-access/pom.xml
index 69d88f898..9ae0219b1 100644
--- a/dbptk-modules/dbptk-module-ms-access/pom.xml
+++ b/dbptk-modules/dbptk-module-ms-access/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-ms-access
com.databasepreservation
dbptk-module-ms-access
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-mysql/pom.xml b/dbptk-modules/dbptk-module-mysql/pom.xml
index d28a1b4d8..b6d28baf2 100644
--- a/dbptk-modules/dbptk-module-mysql/pom.xml
+++ b/dbptk-modules/dbptk-module-mysql/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-mysql
com.databasepreservation
dbptk-module-mysql
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-odbc/pom.xml b/dbptk-modules/dbptk-module-odbc/pom.xml
index bedb4f671..0c0745b4a 100644
--- a/dbptk-modules/dbptk-module-odbc/pom.xml
+++ b/dbptk-modules/dbptk-module-odbc/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-odbc
com.databasepreservation
dbptk-module-odbc
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-oracle/pom.xml b/dbptk-modules/dbptk-module-oracle/pom.xml
index 4fa963123..d2a7de503 100644
--- a/dbptk-modules/dbptk-module-oracle/pom.xml
+++ b/dbptk-modules/dbptk-module-oracle/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-oracle
com.databasepreservation
dbptk-module-oracle
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-postgresql/pom.xml b/dbptk-modules/dbptk-module-postgresql/pom.xml
index 30efa319e..0e1555ffb 100644
--- a/dbptk-modules/dbptk-module-postgresql/pom.xml
+++ b/dbptk-modules/dbptk-module-postgresql/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-postgresql
com.databasepreservation
dbptk-module-postgresql
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-siard/pom.xml b/dbptk-modules/dbptk-module-siard/pom.xml
index 3da88dbae..aae0f5be8 100644
--- a/dbptk-modules/dbptk-module-siard/pom.xml
+++ b/dbptk-modules/dbptk-module-siard/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-siard
com.databasepreservation
dbptk-module-siard
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/ContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/ContentImportStrategy.java
index c941d6f6c..4e66730fc 100644
--- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/ContentImportStrategy.java
+++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/ContentImportStrategy.java
@@ -1,5 +1,6 @@
package com.databasepreservation.modules.siard.in.content;
+import com.databasepreservation.common.ObservableModule;
import com.databasepreservation.model.exception.ModuleException;
import com.databasepreservation.model.modules.DatabaseExportModule;
import com.databasepreservation.model.modules.ModuleSettings;
@@ -11,5 +12,6 @@
*/
public interface ContentImportStrategy {
void importContent(DatabaseExportModule handler, SIARDArchiveContainer container,
- DatabaseStructure databaseStructure, ModuleSettings moduleSettings) throws ModuleException;
+ DatabaseStructure databaseStructure, ModuleSettings moduleSettings, ObservableModule observer)
+ throws ModuleException;
}
diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD1ContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD1ContentImportStrategy.java
index 4b7ed8cb2..e83581806 100644
--- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD1ContentImportStrategy.java
+++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD1ContentImportStrategy.java
@@ -25,6 +25,7 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import com.databasepreservation.common.ObservableModule;
import com.databasepreservation.model.data.BinaryCell;
import com.databasepreservation.model.data.Cell;
import com.databasepreservation.model.data.NullCell;
@@ -78,6 +79,8 @@ public class SIARD1ContentImportStrategy extends DefaultHandler implements Conte
private Row row;
private long rowIndex;
private long currentTableTotalRows;
+ private ObservableModule observable;
+ private DatabaseStructure databaseStructure;
private long lastProgressTimestamp;
@@ -88,10 +91,13 @@ public SIARD1ContentImportStrategy(ReadStrategy readStrategy, ContentPathImportS
@Override
public void importContent(DatabaseExportModule handler, SIARDArchiveContainer container,
- DatabaseStructure databaseStructure, ModuleSettings moduleSettings) throws ModuleException {
+ DatabaseStructure databaseStructure, ModuleSettings moduleSettings, ObservableModule observable)
+ throws ModuleException {
// set instance state
this.databaseExportModule = handler;
this.contentContainer = container;
+ this.observable = observable;
+ this.databaseStructure = databaseStructure;
// pre-setup parser and validation
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -102,9 +108,13 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
SAXParser saxParser = null;
// process tables
+ long completedSchemas = 0;
+ long completedTablesInSchema;
for (SchemaStructure schema : databaseStructure.getSchemas()) {
boolean schemaHandled = false;
currentSchema = schema;
+ completedTablesInSchema = 0;
+ observable.notifyOpenSchema(databaseStructure, schema, completedSchemas, completedTablesInSchema);
try {
databaseExportModule.handleDataOpenSchema(currentSchema.getName());
schemaHandled = true;
@@ -124,6 +134,7 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
} catch (ModuleException e) {
LOGGER.error("An error occurred while handling data open table", e);
}
+ observable.notifyOpenTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
this.currentTableTotalRows = currentTable.getRows();
lastProgressTimestamp = System.currentTimeMillis();
@@ -190,6 +201,8 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
LOGGER.info("Total of " + rowIndex + " row(s) processed");
+ completedTablesInSchema++;
+ observable.notifyCloseTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
try {
databaseExportModule.handleDataCloseTable(currentTable.getId());
} catch (ModuleException e) {
@@ -200,6 +213,8 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
}
}
+ completedSchemas++;
+ observable.notifyCloseSchema(databaseStructure, schema, completedSchemas, schema.getTables().size());
try {
databaseExportModule.handleDataCloseSchema(currentSchema.getName());
} catch (ModuleException e) {
@@ -303,6 +318,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
if (rowIndex % 1000 == 0 && System.currentTimeMillis() - lastProgressTimestamp > 3000) {
lastProgressTimestamp = System.currentTimeMillis();
+ observable.notifyTableProgress(databaseStructure, currentTable, rowIndex - 2, currentTableTotalRows);
if (currentTableTotalRows > 0) {
LOGGER.info(String.format("Progress: %d rows of table %s.%s (%d%%)", rowIndex, currentTable.getSchema(),
currentTable.getName(), rowIndex * 100 / currentTableTotalRows));
diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD2ContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD2ContentImportStrategy.java
index 47f1ecf37..3c7cd726c 100644
--- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD2ContentImportStrategy.java
+++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARD2ContentImportStrategy.java
@@ -26,6 +26,7 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import com.databasepreservation.common.ObservableModule;
import com.databasepreservation.common.PathInputStreamProvider;
import com.databasepreservation.model.data.BinaryCell;
import com.databasepreservation.model.data.Cell;
@@ -81,6 +82,8 @@ public class SIARD2ContentImportStrategy extends DefaultHandler implements Conte
private Row row;
private long rowIndex;
private long currentTableTotalRows;
+ private ObservableModule observable;
+ private DatabaseStructure databaseStructure;
private long lastProgressTimestamp;
@@ -93,10 +96,13 @@ public SIARD2ContentImportStrategy(ReadStrategy readStrategy, ContentPathImportS
@Override
public void importContent(DatabaseExportModule handler, SIARDArchiveContainer container,
- DatabaseStructure databaseStructure, ModuleSettings moduleSettings) throws ModuleException {
+ DatabaseStructure databaseStructure, ModuleSettings moduleSettings, ObservableModule observable)
+ throws ModuleException {
// set instance state
this.databaseExportModule = handler;
this.contentContainer = container;
+ this.observable = observable;
+ this.databaseStructure = databaseStructure;
// pre-setup parser and validation
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -107,9 +113,13 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
SAXParser saxParser = null;
// process tables
+ long completedSchemas = 0;
+ long completedTablesInSchema;
for (SchemaStructure schema : databaseStructure.getSchemas()) {
boolean schemaHandled = false;
currentSchema = schema;
+ completedTablesInSchema = 0;
+ observable.notifyOpenSchema(databaseStructure, schema, completedSchemas, completedTablesInSchema);
try {
databaseExportModule.handleDataOpenSchema(currentSchema.getName());
schemaHandled = true;
@@ -129,6 +139,7 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
} catch (ModuleException e) {
LOGGER.error("An error occurred while handling data open table", e);
}
+ observable.notifyOpenTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
this.currentTableTotalRows = currentTable.getRows();
lastProgressTimestamp = System.currentTimeMillis();
@@ -192,6 +203,8 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
LOGGER.info("Total of " + rowIndex + " row(s) processed");
+ completedTablesInSchema++;
+ observable.notifyCloseTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
try {
databaseExportModule.handleDataCloseTable(currentTable.getId());
} catch (ModuleException e) {
@@ -202,6 +215,8 @@ public void importContent(DatabaseExportModule handler, SIARDArchiveContainer co
}
}
+ completedSchemas++;
+ observable.notifyCloseSchema(databaseStructure, schema, completedSchemas, schema.getTables().size());
try {
databaseExportModule.handleDataCloseSchema(currentSchema.getName());
} catch (ModuleException e) {
@@ -324,6 +339,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
if (rowIndex % 1000 == 0 && System.currentTimeMillis() - lastProgressTimestamp > 3000) {
lastProgressTimestamp = System.currentTimeMillis();
+ observable.notifyTableProgress(databaseStructure, currentTable, rowIndex - 2, currentTableTotalRows);
if (currentTableTotalRows > 0) {
LOGGER.info(String.format("Progress: %d rows of table %s.%s (%d%%)", rowIndex, currentTable.getSchema(),
currentTable.getName(), rowIndex * 100 / currentTableTotalRows));
diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java
index c5d0d5ef8..a1df9049d 100644
--- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java
+++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java
@@ -31,6 +31,7 @@
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import com.databasepreservation.common.ObservableModule;
import com.databasepreservation.model.data.Cell;
import com.databasepreservation.model.data.NullCell;
import com.databasepreservation.model.data.Row;
@@ -76,6 +77,8 @@ public class SIARDDKContentImportStrategy extends DefaultHandler implements Cont
private static final String SIARDDK_NIL_LOCAL_ATTR_NAME = "nil";
protected TypeInfoProvider typeInfoProvider;
protected TypeInfo xsdCellType;
+ private ObservableModule observable;
+ private DatabaseStructure databaseStructure;
/**
* @author Thomas Kristensen
@@ -91,7 +94,10 @@ public SIARDDKContentImportStrategy(FolderReadStrategyMD5Sum readStrategy, SIARD
@Override
public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveContainer mainFolder,
- DatabaseStructure databaseStructure, ModuleSettings moduleSettings) throws ModuleException {
+ DatabaseStructure databaseStructure, ModuleSettings moduleSettings, ObservableModule observable)
+ throws ModuleException {
+ this.observable = observable;
+ this.databaseStructure = databaseStructure;
pathStrategy.parseFileIndexMetadata();
this.dbExportHandler = dbExportHandler;
Map archiveContainerByAbsPath = new HashMap();
@@ -105,11 +111,16 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont
SIARDArchiveContainer currentFolder = null;
assert (databaseStructure.getSchemas().size() == 1);
this.dbExportHandler.handleDataOpenSchema(importAsSchema);
+ long completedSchemas = 0;
+ long completedTablesInSchema;
for (SchemaStructure schema : databaseStructure.getSchemas()) {
+ completedTablesInSchema = 0;
+ observable.notifyOpenSchema(databaseStructure, schema, completedSchemas, completedTablesInSchema);
assert (schema.getName().equals(importAsSchema));
for (TableStructure table : schema.getTables()) {
currentTable = table;
this.dbExportHandler.handleDataOpenTable(table.getId());
+ observable.notifyOpenTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
rowIndex = 0;
String xsdFileName = pathStrategy.getTableXSDFilePath(schema.getName(), table.getId());
String xmlFileName = pathStrategy.getTableXMLFilePath(schema.getName(), table.getId());
@@ -173,8 +184,12 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont
readStrategy.closeAndVerifyMD5Sum(currentTableInputStream);
readStrategy.closeAndVerifyMD5Sum(xsdInputStream);
+ completedTablesInSchema++;
+ observable.notifyCloseTable(databaseStructure, table, completedSchemas, completedTablesInSchema);
this.dbExportHandler.handleDataCloseTable(table.getId());
}
+ completedSchemas++;
+ observable.notifyCloseSchema(databaseStructure, schema, completedSchemas, schema.getTables().size());
this.dbExportHandler.handleDataCloseSchema(importAsSchema);
}
@@ -231,6 +246,7 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
assert !lstCells.contains(null);
currentRow.setCells(lstCells);
try {
+ observable.notifyTableProgress(databaseStructure, currentTable, rowIndex - 2, currentTable.getRows());
this.dbExportHandler.handleDataRow(currentRow);
} catch (InvalidDataException e) {
throw new SAXException(e.getMessage() + " Row index:" + rowIndex, e);
diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/input/SIARDImportDefault.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/input/SIARDImportDefault.java
index e51f4eef1..aac0278db 100644
--- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/input/SIARDImportDefault.java
+++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/input/SIARDImportDefault.java
@@ -1,5 +1,6 @@
package com.databasepreservation.modules.siard.in.input;
+import com.databasepreservation.common.ObservableModule;
import com.databasepreservation.model.Reporter;
import com.databasepreservation.model.exception.InvalidDataException;
import com.databasepreservation.model.exception.ModuleException;
@@ -16,7 +17,7 @@
/**
* @author Bruno Ferreira
*/
-public class SIARDImportDefault implements DatabaseImportModule {
+public class SIARDImportDefault extends ObservableModule implements DatabaseImportModule {
private final ReadStrategy readStrategy;
private final SIARDArchiveContainer mainContainer;
private final ContentImportStrategy contentStrategy;
@@ -38,6 +39,7 @@ public void getDatabase(DatabaseExportModule handler) throws ModuleException, Un
moduleSettings = handler.getModuleSettings();
readStrategy.setup(mainContainer);
handler.initDatabase();
+ notifyOpenDatabase();
try {
metadataStrategy.loadMetadata(readStrategy, mainContainer, moduleSettings);
@@ -46,9 +48,11 @@ public void getDatabase(DatabaseExportModule handler) throws ModuleException, Un
// handler.setIgnoredSchemas(null);
handler.handleStructure(dbStructure);
+ notifyStructureObtained(dbStructure);
- contentStrategy.importContent(handler, mainContainer, dbStructure, moduleSettings);
+ contentStrategy.importContent(handler, mainContainer, dbStructure, moduleSettings, (ObservableModule) this);
+ notifyCloseDatabase(dbStructure);
handler.finishDatabase();
} finally {
readStrategy.finish(mainContainer);
diff --git a/dbptk-modules/dbptk-module-solr/pom.xml b/dbptk-modules/dbptk-module-solr/pom.xml
index 6a3c2e278..987177e2b 100644
--- a/dbptk-modules/dbptk-module-solr/pom.xml
+++ b/dbptk-modules/dbptk-module-solr/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-solr
com.databasepreservation
dbptk-module-solr
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrExportModule.java b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrExportModule.java
index 1d9797fb6..5026a75f5 100644
--- a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrExportModule.java
+++ b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrExportModule.java
@@ -1,5 +1,6 @@
package com.databasepreservation.modules.solr;
+import java.nio.file.Path;
import java.util.Set;
import com.databasepreservation.model.Reporter;
@@ -20,7 +21,7 @@
* @author Bruno Ferreira
*/
public class SolrExportModule implements DatabaseExportModule {
- private final SolrModuleConfiguration configuration = SolrModuleConfiguration.getInstance();
+ private final SolrModuleConfiguration configuration;
private final SolrManager solrManager;
@@ -38,16 +39,18 @@ public class SolrExportModule implements DatabaseExportModule {
private Reporter reporter;
- public SolrExportModule(String hostname, Integer port, String endpoint, String zookeeperHost, Integer zookeeperPort) {
- this(hostname, port, endpoint, zookeeperHost, zookeeperPort, null);
+ public SolrExportModule(String hostname, Integer port, String endpoint, String zookeeperHost, Integer zookeeperPort,
+ Path moduleDirectory) {
+ this(hostname, port, endpoint, zookeeperHost, zookeeperPort, null, moduleDirectory);
}
public SolrExportModule(String hostname, Integer port, String endpoint, String zookeeperHost, Integer zookeeperPort,
- String databaseUUID) {
+ String databaseUUID, Path moduleDirectory) {
zookeeperHostAndPort = zookeeperHost + ":" + zookeeperPort;
String url = "http://" + hostname + ":" + port + "/" + endpoint;
solrManager = new SolrManager(url);
preSetDatabaseUUID = databaseUUID;
+ configuration = SolrModuleConfiguration.getInstance(moduleDirectory);
}
/**
@@ -179,6 +182,7 @@ public void handleDataCloseSchema(String schemaName) throws ModuleException {
*/
@Override
public void finishDatabase() throws ModuleException {
+ solrManager.markDatabaseAsReady(viewerDatabase);
solrManager.commitAll();
solrManager.freeResources();
}
diff --git a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleConfiguration.java b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleConfiguration.java
index 9ea9e4c2a..afdc5da5e 100644
--- a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleConfiguration.java
+++ b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleConfiguration.java
@@ -15,14 +15,16 @@
* @author Bruno Ferreira
*/
public class SolrModuleConfiguration extends ViewerAbstractConfiguration {
+ private final Path moduleDirectory;
private Path workspaceDirectory = null;
private Path workspaceForLobs = null;
/**
* Private constructor, use getInstance() instead
*/
- private SolrModuleConfiguration() {
+ private SolrModuleConfiguration(Path moduleDirectory) {
super(new SystemConfiguration());
+ this.moduleDirectory = moduleDirectory;
}
/*
@@ -31,9 +33,9 @@ private SolrModuleConfiguration() {
*/
private static SolrModuleConfiguration instance = null;
- public static SolrModuleConfiguration getInstance() {
+ public static SolrModuleConfiguration getInstance(Path moduleDirectory) {
if (instance == null) {
- instance = new SolrModuleConfiguration();
+ instance = new SolrModuleConfiguration(moduleDirectory);
}
return instance;
}
@@ -70,8 +72,7 @@ private Path getWorkspaceDirectory() {
} else if (StringUtils.isNotBlank(env)) {
workspaceDirectory = Paths.get(env);
} else {
- workspaceDirectory = Paths.get(System.getProperty("user.home"),
- ViewerConstants.INSTALL_FOLDER_DEFAULT_SUBFOLDER_UNDER_HOME);
+ workspaceDirectory = moduleDirectory;
}
}
return workspaceDirectory;
diff --git a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleFactory.java b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleFactory.java
index 971e7e7d9..fde4ae141 100644
--- a/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleFactory.java
+++ b/dbptk-modules/dbptk-module-solr/src/main/java/com/databasepreservation/modules/solr/SolrModuleFactory.java
@@ -1,5 +1,6 @@
package com.databasepreservation.modules.solr;
+import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -14,6 +15,7 @@
import com.databasepreservation.model.modules.DatabaseModuleFactory;
import com.databasepreservation.model.parameters.Parameter;
import com.databasepreservation.model.parameters.Parameters;
+import com.databasepreservation.utils.ConfigUtils;
/**
* @author Bruno Ferreira
@@ -129,11 +131,14 @@ public DatabaseExportModule buildExportModule(Map parameters)
reporter.exportModuleParameters(getModuleName(), "hostname", pHostname, "port", pPortNumber.toString(), "endpoint",
pEndpoint, "zookeeper-hostname", pZookeperHostname, "zookeeper-port", pZookeeperPortNumber.toString());
+ Path moduleDirectory = ConfigUtils.getModuleDirectory(this);
+
if (StringUtils.isBlank(pDatabaseUUID)) {
- return new SolrExportModule(pHostname, pPortNumber, pEndpoint, pZookeperHostname, pZookeeperPortNumber);
+ return new SolrExportModule(pHostname, pPortNumber, pEndpoint, pZookeperHostname, pZookeeperPortNumber,
+ moduleDirectory);
} else {
return new SolrExportModule(pHostname, pPortNumber, pEndpoint, pZookeperHostname, pZookeeperPortNumber,
- pDatabaseUUID);
+ pDatabaseUUID, moduleDirectory);
}
}
}
diff --git a/dbptk-modules/dbptk-module-sql-file/pom.xml b/dbptk-modules/dbptk-module-sql-file/pom.xml
index 90c6a3458..705999e9d 100644
--- a/dbptk-modules/dbptk-module-sql-file/pom.xml
+++ b/dbptk-modules/dbptk-module-sql-file/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-sql-file
com.databasepreservation
dbptk-module-sql-file
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/dbptk-module-sql-server/pom.xml b/dbptk-modules/dbptk-module-sql-server/pom.xml
index baed04f0b..0c47454dd 100644
--- a/dbptk-modules/dbptk-module-sql-server/pom.xml
+++ b/dbptk-modules/dbptk-module-sql-server/pom.xml
@@ -6,11 +6,11 @@
dbptk-module-sql-server
com.databasepreservation
dbptk-module-sql-server
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
diff --git a/dbptk-modules/pom.xml b/dbptk-modules/pom.xml
index e3054ede1..93a2618b4 100644
--- a/dbptk-modules/pom.xml
+++ b/dbptk-modules/pom.xml
@@ -5,11 +5,11 @@
dbptk-modules
com.databasepreservation
dbptk-modules
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk
- 2.0.0-beta7.2
+ 2.0.0-rc1
..
pom
diff --git a/pom.xml b/pom.xml
index 1c5615565..80b8194fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
Database Preservation Toolkit
com.databasepreservation
dbptk
- 2.0.0-beta7.2
+ 2.0.0-rc1
pom
A toolkit that allows data migration and conversion between database management systems formats and
digital preservation formats.
@@ -20,7 +20,7 @@
1.7
${project.basedir}/vendor-libs/repository
- 0.2.7
+ 1.0.0-rc1
@@ -176,6 +176,28 @@
maven-surefire-plugin
2.18.1
+
+ pl.project13.maven
+ git-commit-id-plugin
+ 2.2.1
+
+
+
+ revision
+
+
+
+
+
+ true
+
+
+
+ ${project.basedir}/src/main/resources/dbptk-version.json
+
+ json
+
+
@@ -185,12 +207,12 @@
com.databasepreservation
dbptk-model
- 2.0.0-beta7.2
+ 2.0.0-rc1
com.databasepreservation
dbptk-model
- 2.0.0-beta7.2
+ 2.0.0-rc1
sources
@@ -207,35 +229,35 @@
- com.databasepreservationdbptk-module-db22.0.0-beta7.2
- com.databasepreservationdbptk-module-db22.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-db22.0.0-rc1
+ com.databasepreservationdbptk-module-db22.0.0-rc1sources
- com.databasepreservationdbptk-module-dbml2.0.0-beta7.2
- com.databasepreservationdbptk-module-dbml2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-dbml2.0.0-rc1
+ com.databasepreservationdbptk-module-dbml2.0.0-rc1sources
- com.databasepreservationdbptk-module-jdbc2.0.0-beta7.2
- com.databasepreservationdbptk-module-jdbc2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-jdbc2.0.0-rc1
+ com.databasepreservationdbptk-module-jdbc2.0.0-rc1sources
- com.databasepreservationdbptk-module-list-tables2.0.0-beta7.2
- com.databasepreservationdbptk-module-list-tables2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-list-tables2.0.0-rc1
+ com.databasepreservationdbptk-module-list-tables2.0.0-rc1sources
- com.databasepreservationdbptk-module-ms-access2.0.0-beta7.2
- com.databasepreservationdbptk-module-ms-access2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-ms-access2.0.0-rc1
+ com.databasepreservationdbptk-module-ms-access2.0.0-rc1sources
- com.databasepreservationdbptk-module-mysql2.0.0-beta7.2
- com.databasepreservationdbptk-module-mysql2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-mysql2.0.0-rc1
+ com.databasepreservationdbptk-module-mysql2.0.0-rc1sources
- com.databasepreservationdbptk-module-odbc2.0.0-beta7.2
- com.databasepreservationdbptk-module-odbc2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-odbc2.0.0-rc1
+ com.databasepreservationdbptk-module-odbc2.0.0-rc1sources
- com.databasepreservationdbptk-module-oracle2.0.0-beta7.2
- com.databasepreservationdbptk-module-oracle2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-oracle2.0.0-rc1
+ com.databasepreservationdbptk-module-oracle2.0.0-rc1sources
- com.databasepreservationdbptk-module-postgresql2.0.0-beta7.2
- com.databasepreservationdbptk-module-postgresql2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-postgresql2.0.0-rc1
+ com.databasepreservationdbptk-module-postgresql2.0.0-rc1sources
- com.databasepreservationdbptk-module-siard2.0.0-beta7.2
- com.databasepreservationdbptk-module-siard2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-siard2.0.0-rc1
+ com.databasepreservationdbptk-module-siard2.0.0-rc1sources
com.databasepreservationdbptk-bindings-siard11.1.1
com.databasepreservationdbptk-bindings-siard11.1.1sources
@@ -246,14 +268,14 @@
com.databasepreservationdbptk-bindings-siarddk1.3.0
com.databasepreservationdbptk-bindings-siarddk1.3.0sources
- com.databasepreservationdbptk-module-solr2.0.0-beta7.2
- com.databasepreservationdbptk-module-solr2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-solr2.0.0-rc1
+ com.databasepreservationdbptk-module-solr2.0.0-rc1sources
- com.databasepreservationdbptk-module-sql-file2.0.0-beta7.2
- com.databasepreservationdbptk-module-sql-file2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-sql-file2.0.0-rc1
+ com.databasepreservationdbptk-module-sql-file2.0.0-rc1sources
- com.databasepreservationdbptk-module-sql-server2.0.0-beta7.2
- com.databasepreservationdbptk-module-sql-server2.0.0-beta7.2sources
+ com.databasepreservationdbptk-module-sql-server2.0.0-rc1
+ com.databasepreservationdbptk-module-sql-server2.0.0-rc1sources