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 43A89D412 for ; Thu, 12 Jul 2012 15:16:11 +0000 (UTC) Received: (qmail 75041 invoked by uid 500); 12 Jul 2012 15:16:10 -0000 Delivered-To: apmail-incubator-deltaspike-dev-archive@incubator.apache.org Received: (qmail 74927 invoked by uid 500); 12 Jul 2012 15:16:10 -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 74907 invoked by uid 99); 12 Jul 2012 15:16:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 15:16:09 +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 cmoulliard@gmail.com designates 74.125.83.47 as permitted sender) Received: from [74.125.83.47] (HELO mail-ee0-f47.google.com) (74.125.83.47) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2012 15:16:04 +0000 Received: by eeit10 with SMTP id t10so200492eei.6 for ; Thu, 12 Jul 2012 08:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=cnPjH44dheU6+8NI/kWcXLvUIv4hlB0+FsWSsM1jCqc=; b=hSzVn0koYjteD/ATGZbo0omz+2u8q8C7r83nYrPRBlXbBVFD5VlPaTu3DcjwbvHLjC zj3JfDLICGL+5UFSMoHZLcfQskKx9yTCdLdBHlQnpN8JuEAi2vsWEJTBs6ImRtcWt7BV OwBVrVT8hXWvztuhaKHMQictlIm0bNW3tgnKn1JgOkZOIMIKVgi/kDj2JsrjylSHdQhj NJ6QVlnnqw4fXnqyGjHeZB9piwNT+P4Uc/htxugtvzlWp4787KgemtEodUDwbMeMAs6X ZVRMgwhFrEzvMWKOiaZ03IP4jOY0lD7mxKb57FCVxGrNtHJvxfbSxAbttxUNuTNu85Do NAbA== Received: by 10.14.37.2 with SMTP id x2mr13110184eea.72.1342106143323; Thu, 12 Jul 2012 08:15:43 -0700 (PDT) Received: from Progresss-MacBook-Pro.local (ip-83-134-63-75.dsl.scarlet.be. [83.134.63.75]) by mx.google.com with ESMTPS id z16sm16480743eef.16.2012.07.12.08.15.40 (version=SSLv3 cipher=OTHER); Thu, 12 Jul 2012 08:15:41 -0700 (PDT) Message-ID: <4FFEEA1B.40103@gmail.com> Date: Thu, 12 Jul 2012 17:15:40 +0200 From: Charles Moulliard User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: deltaspike-dev@incubator.apache.org Subject: Re: AW: Util class to find annotations in a class References: <20120712123429.ADDB616405C@mx01.openknowledge.de> <1342105629.6964.YahooMailNeo@web171503.mail.ir2.yahoo.com> In-Reply-To: <1342105629.6964.YahooMailNeo@web171503.mail.ir2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Mark. Do you suggest to create a class implementing extension like we do for CDI SPI ? ProcessAnnotatedType On 12/07/12 17:07, Mark Struberg wrote: > +1 > > public void initCamelContext(@Observes ProcessAnnotatedType 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"; "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 AnnotatedType? >> >> Cheers, >> Arne >> >> -----Urspr�ngliche 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 to 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 of this class >> GuiceyFruitModule and EndpointInjectorClass is the class containing 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 = field.getType(); >> String injectionPointName = field.getName(); >> String uri = inject.uri(); >> String endpointRef = 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 >>