Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 36774200CBC for ; Tue, 20 Jun 2017 12:49:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 33641160BE1; Tue, 20 Jun 2017 10:49:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2B4A2160BD3 for ; Tue, 20 Jun 2017 12:49:26 +0200 (CEST) Received: (qmail 55847 invoked by uid 500); 20 Jun 2017 10:49:25 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 55827 invoked by uid 99); 20 Jun 2017 10:49:25 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2017 10:49:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8FF481A0CA9; Tue, 20 Jun 2017 10:49:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.18 X-Spam-Level: * X-Spam-Status: No, score=1.18 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ZDyO0qsDg9xs; Tue, 20 Jun 2017 10:49:22 +0000 (UTC) Received: from mail-qk0-f177.google.com (mail-qk0-f177.google.com [209.85.220.177]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id E916D5F6C8; Tue, 20 Jun 2017 10:49:21 +0000 (UTC) Received: by mail-qk0-f177.google.com with SMTP id r62so54229359qkf.0; Tue, 20 Jun 2017 03:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oUwHAsW8pkOjm998GCBiRKIK6jp8KuDcsVTDwfHssT8=; b=jiwXYxp4nppoAulgeQXjAuSHDPHv67r57cd68jxx7eGSGpRuFZPxo8P4e4jNQiPtXN gYfbDyJ2Sv413BVUi4qa91WKdlBfZ4w1t4STLa2c5HENLgVoDYfRmzwHZoBDJ162OQNY 8fyV6DkVsNgr3Nx2V8clVSvkdFGs/2GTcrua5PxZKXGGPUjSfL336P+zBmwbEtLCSllQ pXDh/DjZGZUbWECQPflJjeEp2JUAhuZD0jGJF8OmmBE5fDvninwPwBeZlgDXVrZL2KVh evwTEAdur2b7VUcZW4Vziiu+34t/yzkbXpRDUfkuPfDQjeNxgNyugE054M61AD42vbAu 7P3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oUwHAsW8pkOjm998GCBiRKIK6jp8KuDcsVTDwfHssT8=; b=shtg1Tr04ECwjPzrUYV2Dyln6YdIvwegsbHgTkv9dmmJyYqmj7ajkjhLZn6H70TnRB B1ZGpylxXitvBWR07QiYgyLWaiJfLxvQeS04FkyzRXkW8ptt0XTQfZaflYPhZK6tn2Uo 9GL7mdkiy+cIeF3BfY278p2PtbR7RD7PzKq+g7QTjRiCNLuq6J/ZFqj7BSHG/GjXgOOn 5cP/+2q6KlIgs767sdntXJM06vzqpPINdIv9sKQRsfNAdhGzf9wL4k6Vf72EIb9WHlHg nS2TVXnPrFsMahWSNLe8dJVtbPoxc2iTec6F/cnsAz9DxtOAu+w046pXFWA2cYtie5Hb xBXQ== X-Gm-Message-State: AKS2vOzbNEgV3OnXnPDWbwrsqEFe3aT3iymUhNIM6VMKeu4fXb2D9Iec F6EFO/MuqDYGokqzUq0EUMZ2zKubbhk0 X-Received: by 10.55.160.196 with SMTP id j187mr21833389qke.145.1497955761151; Tue, 20 Jun 2017 03:49:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.63.234 with HTTP; Tue, 20 Jun 2017 03:49:00 -0700 (PDT) In-Reply-To: <4813c2b6022b494184cefd492f4c0608@git.apache.org> References: <4813c2b6022b494184cefd492f4c0608@git.apache.org> From: Claus Ibsen Date: Tue, 20 Jun 2017 12:49:00 +0200 Message-ID: Subject: Re: [1/3] camel git commit: [CAMEL-11427] Provide camel-leveldb-java feature that uses non-native leveldb library To: dev Cc: commits@camel.apache.org Content-Type: text/plain; charset="UTF-8" archived-at: Tue, 20 Jun 2017 10:49:27 -0000 Hi I think the log.warn you do should be improved a bit, since you will get this on first attempt to load the driver and if its not on the classpath. So maybe ignore it totally, or change the logging level to debug etc. On Tue, Jun 20, 2017 at 9:51 AM, wrote: > Repository: camel > Updated Branches: > refs/heads/camel-2.18.x 653c8262f -> 2ba4c00ca > refs/heads/camel-2.19.x 3d33970af -> 5e6794310 > refs/heads/master 1f8ef53d6 -> 75498ab1e > > > [CAMEL-11427] Provide camel-leveldb-java feature that uses non-native leveldb library > > > Project: http://git-wip-us.apache.org/repos/asf/camel/repo > Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/75498ab1 > Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/75498ab1 > Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/75498ab1 > > Branch: refs/heads/master > Commit: 75498ab1ef70bb3694b84647f2e9d23d43268f9b > Parents: 1f8ef53 > Author: Grzegorz Grzybek > Authored: Tue Jun 20 09:48:48 2017 +0200 > Committer: Grzegorz Grzybek > Committed: Tue Jun 20 09:48:48 2017 +0200 > > ---------------------------------------------------------------------- > components/camel-leveldb/pom.xml | 12 ++++++++++++ > .../leveldb/LevelDBAggregationRepository.java | 14 ++++++++++++-- > .../camel/component/leveldb/LevelDBFile.java | 20 ++++++++++++++++++-- > parent/pom.xml | 2 ++ > .../features/src/main/resources/features.xml | 7 +++++++ > 5 files changed, 51 insertions(+), 4 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/camel/blob/75498ab1/components/camel-leveldb/pom.xml > ---------------------------------------------------------------------- > diff --git a/components/camel-leveldb/pom.xml b/components/camel-leveldb/pom.xml > index 9281c1f..afe82d3 100644 > --- a/components/camel-leveldb/pom.xml > +++ b/components/camel-leveldb/pom.xml > @@ -38,6 +38,13 @@ > LevelDB > > org.apache.camel.component.leveldb.* > + > + *, > + org.fusesource.leveldbjni;resolution:=optional, > + org.iq80.leveldb;resolution:=optional, > + org.iq80.leveldb.impl;resolution:=optional > + > + 0.9 > > > > @@ -53,6 +60,11 @@ > ${leveldbjni-version} > > > + org.iq80.leveldb > + leveldb > + ${leveldb-version} > + > + > org.fusesource.hawtbuf > hawtbuf > ${hawtbuf-version} > > http://git-wip-us.apache.org/repos/asf/camel/blob/75498ab1/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java > ---------------------------------------------------------------------- > diff --git a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java > index 2c8bf5d..eea1ad2 100644 > --- a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java > +++ b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBAggregationRepository.java > @@ -36,8 +36,6 @@ import org.iq80.leveldb.WriteBatch; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > -import static org.fusesource.leveldbjni.JniDBFactory.asString; > - > /** > * An instance of {@link org.apache.camel.spi.AggregationRepository} which is backed by a {@link LevelDBFile}. > */ > @@ -441,4 +439,16 @@ public class LevelDBAggregationRepository extends ServiceSupport implements Reco > } > } > > + public static String asString(byte[] value) { > + if (value == null) { > + return null; > + } else { > + try { > + return new String(value, "UTF-8"); > + } catch (UnsupportedEncodingException var2) { > + throw new RuntimeException(var2); > + } > + } > + } > + > } > > http://git-wip-us.apache.org/repos/asf/camel/blob/75498ab1/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/LevelDBFile.java > ---------------------------------------------------------------------- > 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 05fbf62..6a86a73 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,13 +23,12 @@ import org.apache.camel.Service; > import org.apache.camel.util.IOHelper; > import org.iq80.leveldb.CompressionType; > import org.iq80.leveldb.DB; > +import org.iq80.leveldb.DBFactory; > import org.iq80.leveldb.Options; > 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 LevelDB file. > *

> @@ -172,12 +171,29 @@ public class LevelDBFile implements Service { > options.createIfMissing(true); > try { > getFile().getParentFile().mkdirs(); > + DBFactory factory = getFactory(); > db = factory.open(getFile(), options); > } catch (IOException ioe) { > throw new RuntimeException("Error opening LevelDB with file " + getFile(), ioe); > } > } > > + private DBFactory getFactory() { > + String[] classNames = new String[] { > + "org.fusesource.leveldbjni.JniDBFactory", > + "org.iq80.leveldb.impl.Iq80DBFactory" > + }; > + for (String cn : classNames) { > + try { > + Class clz = getClass().getClassLoader().loadClass(cn); > + return (DBFactory) clz.newInstance(); > + } catch (Exception e) { > + LOG.warn(e.getMessage(), e); > + } > + } > + throw new IllegalStateException("Can't find implementation of org.iq80.leveldb.DBFactory"); > + } > + > public void stop() { > File file = getFile(); > > > http://git-wip-us.apache.org/repos/asf/camel/blob/75498ab1/parent/pom.xml > ---------------------------------------------------------------------- > diff --git a/parent/pom.xml b/parent/pom.xml > index a2196c7..f85c43f 100644 > --- a/parent/pom.xml > +++ b/parent/pom.xml > @@ -427,6 +427,8 @@ > 1.0.74 > 2.3.0_3 > 1.8 > + 0.9 > + 0.9 > 8.5.0 > 8.5.0_1 > > > http://git-wip-us.apache.org/repos/asf/camel/blob/75498ab1/platforms/karaf/features/src/main/resources/features.xml > ---------------------------------------------------------------------- > diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml > index d7c7064..fcb9ee8 100644 > --- a/platforms/karaf/features/src/main/resources/features.xml > +++ b/platforms/karaf/features/src/main/resources/features.xml > @@ -1270,6 +1270,13 @@ > mvn:org.fusesource.hawtbuf/hawtbuf/${hawtbuf-version} > mvn:org.apache.camel/camel-leveldb/${project.version} > > + > + camel-core > + wrap:mvn:org.iq80.leveldb/leveldb-api/${leveldb-api-version}$Bundle-Version=${leveldb-api-version}&Export-Package=*;-noimport:=true;version="${leveldb-api-version}" > + wrap:mvn:org.iq80.leveldb/leveldb/${leveldb-version}$Bundle-Version=${leveldb-version}&Export-Package=*;-noimport:=true;version="${leveldb-version}" > + mvn:org.fusesource.hawtbuf/hawtbuf/${hawtbuf-version} > + mvn:org.apache.camel/camel-leveldb/${project.version} > + > > camel-core > mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene/${lucene-bundle-version} > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2