You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jean-Sebastien Delfino <js...@apache.org> on 2007/03/13 21:24:30 UTC
Representation of Property default value
As part of the effort to componentize some of the Kernel I'm trying to
make sure that the representation of assembly metadata is independent of
XML and just came across this in o.a.t.spi.model.Property:
import org.w3c.dom.Document;
public Document getDefaultValue() {
return defaultValue;
}
This is going to be problematic when you're not loading the assembly
metadata from SCDL/XML, and looks less than ideal to me in other cases
where the defaultValue of the property is just a simple type, or
initialized from introspecting a component implementation artifact.
Any thoughts on a better way to represent a property value? Could we
leverage the databinding framework here to decouple the metadata from XML?
Thanks,
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Representation of Property default value
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Raymond Feng wrote:
> Hi,
>
> 1) For the canonical form, don't you think we have it with DOM?
>
> 2) In Java, you have three styles to define a property using @Property:
>
> * A public or protected field
> * A setter method
> * A parameter for the constructor
>
> I don't see Java C&I talks about how to supply the default value for a
> property. One thought is that the initial value for the holding field
> might do, such as:
>
> 1)
> @Property
> public String myProp="ABC";
>
> 2)
> private String myProp="ABC";
> @Property
> public void setMyProp(String value) {
> this.myProp=value;
> }
>
> 3)
> private String myProp="ABC";
> public MyServiceImpl(@Property(name="myProp") String value) {
> this.myProp=value;
> }
>
> For case 3, I'm not sure how do we pass in the "value" if no property
> value is provided by the component definition.
>
> Thanks,
> Raymond
>
For cases 2 and 3 the model probably does not need to capture the
default value so I don't have an issue with these cases.
For case 1, you're right DOM is a canonical form, but I'm concerned with
DOM in the following use cases, which I think are pretty common:
<property name="currency">USD</property>
Here I'd prefer to not have a DOM Document created for each string
property. How about just using a java.lang.String?
<property name="contract" file="/home/my-docs/big-contract-doc.xml"/>
Same concern with the big contract document file. We're going through a
great deal of effort to use streaming APIs to read SCDL files, so I'd
prefer to avoid DOM for these property files which IMO will usually be
bigger than any SCDL we can ever develop :) How about using a StAX
reader and/or SAX source?
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Representation of Property default value
Posted by Raymond Feng <en...@gmail.com>.
Hi,
1) For the canonical form, don't you think we have it with DOM?
2) In Java, you have three styles to define a property using @Property:
* A public or protected field
* A setter method
* A parameter for the constructor
I don't see Java C&I talks about how to supply the default value for a
property. One thought is that the initial value for the holding field might
do, such as:
1)
@Property
public String myProp="ABC";
2)
private String myProp="ABC";
@Property
public void setMyProp(String value) {
this.myProp=value;
}
3)
private String myProp="ABC";
public MyServiceImpl(@Property(name="myProp") String value) {
this.myProp=value;
}
For case 3, I'm not sure how do we pass in the "value" if no property value
is provided by the component definition.
Thanks,
Raymond
----- Original Message -----
From: "Jean-Sebastien Delfino" <js...@apache.org>
To: <tu...@ws.apache.org>
Sent: Tuesday, March 13, 2007 9:48 PM
Subject: Re: Representation of Property default value
> Raymond Feng wrote:
>> Hi,
>>
>> I don't think we can completely avoid XML because the property values are
>> provided as XML in the SCDL. But we could accomodate the various cases in
>> the model using a neutral way. I propose to use the following:
>>
>> DataType dataType; // Decribe the property type with databinding
>> Object defaultValue; // The default value for the property conforming
>> to its data type
>>
>> 1) For a property loaded from SCDL:
>> dataType (physical=org.w3c.dom.Document.class,
>> databinding="org.w3c.dom.Node")
>> defaultValue (an instance of org.w3c.dom.Document)
>>
>> 2) For a simple String property introspected from Java:
>> dataType(physical=java.lang.String.class,
>> databinding="java.lang.Object")
>> defaultValue(an instance of String, such as "123")
>>
>> 3) For a complex SDO (or JAXB) property introspected from Java:
>> dataType(physical=customer.Customer.class,
>> databinding="commonj.sdo.DataObject")
>> defaultValue(an instance of customer.Customer, a generated SDO class)
>>
>> Thanks,
>> Raymond
>>
>> ----- Original Message ----- From: "Jean-Sebastien Delfino"
>> <js...@apache.org>
>> To: <tu...@ws.apache.org>
>> Sent: Tuesday, March 13, 2007 1:24 PM
>> Subject: Representation of Property default value
>>
>>
>>> As part of the effort to componentize some of the Kernel I'm trying to
>>> make sure that the representation of assembly metadata is independent of
>>> XML and just came across this in o.a.t.spi.model.Property:
>>>
>>> import org.w3c.dom.Document;
>>>
>>> public Document getDefaultValue() {
>>> return defaultValue;
>>> }
>>>
>>> This is going to be problematic when you're not loading the assembly
>>> metadata from SCDL/XML, and looks less than ideal to me in other cases
>>> where the defaultValue of the property is just a simple type, or
>>> initialized from introspecting a component implementation artifact.
>>>
>>> Any thoughts on a better way to represent a property value? Could we
>>> leverage the databinding framework here to decouple the metadata from
>>> XML?
>>>
>>> Thanks,
>>>
>>> --
>>> Jean-Sebastien
>>>
>>>
>
> I'm not sure :)
>
> I guess we can do one of the following:
> - always represent the data as expected by the particular component
> implementation (but I'm not sure how this is going to work for
> constrainingTypes, which can be used to shape multiple components)
> - use a canonical form independent of the particular component
> implementation and the databinding it uses; this will allow admin tools
> for example to retrieve/update property values in a generic way,
> independent of the implementation type
> - have a mix like your cases 1/2/3 but then it's not ideal, as support for
> component implementations will need to know about the particular
> serializations of the assembly model, and other usages of the model like
> admin tools for example will need to know about the implementation types
> and the databindings that they're dragging along.
>
> Is there actually a way in SCA 1.0 to specify a default value using Java
> annotations? I know that the SCA assembly spec 1.0 allows for
> implementations to be configured without SCDL in general, but I can't find
> any annotations to support that in the Java C&I common annotation and
> component implementation specs. Did I miss them? or has this been pushed
> out of 1.0?
>
> Thanks,
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Representation of Property default value
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Raymond Feng wrote:
> Hi,
>
> I don't think we can completely avoid XML because the property values
> are provided as XML in the SCDL. But we could accomodate the various
> cases in the model using a neutral way. I propose to use the following:
>
> DataType dataType; // Decribe the property type with databinding
> Object defaultValue; // The default value for the property
> conforming to its data type
>
> 1) For a property loaded from SCDL:
> dataType (physical=org.w3c.dom.Document.class,
> databinding="org.w3c.dom.Node")
> defaultValue (an instance of org.w3c.dom.Document)
>
> 2) For a simple String property introspected from Java:
> dataType(physical=java.lang.String.class,
> databinding="java.lang.Object")
> defaultValue(an instance of String, such as "123")
>
> 3) For a complex SDO (or JAXB) property introspected from Java:
> dataType(physical=customer.Customer.class,
> databinding="commonj.sdo.DataObject")
> defaultValue(an instance of customer.Customer, a generated SDO class)
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jean-Sebastien Delfino"
> <js...@apache.org>
> To: <tu...@ws.apache.org>
> Sent: Tuesday, March 13, 2007 1:24 PM
> Subject: Representation of Property default value
>
>
>> As part of the effort to componentize some of the Kernel I'm trying
>> to make sure that the representation of assembly metadata is
>> independent of XML and just came across this in
>> o.a.t.spi.model.Property:
>>
>> import org.w3c.dom.Document;
>>
>> public Document getDefaultValue() {
>> return defaultValue;
>> }
>>
>> This is going to be problematic when you're not loading the assembly
>> metadata from SCDL/XML, and looks less than ideal to me in other
>> cases where the defaultValue of the property is just a simple type,
>> or initialized from introspecting a component implementation artifact.
>>
>> Any thoughts on a better way to represent a property value? Could we
>> leverage the databinding framework here to decouple the metadata from
>> XML?
>>
>> Thanks,
>>
>> --
>> Jean-Sebastien
>>
>>
I'm not sure :)
I guess we can do one of the following:
- always represent the data as expected by the particular component
implementation (but I'm not sure how this is going to work for
constrainingTypes, which can be used to shape multiple components)
- use a canonical form independent of the particular component
implementation and the databinding it uses; this will allow admin tools
for example to retrieve/update property values in a generic way,
independent of the implementation type
- have a mix like your cases 1/2/3 but then it's not ideal, as support
for component implementations will need to know about the particular
serializations of the assembly model, and other usages of the model like
admin tools for example will need to know about the implementation types
and the databindings that they're dragging along.
Is there actually a way in SCA 1.0 to specify a default value using Java
annotations? I know that the SCA assembly spec 1.0 allows for
implementations to be configured without SCDL in general, but I can't
find any annotations to support that in the Java C&I common annotation
and component implementation specs. Did I miss them? or has this been
pushed out of 1.0?
Thanks,
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Representation of Property default value
Posted by Raymond Feng <en...@gmail.com>.
Hi,
I don't think we can completely avoid XML because the property values are
provided as XML in the SCDL. But we could accomodate the various cases in
the model using a neutral way. I propose to use the following:
DataType dataType; // Decribe the property type with databinding
Object defaultValue; // The default value for the property conforming to
its data type
1) For a property loaded from SCDL:
dataType (physical=org.w3c.dom.Document.class,
databinding="org.w3c.dom.Node")
defaultValue (an instance of org.w3c.dom.Document)
2) For a simple String property introspected from Java:
dataType(physical=java.lang.String.class,
databinding="java.lang.Object")
defaultValue(an instance of String, such as "123")
3) For a complex SDO (or JAXB) property introspected from Java:
dataType(physical=customer.Customer.class,
databinding="commonj.sdo.DataObject")
defaultValue(an instance of customer.Customer, a generated SDO class)
Thanks,
Raymond
----- Original Message -----
From: "Jean-Sebastien Delfino" <js...@apache.org>
To: <tu...@ws.apache.org>
Sent: Tuesday, March 13, 2007 1:24 PM
Subject: Representation of Property default value
> As part of the effort to componentize some of the Kernel I'm trying to
> make sure that the representation of assembly metadata is independent of
> XML and just came across this in o.a.t.spi.model.Property:
>
> import org.w3c.dom.Document;
>
> public Document getDefaultValue() {
> return defaultValue;
> }
>
> This is going to be problematic when you're not loading the assembly
> metadata from SCDL/XML, and looks less than ideal to me in other cases
> where the defaultValue of the property is just a simple type, or
> initialized from introspecting a component implementation artifact.
>
> Any thoughts on a better way to represent a property value? Could we
> leverage the databinding framework here to decouple the metadata from XML?
>
> Thanks,
>
> --
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org