Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BCBA0EEA4 for ; Wed, 6 Mar 2013 14:25:51 +0000 (UTC) Received: (qmail 38155 invoked by uid 500); 6 Mar 2013 14:25:51 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 38049 invoked by uid 500); 6 Mar 2013 14:25:51 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 38038 invoked by uid 99); 6 Mar 2013 14:25:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 14:25:50 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.160.53 as permitted sender) Received: from [209.85.160.53] (HELO mail-pb0-f53.google.com) (209.85.160.53) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2013 14:25:45 +0000 Received: by mail-pb0-f53.google.com with SMTP id un1so6068736pbc.12 for ; Wed, 06 Mar 2013 06:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:message-id:in-reply-to:references:subject :x-mailer:mime-version:content-type:content-transfer-encoding :content-disposition; bh=RJXwdqTJ7FLshcRQMQs4mUfjlshmkNUgCIG85PAjPG4=; b=TWMTqXhSRgS9LDMpGLxqUKQvpR+HIjJKSx1l5yM1220U259AHlNROovYfiL5UESv1b k/UviS8SxsFtTZ2Zp374twbDOkcqIMCo2gwo+yVgofd13oqbM7s3h1Ntc11sfhoaMOnH Ly2a43iro3K2MQXNOfkrB+qaC6MaDdx4lPiMVFwEcrqFqhpvrv1X3F2MwybEzIS8EPss VFVNM9+FytXMcqERZ118jNzWCWuGcF8k1VVJZiRMPmfvvK9+A1fpLphbDeDPd2SYfxr/ YjPQyAYOKKQw1U0TsowR1Ra5Ey1GXOBEoezadEXo9TPgSE3a2YqP8M3Vn7ZMuDWCmTTP gBYQ== X-Received: by 10.68.201.194 with SMTP id kc2mr38348713pbc.27.1362579923751; Wed, 06 Mar 2013 06:25:23 -0800 (PST) Received: from [192.168.1.135] ([111.193.236.110]) by mx.google.com with ESMTPS id ol7sm31540490pbb.14.2013.03.06.06.25.21 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 06:25:22 -0800 (PST) Date: Wed, 6 Mar 2013 22:25:17 +0800 From: Willem jiang To: users@camel.apache.org Message-ID: <70CA86754A6D48A7916AA2D5776BFDA4@gmail.com> In-Reply-To: <1362557903469-5728645.post@n5.nabble.com> References: <1362557903469-5728645.post@n5.nabble.com> Subject: Re: Catch NoSuchComponentException in org.apache.camel.impl.CompositeRegistry#lookup X-Mailer: sparrow 1.6.4 (build 1176) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Yes, The CompositeRegistry should keep looking the registry and catch the= exception. I just fill a JIRA=5B1=5D for it. =5B1=5Dhttps://issues.apache.org/jira/browse/CAMEL-6135 =20 -- =20 Willem Jiang Red Hat, Inc. =46useSource is now part of Red Hat Web: http://www.fusesource.com =7C http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) = (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang =20 Weibo: =E5=A7=9C=E5=AE=81willem On Wednesday, March 6, 2013 at 4:18 PM, smokemaker wrote: > Hi, all=21 > =20 > =20 > I use Camel 2.10.3 in ServiceMix 4.5.0 > Could someone please explain how to use > org.apache.camel.impl.CompositeRegistry=3F =20 > I've got CamelContext, defined in bundle =22A=22 and want to dynamicall= y add to > it a registry for resolving components from bundle =22B=22. > 1. I get the context's registry: > =20 > Registry registry =3D camelContext().getRegistry(); > if (registry instanceof > org.apache.camel.impl.PropertyPlaceholderDelegateRegistry) > registry =3D > ((org.apache.camel.impl.PropertyPlaceholderDelegateRegistry)registry).g= etRegistry(); > 2. create registry for current bundle: > BlueprintContainerRegistry selfRegistry =3D new > BlueprintContainerRegistry(blueprintContainer); > 3. add selfRegistry to context's CompositeRegistry: > if (registry instanceof org.apache.camel.impl.CompositeRegistry) =7B > =20 > ((org.apache.camel.impl.CompositeRegistry)registry).addRegistry(selfReg= istry); > ---------------------- > Now, what we have in composite registry: > 1. OsgiServiceRegistry =5Bfor bundle A=5D > 2. BlueprintContainerRegistry =5Bfor bundle A=5D > 3. BlueprintContainerRegistry =5Bfor bundle B=5D > --------------------- > =20 > When trying to lookup component from bundle B I've got exception > org.osgi.service.blueprint.container.NoSuchComponentException > =20 > CompositeRegistry=23lookup just lookups iterating the rigistries it has= . And > gets exception on the second one (BlueprintContainerRegistry =5Bfor bun= dle > A=5D). > =20 > 1. Am I using CompositeRegistry not in proper way=3F > 2. If not, may be it's a bug and must be placed into the issue tracker=3F= To > fix it the exception must be caught in CompositeRegistry=23lookup > =20 > Thanks a lot=21 > =20 > =20 > =20 > =20 > =20 > =20 > -- > View this message in context: http://camel.465427.n5.nabble.com/Catch-N= oSuchComponentException-in-org-apache-camel-impl-CompositeRegistry-lookup= -tp5728645.html > Sent from the Camel - Users mailing list archive at Nabble.com (http://= Nabble.com).