You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cbuxbaum <cb...@tradestonesoftware.com> on 2013/09/19 19:41:14 UTC

cast of property value for blueprint osgi implementation

Hi all,

I am migrating an application from Spring dsl to blueprint.

This worked previously:

    	<bean id="webServiceRequestCreator"
class="com.tradestonesoftware.aiConverter.service.WebServiceRequestCreator">
    		<property name="extractall" value="${aiextractor.extractall}"/>
"/>
    	</bean>

in conjunction with this bean method:

	public void setExtractall(boolean extractall)
	{
		this.extractall = extractall;
	}

So the value was being converted to a boolean with some built in type
converter.

With the blueprint version, I get this error when I try to deploy:

org.osgi.service.blueprint.container.ComponentDefinitionException: Error
setting property: PropertyDescriptor <name: extractall, getter: null,
setter: [class
com.tradestonesoftware.aiConverter.service.WebServiceRequestCreator.setExtractall(boolean)]
	at
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)
.
.
.
Caused by: java.lang.RuntimeException: Invalid boolean value:
${aiextractor.extractall}

Does this mean that I have to modify my beans to always use Strings and do
my own Boolean.parseBoolean(String) on the input?  Or is there a way to
invoke a converter?

Thanks,

Carl




--
View this message in context: http://camel.465427.n5.nabble.com/cast-of-property-value-for-blueprint-osgi-implementation-tp5739834.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cast of property value for blueprint osgi implementation

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah I would assume that too with standard blueprint CM could do that.

Just to be sure the value of aiextractor.extractall is that either
true or false? eg so the text is convertable to a boolean type?


On Fri, Sep 20, 2013 at 3:39 PM, cbuxbaum
<cb...@tradestonesoftware.com> wrote:
> Hi Claus,
>
> Yes, sorry, I ommitted that my message.  I have this:
>
>    <cm:property-placeholder
> persistent-id="com.tradestonesoftware.aiextractor">
>    </cm:property-placeholder>
>
> and /etc/com.tradestonesoftware.aiextractor.cfg
>
> However, even without that in place, I would have thought that the type of
> the variable would have been converted to a boolean, and would have come in
> as false since the String value was not "true".  I think I can get this to
> work by changing my setter methods to always take String, but was hoping
> this was not necessary, as it works fine using Spring DSL.
>
> Thanks,
>
> Carl
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cast-of-property-value-for-blueprint-osgi-implementation-tp5739834p5739874.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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

Re: cast of property value for blueprint osgi implementation

Posted by cbuxbaum <cb...@tradestonesoftware.com>.
Hi Claus,

Yes, sorry, I ommitted that my message.  I have this:

   <cm:property-placeholder
persistent-id="com.tradestonesoftware.aiextractor">
   </cm:property-placeholder>

and /etc/com.tradestonesoftware.aiextractor.cfg

However, even without that in place, I would have thought that the type of
the variable would have been converted to a boolean, and would have come in
as false since the String value was not "true".  I think I can get this to
work by changing my setter methods to always take String, but was hoping
this was not necessary, as it works fine using Spring DSL.

Thanks,

Carl



--
View this message in context: http://camel.465427.n5.nabble.com/cast-of-property-value-for-blueprint-osgi-implementation-tp5739834p5739874.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cast of property value for blueprint osgi implementation

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Did you setup blueprint property placeholders? You would need to do
that for it to understand and support ${ }.

You can see some details here
http://camel.apache.org/using-propertyplaceholder.html

And also if you google for blueprint cm or blueprint config admin to
find some links for more details.


On Thu, Sep 19, 2013 at 7:41 PM, cbuxbaum
<cb...@tradestonesoftware.com> wrote:
> Hi all,
>
> I am migrating an application from Spring dsl to blueprint.
>
> This worked previously:
>
>         <bean id="webServiceRequestCreator"
> class="com.tradestonesoftware.aiConverter.service.WebServiceRequestCreator">
>                 <property name="extractall" value="${aiextractor.extractall}"/>
> "/>
>         </bean>
>
> in conjunction with this bean method:
>
>         public void setExtractall(boolean extractall)
>         {
>                 this.extractall = extractall;
>         }
>
> So the value was being converted to a boolean with some built in type
> converter.
>
> With the blueprint version, I get this error when I try to deploy:
>
> org.osgi.service.blueprint.container.ComponentDefinitionException: Error
> setting property: PropertyDescriptor <name: extractall, getter: null,
> setter: [class
> com.tradestonesoftware.aiConverter.service.WebServiceRequestCreator.setExtractall(boolean)]
>         at
> org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)
> .
> .
> .
> Caused by: java.lang.RuntimeException: Invalid boolean value:
> ${aiextractor.extractall}
>
> Does this mean that I have to modify my beans to always use Strings and do
> my own Boolean.parseBoolean(String) on the input?  Or is there a way to
> invoke a converter?
>
> Thanks,
>
> Carl
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cast-of-property-value-for-blueprint-osgi-implementation-tp5739834.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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