Return-Path: X-Original-To: apmail-incubator-deltaspike-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltaspike-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21E10DD05 for ; Thu, 12 Jul 2012 17:59:18 +0000 (UTC) Received: (qmail 59136 invoked by uid 500); 12 Jul 2012 17:59:18 -0000 Delivered-To: apmail-incubator-deltaspike-dev-archive@incubator.apache.org Received: (qmail 59108 invoked by uid 500); 12 Jul 2012 17:59:18 -0000 Mailing-List: contact deltaspike-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltaspike-dev@incubator.apache.org Delivered-To: mailing list deltaspike-dev@incubator.apache.org Received: (qmail 59099 invoked by uid 99); 12 Jul 2012 17:59:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 17:59:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rmannibucau@gmail.com designates 209.85.160.175 as permitted sender) Received: from [209.85.160.175] (HELO mail-gh0-f175.google.com) (209.85.160.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 17:59:12 +0000 Received: by ghbz2 with SMTP id z2so2518082ghb.6 for ; Thu, 12 Jul 2012 10:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=J1wbIspoeh+p9KKTCtLcxuY7OJH/lF/iopu7lyJSibg=; b=qj4PTmtEA2d/BaYMcbGbsAX9DYvNNXiyDZpAdpzFsILn1ekoSFLFMIxHu+AKJAm5Y0 p9uh1mNvm25HArwhLf3mDF0GJd2ziDyBKEaTC080wLG/QafOqxvwoaBeMKg3nCaYoobJ E/L7WRgZhSIEUF3CE8g8EJ2K/6xoqHOvfVAMQyfcRfWRy//C5SsCHWt1d0zcY5Xo6MV3 ZoA2FlwTpDyJ2Oyu/GgCKJa3c+Hywk2mVR29J9tfVR48ovws/WF4jJuAMP4XLzULJ/Qz ONT69Lh8NabkeJ0xzlNbcw9selzkug+jZA6A0ZzQ9HwOFVC0jA2VeMmPEyCZy5nl1EJo grdA== MIME-Version: 1.0 Received: by 10.68.130.163 with SMTP id of3mr2182225pbb.108.1342115930820; Thu, 12 Jul 2012 10:58:50 -0700 (PDT) Received: by 10.143.17.13 with HTTP; Thu, 12 Jul 2012 10:58:50 -0700 (PDT) Received: by 10.143.17.13 with HTTP; Thu, 12 Jul 2012 10:58:50 -0700 (PDT) In-Reply-To: <1342107236.35216.YahooMailNeo@web171505.mail.ir2.yahoo.com> References: <20120712123429.ADDB616405C@mx01.openknowledge.de> <1342105629.6964.YahooMailNeo@web171503.mail.ir2.yahoo.com> <1342107236.35216.YahooMailNeo@web171505.mail.ir2.yahoo.com> Date: Thu, 12 Jul 2012 19:58:50 +0200 Message-ID: Subject: Re: AW: Util class to find annotations in a class From: Romain Manni-Bucau To: Mark Struberg , deltaspike-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=047d7b15a7f34dd00804c4a5b7b7 --047d7b15a7f34dd00804c4a5b7b7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable No, i was thinking of sthg queryable easily by something else than class. Le 12 juil. 2012 17:34, "Mark Struberg" a =E9crit : > We have such a 'cache' already: AnnotatedType! > > Any Extension shall NOT use Class#getDeclaredBlah to scan for this info! > > LieGrue, > strub > > > > ----- Original Message ----- > > From: Romain Manni-Bucau > > To: deltaspike-dev@incubator.apache.org > > Cc: > > Sent: Thursday, July 12, 2012 5:09 PM > > Subject: Re: AW: Util class to find annotations in a class > > > > about it and more DS oriented: should a common cache be created? each > > extensions are browsing metamodel (classes of course but fields and > > methods!!!) and it is time expensive :s:s > > > > doing it only once with a good querying structure could save a lot of > time > > > > wdyt? > > > > - Romain > > > > > > 2012/7/12 Mark Struberg > > > >> +1 > >> > >> public void initCamelContext(@Observes ProcessAnnotatedType >> CamelContext> pat) {... > >> > >> for example. > >> > >> Doing another scan manually is really performance intense! > >> > >> > >> LieGrue, > >> strub > >> > >> > >> > >> PS: please don't do cross posts to multiple lists at the same time. > > just > >> confuses users ;) > >> > >> > >> > >> ----- Original Message ----- > >> > From: Arne Limburg > >> > To: "deltaspike-dev@incubator.apache.org" < > >> deltaspike-dev@incubator.apache.org>; > > "user@openwebbeans.apache.org" < > >> user@openwebbeans.apache.org> > >> > Cc: > >> > Sent: Thursday, July 12, 2012 2:37 PM > >> > Subject: AW: Util class to find annotations in a class > >> > > >> > Hi, > >> > > >> > can't you just listen to the ProcessAnnotatedType event, inspect > > it and > >> if > >> > you find an @EndpointInject i.e. add an @Inject to the AnnotatedTyp= e? > >> > > >> > Cheers, > >> > Arne > >> > > >> > -----Urspr=FCngliche Nachricht----- > >> > Von: Charles Moulliard [mailto:cmoulliard@gmail.com] > >> > Gesendet: Donnerstag, 12. Juli 2012 14:22 > >> > An: deltaspike-dev@incubator.apache.org; > user@openwebbeans.apache.org > >> > Betreff: Util class to find annotations in a class > >> > > >> > Hi, > >> > > >> > Is there a DeltaSpike or OpenWebbeans util class that I could use t= o > > scan > >> > classes and find annotations (which have been of course designed > > without > >> CDI in > >> > mind) and next inject them ? > >> > > >> > Camel provides @EndpointInject(uri or ref), @Produce(uri) and > @Consume > >> > annotations to inject Endpoint definition or > Producer/ConsumerTemplate > >> into > >> > CamelContext. > >> > > >> > We have to call getInjectionValue(type, uri, endpointRef, > >> injectionPointName, > >> > null, null) method of CamelPostProcessorHelper tevery time such > >> annotation is > >> > discovered o add such injected bean. Camel-guice, camel-spring and > >> > camel-blueprint projects proposes such impl (which is not CDI > >> compliant). I > >> > would like to implement this in camel-cdi (where we already have > > defined > >> a > >> > CamelInjector) and tries to find the best strategy. > >> > > >> > Is there something equivalent to what we have here in camel-guice ? > >> > > >> > bindAnnotationInjector(EndpointInject.class, > >> > EndpointInjector.class); where bindAnnotationInjector is a method o= f > >> this class > >> > GuiceyFruitModule and EndpointInjectorClass is the class containin= g > > the > >> code to > >> > find annotations wiithin a class > >> > > >> > public class EndpointInjector extends CamelPostProcessorHelper > > implements > >> > AnnotationMemberProvider { > >> > > >> > @Inject > >> > public EndpointInjector(CamelContext camelContext) { > >> > super(camelContext); > >> > } > >> > > >> > public Object provide(EndpointInject inject, TypeLiteral > >> > typeLiteral, Field field) { > >> > Class type =3D field.getType(); > >> > String injectionPointName =3D field.getName(); > >> > String uri =3D inject.uri(); > >> > String endpointRef =3D inject.ref(); > >> > > >> > return getInjectionValue(type, uri, endpointRef, > >> injectionPointName, > >> > null, null); > >> > } > >> > > >> > Regards, > >> > > >> > Apache Committer > >> > > >> > Blog : http://cmoulliard.blogspot.com > >> > Twitter : http://twitter.com/cmoulliard > >> > Linkedin : http://www.linkedin.com/in/charlesmoulliard > >> > Skype: cmoulliard > >> > > >> > > > --047d7b15a7f34dd00804c4a5b7b7--