You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Rex Wang <rw...@gmail.com> on 2011/08/12 10:53:53 UTC

Does blueprint-cm support such syntax : ${a+b} ?

Hi devs,

I am wondering if Aries blueprint-cm support such scenario:

<cm:property-placeholder id="property-placeholder" persistent-id="o.a.b.com"
placeholder-prefix="${" placeholder-suffix="}">
        <cm:default-properties>
            <cm:property name="port" value="12345"/>
            <cm:property name="offset" value="10"/>
        </cm:default-properties>
</cm:property-placeholder>

<xxx:conn name="loc" uri="http://localhost:${port+offset}"/>


I have a test, but seems the ${port+offset} can not be replaced with value
"12355".

Any ideas?


-- 
Lei Wang (Rex)
rwonly AT apache.org

Re: Does blueprint-cm support such syntax : ${a+b} ?

Posted by Emily Jiang <em...@googlemail.com>.
When we support this, we need to perform a 'plus' or string concatenate
operation based on the variable type:).

Therefore. when specifying the property in the blueprint xml, the explicit
type should be specified if not string.
Regards,
Emily

On Fri, Aug 12, 2011 at 10:00 AM, Valentin Mahrwald <
vmahrwald@googlemail.com> wrote:

> Hi Rex,
>
> to my knowledge (substantiated with a quick code inspection) the
> placeholders in Aries today support no operators or arithmetic like that.
> But please do raise an Improvement JIRA for the future :)
>
> Regards,
>
> Valentin
>
> On 12 Aug 2011, at 09:53, Rex Wang wrote:
>
> > Hi devs,
> >
> > I am wondering if Aries blueprint-cm support such scenario:
> >
> > <cm:property-placeholder id="property-placeholder" persistent-id="
> o.a.b.com"
> > placeholder-prefix="${" placeholder-suffix="}">
> >        <cm:default-properties>
> >            <cm:property name="port" value="12345"/>
> >            <cm:property name="offset" value="10"/>
> >        </cm:default-properties>
> > </cm:property-placeholder>
> >
> > <xxx:conn name="loc" uri="http://localhost:${port+offset}"/>
> >
> >
> > I have a test, but seems the ${port+offset} can not be replaced with
> value
> > "12355".
> >
> > Any ideas?
> >
> >
> > --
> > Lei Wang (Rex)
> > rwonly AT apache.org
>
>


-- 
Thanks
Emily
=================
Emily Jiang
ejiang@apache.org

Re: Does blueprint-cm support such syntax : ${a+b} ?

Posted by Valentin Mahrwald <vm...@googlemail.com>.
Hi Rex,

to my knowledge (substantiated with a quick code inspection) the placeholders in Aries today support no operators or arithmetic like that. But please do raise an Improvement JIRA for the future :)

Regards,

Valentin

On 12 Aug 2011, at 09:53, Rex Wang wrote:

> Hi devs,
> 
> I am wondering if Aries blueprint-cm support such scenario:
> 
> <cm:property-placeholder id="property-placeholder" persistent-id="o.a.b.com"
> placeholder-prefix="${" placeholder-suffix="}">
>        <cm:default-properties>
>            <cm:property name="port" value="12345"/>
>            <cm:property name="offset" value="10"/>
>        </cm:default-properties>
> </cm:property-placeholder>
> 
> <xxx:conn name="loc" uri="http://localhost:${port+offset}"/>
> 
> 
> I have a test, but seems the ${port+offset} can not be replaced with value
> "12355".
> 
> Any ideas?
> 
> 
> -- 
> Lei Wang (Rex)
> rwonly AT apache.org


Re: Does blueprint-cm support such syntax : ${a+b} ?

Posted by David Jencks <da...@yahoo.com>.
I _think_ I wrote something like this for xbean-blueprint since it didn't look like blueprint supported it.  IIRC I used the same calculation engine as the geronimo config substitutions.  I think you can infer what kind of calculation to do (addition or concatenation) from the type of the property you end up setting.

thanks
david jencks

On Aug 12, 2011, at 1:53 AM, Rex Wang wrote:

> Hi devs,
> 
> I am wondering if Aries blueprint-cm support such scenario:
> 
> <cm:property-placeholder id="property-placeholder" persistent-id="o.a.b.com"
> placeholder-prefix="${" placeholder-suffix="}">
>        <cm:default-properties>
>            <cm:property name="port" value="12345"/>
>            <cm:property name="offset" value="10"/>
>        </cm:default-properties>
> </cm:property-placeholder>
> 
> <xxx:conn name="loc" uri="http://localhost:${port+offset}"/>
> 
> 
> I have a test, but seems the ${port+offset} can not be replaced with value
> "12355".
> 
> Any ideas?
> 
> 
> -- 
> Lei Wang (Rex)
> rwonly AT apache.org


Re: Does blueprint-cm support such syntax : ${a+b} ?

Posted by Rex Wang <rw...@gmail.com>.
Thank you all.

I opened https://issues.apache.org/jira/browse/ARIES-727 and uploaded a
patch to port David's code from xbean to Aries. It works for me, and would
be good if anyone could help review it. :-)

-Rex

2011/8/12 Rex Wang <rw...@gmail.com>

> Hi devs,
>
> I am wondering if Aries blueprint-cm support such scenario:
>
> <cm:property-placeholder id="property-placeholder" persistent-id="
> o.a.b.com" placeholder-prefix="${" placeholder-suffix="}">
>         <cm:default-properties>
>             <cm:property name="port" value="12345"/>
>             <cm:property name="offset" value="10"/>
>         </cm:default-properties>
> </cm:property-placeholder>
>
> <xxx:conn name="loc" uri="http://localhost:${port+offset}"/>
>
>
> I have a test, but seems the ${port+offset} can not be replaced with value
> "12355".
>
> Any ideas?
>
>
> --
> Lei Wang (Rex)
> rwonly AT apache.org
>



-- 
Lei Wang (Rex)
rwonly AT apache.org