Changeset: 02a10c4a891f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=02a10c4a891f Modified Files: java/embedded/src/main/java/org/monetdb/embedded/MonetDBEmbedded.java Branch: embedded-java Log Message:
Minor improvements to the lib load code While there, remove the depriate the JDBC statement function. This functionality is now done in the separate class. diffs (66 lines): diff --git a/java/embedded/src/main/java/org/monetdb/embedded/MonetDBEmbedded.java b/java/embedded/src/main/java/org/monetdb/embedded/MonetDBEmbedded.java --- a/java/embedded/src/main/java/org/monetdb/embedded/MonetDBEmbedded.java +++ b/java/embedded/src/main/java/org/monetdb/embedded/MonetDBEmbedded.java @@ -22,6 +22,10 @@ import org.monetdb.embedded.result.Embed * <strong>Note</strong>: You can have only one embedded MonetDB database running per JVM process. */ public class MonetDBEmbedded implements Closeable { + final private static String LIB_PATH_VAR = "java.library.path"; + final private static String NATIVE_LIB_PATH_IN_JAR = "src/main/resources/lib"; + final private static String NATIVE_LIB_NAME = "monetdb5"; + /** * Flag if the embedded database was already started. */ @@ -36,6 +40,19 @@ public class MonetDBEmbedded implements private final boolean silentFlag; /** + * The native embedded MonetDB library. + */ + static { + // Check if the lib path is set + if (System.getProperty(LIB_PATH_VAR).isEmpty() || "".equals(System.getProperty(LIB_PATH_VAR))) { + // If not set it to the location of the embedded native lib + System.setProperty(LIB_PATH_VAR, NATIVE_LIB_PATH_IN_JAR); + } + // Load the embedded library + System.loadLibrary(NATIVE_LIB_NAME); + } + + /** * @param databaseDirectory Database directory */ public MonetDBEmbedded(final File databaseDirectory) { @@ -47,14 +64,6 @@ public class MonetDBEmbedded implements * @param silentFlag Silent flag */ public MonetDBEmbedded(final File databaseDirectory, final boolean silentFlag) { - // Check if the lib path is set - if (System.getProperty("java.library.path").isEmpty() || "".equals(System.getProperty("java.library.path"))) { - // If not set it to the location of the embedded native lib - System.setProperty("java.library.path", "src/main/resources/lib"); - } - // Load the embedded library - System.loadLibrary("monetdb5"); - if (!databaseDirectory.isDirectory()) { throw new IllegalArgumentException(databaseDirectory + " is not a directory"); } @@ -105,16 +114,6 @@ public class MonetDBEmbedded implements } return queryWrapper(queryString); } - - /** - * Create a JDBC statement for the embedded database. - * - * @return The statement object - * @throws SQLException - */ -// public MonetDBEmbeddedStatement createStatement() throws SQLException { -// return new MonetDBEmbeddedStatement(this); -// } /** * Start the embedded database. _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list