camel-commits mailing list archives

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

acosentino pushed a commit to branch camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git


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

commit c633a7810987053b57fae01d0f674f16306883db
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 26428f8..96eefdf 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 8e1a5b9..5e3dddd 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -457,6 +457,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.1</libphonenumber-version>
     <libphonenumber-bundle-version>8.10.1_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 2a43ccc..3261825 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1492,6 +1492,7 @@
   </feature>
   <feature name='camel-leveldb-java' version='${project.version}' resolver='(obr)' 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