karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Nierbeck <bcanh...@googlemail.com>
Subject Re: Inject constructor using Blueprint
Date Tue, 25 Jun 2013 14:44:54 GMT
Hi Charles,

isn't it something like this:

 <bean id="accountOne" class="org.apache.aries.simple.Account">
       <argument value="1"/>
   </bean>

regards, Achim




2013/6/25 Charles Moulliard <ch007m@gmail.com>

> Maybe a Karaf guy could answer to my question ?
>
> ---------- Forwarded message ----------
> From: Charles Moulliard <ch007m@gmail.com>
> Date: Tue, Jun 25, 2013 at 8:15 AM
> Subject: Inject constructor using Blueprint
> To: dev@aries.apache.org
>
>
> Hi,
>
> Aries Blueprint project allows to inject constructors parameters using
> BeanArgumentImpl. Here is an example of such usage :
>
>         BeanMetadataImpl beanMetadata = (BeanMetadataImpl)
> context.createMetadata(BeanMetadata.class);
>         beanMetadata.setClassName("org.mycompany.MyFactoryBean");
>         beanMetadata.setFactoryMethod("doSomething");
>         beanMetadata.setId(id);
>
>         BeanArgumentImpl argument = new BeanArgumentImpl();
>         argument.setIndex(0);
>         argument.setValue(createValue(context, id));
>         beanMetadata.addArgument(argument);
>
> Unfortunately, with release 1.0 of Apache Blueprint, this class has been
> packaged with blueprint - parser which is a jar and not a bundle and even
> if I use wrap to generate a bundle, it cannot be used as such as we get on
> Apache Karaf a classcast exception
>
> java.lang.ClassCastException:
> org.apache.aries.blueprint.reflect.BeanMetadataImpl cannot be cast to
> org.apache.aries.blueprint.reflect.BeanMetadataImpl
> at
>
> org.kie.aries.blueprint.namespace.ReleaseIdElementParser.parseElement(ReleaseIdElementParser.java:47)[120:org.kie.aries.blueprint:6.0.0.20130624-2122]
>
> Question : How can we inject constructors parameters with Aries Blueprint
> 1.0 without using classes packaged under blueprint-parser ?
>
> Regards,
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>
>
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message