My object is a String (a URI) that needs to be dynamically resolved as a reference (<reference>) and passed as a service property.

So if I correctly understood what you said, there's no way to do that with blueprint?
It worked with Aries but it's only by chance, isn't it?

Thanks again,
Regards,
David

Le 24/10/2011 15:55, Timothy Ward a écrit :
Hi,

It is allowed to use a component instance as a service property, however the following rules apply (from 121.6.6 of the enterprise specification)

Each service can optionally be registered with service properties. The serviceProperties is a list of MapEntry, see <entry> on page 236. This metadata must be used to create the service properties. Service properties creation can have side effects because they can use component instances. The service properties must therefore be created once before the first time the first time the service is registered.

....

Service properties should specify the valueType of the entry unless the value to be registered needs to
be a String object. The service property types should be one of:
• Primitives Number – int, long, float, double, byte, short, char, boolean
• Scalar – String, Integer, Long, Float, Double, Byte, Short, Character, Boolean.
• Array – An array of either the allowable primitive or scalar types.
• Collection – An object implementing the Collection interface that contains scalar types.


If your object is of any other type then it should be being turned into a String, which does indicate an issue with the blueprint container. On the other hand, it may not be possible to do what you actually want to do.

Aries blueprint will probably cope with some other property types as well (things that have a String constructor), but I couldn't give you a complete list.

Regards,

Tim


> Date: Mon, 24 Oct 2011 10:14:03 +0200
> From: david.fel...@scalagent.com
> To: user@aries.apache.org
> Subject: Service property assigned with a service reference
>
> Hi,
>
> when defining a service property with a reference as a value, the
> property is assigned with a ServiceProxyWrapper (inner class of
> ReferenceRecipe).
>
> Here is the way it is defined:
>
> <service ref="..." interface="...">
> <service-properties>
> <entry key="Property1">
> <ref component-id="serviceRef"/>
> </entry>
> </service-properties>
> </service>
>
> <reference id="serviceRef" interface="A" />
>
> I would have expected the service property "Property1" to be assigned
> with an instance of "A" instead of a ServiceProxyWrapper. However I
> could get the instance of "A" by calling the method 'convert' and
> passing a ReifiedType.
>
> I would like to know if defining such a service property (containing a
> <ref>) is correct according to Blueprint specification and Aries
> implementation?
>
> I would also like to know why the 'convert' has to be done explicitly?
>
> Thank you.
> Regards,
> David
>
>
>

Reply via email to