Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 479DD1033A for ; Wed, 20 Nov 2013 07:43:26 +0000 (UTC) Received: (qmail 12766 invoked by uid 500); 20 Nov 2013 07:43:24 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 12658 invoked by uid 500); 20 Nov 2013 07:43:18 -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 12650 invoked by uid 99); 20 Nov 2013 07:43:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Nov 2013 07:43:16 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.179 as permitted sender) Received: from [209.85.223.179] (HELO mail-ie0-f179.google.com) (209.85.223.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Nov 2013 07:43:12 +0000 Received: by mail-ie0-f179.google.com with SMTP id x13so39989ief.38 for ; Tue, 19 Nov 2013 23:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=0kdxzd0tuqUBRBT6gh5Nu6YmeQt0I2bV+/VBDMkGjIo=; b=ygGREW4Z0xphFHDJIUdAG1zAFvJzkVGh1Iiqf/d6BVfjsaJlb0q/UxoR4va0BjvR36 fwvU11uG8r8bAlqOt3t8qoR5y/RGZh+vU4Jsa3wRHLM98QzTM8mrijUtcEJIfBwMx02c ItfYSea0B+36FK2CyRFQ9FdfdHHSVQQUHnSiYWi3ff8nRD5QULSJH2L4yrXIFMP+G/hQ rfCtCzW/HxZCej+EVTa+juLZBXFCboq55JH9BWGmt5kqd+zyQkg9QKKd8oc43Qwisf4e wioBOwDmUkG3n+IDDL9lO3GBfq5HCU09nJ+8cYFxX1rmLsghxL+8yD6U21Q5hUEb49EQ 9kLQ== X-Received: by 10.50.23.16 with SMTP id i16mr28529igf.50.1384933372014; Tue, 19 Nov 2013 23:42:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.89.103 with HTTP; Tue, 19 Nov 2013 23:42:31 -0800 (PST) In-Reply-To: References: From: Claus Ibsen Date: Wed, 20 Nov 2013 08:42:31 +0100 Message-ID: Subject: Re: CAMEL-6694 Getting hold of the Context ClassLoader from deep within To: dev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org You can implement CamelContextAware and have CamelContext injected. Though this only happens for services and whatnot Camel setup for you. Not sure if it the injection would happen for these classes you mention tho= ugh. On Wed, Nov 20, 2013 at 1:31 AM, Raul Kripalani wrote: > Hey guys, > > To solve CAMEL-6694, I'm having to enhance the constructors of the > CamelLogger and CamelLogProcessor to pass in either: > > - the ClassLoader of the Camel context (obtained with > CamelContext#getApplicationClassLoader) - or - > > - the Camel context itself, letting the constructors call > CamelContext#getApplicationClassLoader. > > This API change will percolate up to several other classes, such as: > > DeadLetterChannelBuilder > DefaultErrorHandlerBuilder > LoggingErrorHandlerBuilder > LoggingExceptionHandler > etc. > > I really dislike this solution, but I don't think there's another way to > get hold of the CamelContext. Or is there? Some clever trick I'm unaware = of? > > If there's no other way out, we should postpone this change until Camel > 3.0, where we're allowed to introduce API changes. Agree? > > P.S.: I've enhanced the ObjectHelper with a new method T > runWithClassLoader(ClassLoader cl, Callable callable). > > Thanks! > > *Ra=FAl Kripalani* > Apache Camel PMC Member & Committer | Enterprise Architect, Open Source > Integration specialist > http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani > http://blog.raulkr.net | twitter: @raulvk --=20 Claus Ibsen ----------------- Red Hat, Inc. Email: cibsen@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen