camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesnether...@apache.org
Subject [camel] branch master updated: CAMEL-13396: Enable camel-leveldb to work with non-native leveldb libraries again
Date Mon, 08 Apr 2019 09:10:05 GMT
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 02a289b  CAMEL-13396: Enable camel-leveldb to work with non-native leveldb libraries
again
02a289b is described below

commit 02a289bb8b2979d0cf0406535c574396f231f3db
Author: James Netherton <jamesnetherton@gmail.com>
AuthorDate: Mon Apr 8 10:09:09 2019 +0100

    CAMEL-13396: Enable camel-leveldb to work with non-native leveldb libraries again
---
 .../java/org/apache/camel/component/leveldb/LevelDBFile.java     | 9 +++------
 parent/pom.xml                                                   | 1 +
 platforms/karaf/features/src/main/resources/features.xml         | 1 +
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
index 1198a8b..ba04c19 100644
--- a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
+++ b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java
@@ -23,6 +23,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import org.apache.camel.Service;
 import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.ObjectHelper;
 import org.iq80.leveldb.CompressionType;
 import org.iq80.leveldb.DB;
 import org.iq80.leveldb.DBFactory;
@@ -31,11 +32,6 @@ import org.iq80.leveldb.WriteOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
-
-import static org.fusesource.leveldbjni.JniDBFactory.factory;
-
-
 /**
  * Manages access to a shared <a href="https://github.com/fusesource/leveldbjni/">LevelDB</a>
file.
  * <p/>
@@ -179,6 +175,7 @@ public class LevelDBFile implements Service {
         try {
             final Path dbFile = Paths.get(this.getFileName());
             Files.createDirectories(dbFile.getParent());
+            DBFactory factory = getFactory();
             db = factory.open(getFile(), options);
         } catch (IOException ioe) {
             throw new RuntimeException("Error opening LevelDB with file " + getFile(), ioe);
@@ -192,7 +189,7 @@ public class LevelDBFile implements Service {
         };
         for (String cn : classNames) {
             try {
-                Class<?> clz = getClass().getClassLoader().loadClass(cn);
+                Class<?> clz = ObjectHelper.loadClass(cn, getClass().getClassLoader());
                 DBFactory factory = (DBFactory) clz.newInstance();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Using {} implementation of org.iq80.leveldb.DBFactory", factory.getClass().getName());
diff --git a/parent/pom.xml b/parent/pom.xml
index a7822d2..8e5ebf9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -442,6 +442,7 @@
         <leveldbjni-version>1.8</leveldbjni-version>
         <leveldb-api-version>0.10</leveldb-api-version>
         <leveldb-version>0.10</leveldb-version>
+        <leveldb-guava-version>21.0</leveldb-guava-version>
         <libphonenumber-version>8.10.8</libphonenumber-version>
         <libphonenumber-bundle-version>8.10.8_1</libphonenumber-bundle-version>
         <!-- virtual dependency only used by Eclipse m2e -->
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index c44e298..852f361 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1618,6 +1618,7 @@
   </feature>
   <feature name='camel-leveldb-java' version='${project.version}' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
+    <bundle dependency='true'>mvn:com.google.guava/guava/${leveldb-guava-version}</bundle>
     <bundle dependency='true'>wrap:mvn:org.iq80.leveldb/leveldb-api/${leveldb-api-version}$Bundle-Version=${leveldb-api-version}&amp;Export-Package=*;-noimport:=true;version="${leveldb-api-version}"</bundle>
     <bundle dependency='true'>wrap:mvn:org.iq80.leveldb/leveldb/${leveldb-version}$Bundle-Version=${leveldb-version}&amp;Export-Package=*;-noimport:=true;version="${leveldb-version}"</bundle>
     <bundle dependency='true'>mvn:org.fusesource.hawtbuf/hawtbuf/${hawtbuf-version}</bundle>


Mime
View raw message