You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Venkata Krishnan <fo...@gmail.com> on 2006/09/19 19:54:52 UTC

Queries related to Component Property Loading

Hi Jeremy / Raymond,

The context of my queries relate to the phase of loading Property and
PropertyValues by reading the componentType info and the component
definitions and then populating the spi model classes - Property and
PropertyValue respectively.

1) I find that the DefaultValue in the class Property is supposed to be
present as a Document instance.  However I do not find any child elements to
this Document - i.e. it is an empty document.  Here is the code snippet and
the fix I am imagining :)

public static Document createPropertyValue(XMLStreamReader reader,
                                               QName type,
                                               DocumentBuilder builder)
throws XMLStreamException {
        Document doc = builder.newDocument();

        // root element has no namespace and local name "value"
        Element root = doc.createElementNS(null, "value");
        loadPropertyValue(reader, root);

        //Added by Venkat for this mail : should the following line be added
to fix this problem.
        doc.appendChild(root);

        return doc;
    }

Is this a right fix?  Otherwise what am I missing here?

2) Assuming the DefaultValue is available in its Document form in the
implementation (say javascript or ruby container impl), I would need to
convert it to Java Object and from it to data that javascript / ruby can
understand.  I imagine that I must be using the DataBinding framework /
service here for this conversion.  How will this be made available to the
implementation - as a autowired service or just as framework whos classes I
must instantiate and use appropriately?  Is there a transformer in the
databinding framework to convert between Document to Java (something like
OMElement2Java or Java2OMElement) ?

3) In the ComponentLoader where PropertyValue instances are created (as a
result of property specification in the component defn) why can't it be that
'PropertyValue' instances are first created for all 'Property' instances as
found in the componentType.  Then the values are set either to whatever is
specified for value in the component definition or to whatever is available
in  'DefaultValue' attribute of the Property class.  So,  when the component
builders are called, the component defn. instances that are passed will be
already populated with property values.  Is this thinking right?  Again over
here, to convert the values specified in the component defns. I guess we
should employ the databinding framework - right?

4) In the current implementation of ComponentLoader, while create a
PropertyValue the 'JavaType' attribute of the property seems to be required
so that the right object factories can be created.  However this JavaType
attribute is never set and this results in a NPE.  I guess if the
databinding framework is going to be used here to convert Document data to
java objects this problem would be resolved - is this right?

5) Finally (if you have managed to bear with me until this point :)), why is
it that I must deal with an object factory to get a property value.  Can I
not be allowed to simply access it as 'propertyValue.getValue()'.  Now it
seems like I must do a propertyValue.getValueFactory().getInstance() to get
the value of a property.   Why?

Thanks a ton.

- Venkat

Re: Queries related to Component Property Loading

Posted by Jim Marino <jm...@myromatours.com>.
On Sep 25, 2006, at 11:58 PM, Raymond Feng wrote:

>
>> - After all properties defined in the scdl have been loaded, the  
>> list of
>> properties in the component type will be checked to see if there  
>> is any
>> property who 'override' attribute is 'must' and is not defined as  
>> part of
>> the component defn.  If there exists one then an exception is thrown
>
> I think this validation step can only be done at "build" phase, right?
>
Why can it only be done during build? This should be part of the load  
phase. The build phase constructs the runtime artifacts

>> - I understand that the value of component properties will also be  
>> defined
>> as xml similar to how the default values are defined in the  
>> component type
>> file i.e. property values will also be xml document fragments
>
> The current code doesn't handle the property value correctly. The  
> SCA spec defines the following syntax:
>
> <property name="xs:NCName" source="xs:string"? file="xs:anyURI"?>*
>    property-value
> </property>
>
> The spec takes the order as "source", "file" and content-value.
>
> The property value will represented by a DOM Document which can be  
> evaluated against the composite property by XPath, loaded from the  
> file URI, or parsed from the current StAX reader. Can the XPath  
> evaluation be done at "load" phase? I have the code for the XPath  
> part.
>
>>    - Each property has an xml type specified, but where do we  
>> locate the
>> xsd for this type?
>
> Maybe we can start with "xsi:schemaLocation". By the spec, the  
> "type" is required. Should we add an attribute to @Property for  
> xmlType? For simple types, we can use Java2XML mapping in  
> SimpleTypeMapperExtension.
>
Just to make sure of one thing here, we should not require a schema  
for complex types. Certain data bindings may need it but other's  
(e.g. XStream) don't and we need to accommodate both styles as  
plugins to the data binding framework.

> The current code uses "StAXPropertyFactory" to create the target  
> property value (for simple types). I have created a Databinding- 
> based property factory which knows how to create the value out of  
> the DOM Document.
>
>> - The property value as an xml document will be passed to the
>> ComponentBuilders (js component builder, ruby component  
>> builder...) which
>> will handle the logic of transforming them into data forms that  
>> can be
>> injected into the implementations (javascript, rubyscript...).
>
> I'm thinking of adding the following "build" logic to  
> ComponentBuilderExtension.
>
> For each property in the component type, we either use the default  
> value (override="no" or override="may" but no property value is  
> found), or the configured value from the property value  
> (override="must" or override="may" and a matching property is  
> found) to create an instance of ObjectFactory which knows how to  
> transform the DOM Node into the target type using our DataBinding  
> support).
>
Yes, but to clarify, "knows" means it delegates to the data binding  
framework, right?

> The JavaComponentBuilder will inject the property values into the  
> target POJO instance. Other component builders may have their own  
> way to pass properties to their implementations.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond,

I have submitted a patch in the following JIRA.

 http://issues.apache.org/jira/browse/TUSCANY-773

Please take a look and let me know if I should clarify anything.

Thanks.

- Venkat

On 10/2/06, Raymond Feng <en...@gmail.com> wrote:
>
> Hi, Venkata.
>
> Please post a patch to the JIRA and I can help you review and apply it.
> Incremental changes are good and we can go step by step.
>
> Thanks,
> Raymond
>
>
> ----- Original Message -----
> From: "Venkata Krishnan" <fo...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Monday, October 02, 2006 5:52 AM
> Subject: Re: Queries related to Component Property Loading
>
>
> > Hi Jim / Raymond,
> >
> > I have completed this... atleast from my little world of understand.  I
> > shall post the patch onto a JIRA.  Meanwhile here is a summary that
> gives
> > an
> > idea of the changes that I have made.  I have successfully tried a test
> > with
> > a component like this...
> >
> > <component name="HelloWorldJavaReference">
> >        <implementation.java class="helloworld.HelloWorldServiceImpl"/>
> >        <property name="greeting">
> >            Hullow
> >        </property>
> >        <property name="helloSayer">
> >            <firstName>Tuscany</firstName>
> >            <lastName>World</lastName>
> >        </property>
> > </component>
> >
> >
> > Here are the changes that I have done.
> >
> > org.apache.tuscany.spi.model.Property
> > --------------------------------------
> > - I have included an attribute called 'override' that will take one of
> the
> > following values (may, must, no)
> > - I have removed the attribute 'required' (I suppose this is now
> addressed
> > under the attribute 'override')
> >
> > org.apache.tuscany.spi.model.PropertyValue
> > ------------------------------------------
> > - I have added an attribute called 'valueDocument' that will contain the
> > value specified for a property in a component definition in the scdl
> >
> > org.osoa.sca.annotations.Property
> > ---------------------------------
> > - removed the attribute 'required'
> > - added attributes 'overideOptions' and 'xmlType'
> >
> >
> > org.apache.tuscany.core.loader.PropertyLoader
> > ---------------------------------------------
> > This class handles the loading of properties from a componentType file
> > - just about replaced 'required' with 'overide'.
> >
> > org.apache.tuscany.core.loader.ComponentLoader
> > ----------------------------------------------
> > This is the class that loads the component defn. from a scdl
> > - The existing behaviour of creating the appropriate ObjectFactory as
> and
> > when the property element is being loaded and setting it to an instance
> of
> > PropertyValue has now been pushed to Builders. Instead the property
> value
> > specified in the scdl is loaded as a Document and set to an instance of
> > PropertyValue class. I have pushed the ObjectFactory creation to
> Builders
> > because it they who know how to map a Document data to data that could
> be
> > understood by the implementation that they build.
> >
> >
> > org.apache.tuscany.core.implementation.java.JavaComponentBuilder
> > ----------------------------------------------------------------
> > This is the java builder that will handle the conversion of the property
> > value from Document form to a form that could be understood by the Java
> > Implementation (i.e. Java Types).  I guess the builders of other
> > containers
> > such as groovy, javascript, ruby will have to do something similar to
> suit
> > groovy, javascript, rubyscript respectively.
> > - Here I have used the approach that assumes the following : -
> >     - that the java classes that represent properties have a default
> > constructor
> >     - the name of elements in the document that represents the property
> > values maps with the field names (for example if there is a complex
> > property
> > Customer that has elements firstName and lastName, then it is expected
> > that
> > the corresponding java class has fields with names as firstName,
> lastName)
> >
> > - the approach as such is an obvious.  First, since the impl class in
> > known,
> > I access from it a field whose name matches the property name in the
> > component defn.  Starting from here I reflect recursively into this
> field
> > class as I navigate the property value document and set the value to the
> > field all along.
> > -  at the end of this recursion I obtain an instance of the property,
> > using
> > which I create the object factory and set it into the map.
> >
> > Concerns
> > --------------
> > Here are some concerns that are outstanding despite this...
> > *)  I am unable to use the .componentType file.  If I used one then I
> get
> > the following exception:
> > org.apache.tuscany.spi.loader.UnrecognizedElementException: {
> > http://www.osoa.org/xmlns/sca/1.0}componentType [{
> > http://www.osoa.org/xmlns/sca/1.0}componentType]
> > Context stack trace: [application][HelloWorldJavaReference]
> >    at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(
> > LoaderRegistryImpl.java:113)
> >
> > Looks like there is problem if I mention JavaComponentType.class in the
> > load
> > method.  I guess this because all othere containers  have worked around
> > this
> > aspect.
> >
> > Am I missing something here?
> >
> > *)  When I initially clipped the existing property value loading
> behaviour
> > in the ComponentLoader, the system components could never get
> initialized.
> > To go forward with this, I decided to address only application
> components.
> > To this end, I retained the existing behaviour when the component is a
> > SystemImplementation and changed it for other cases.   I am not clear
> > about
> > the direction for this.
> >
> > Thanks for patiently reading upto this point. :)
> >
> > - Venkat
> >
> >
> > On 10/2/06, Venkata Krishnan <fo...@gmail.com> wrote:
> >>
> >> Hi Jim,
> >>
> >> I was going to touch upon that once I completed and posted a patch for
> >> review.
> >>
> >> I initially assumed that since our runtime was in Java, the
> >> implementation.system components would just about use the Java
> container.
> >> However I observed that they never touched the JavaComponentBuilder.
> >> Also I
> >> observed that for system components there were properties that were
> >> getting
> >> configured, loaded and built - meaning the property hanlding seemed to
> be
> >> in
> >> place (atleast to the extent that things are working).
> >>
> >>  In the interest of not disrupting too many things I have chosen to
> leave
> >> the system components alone - atleast in this iteration.  The
> >> ComponentLoader is however used while loading all components (system or
> >> application) and this is one place I have had to make some changes to
> the
> >> existing behaviour.  For this I have chosen the apporach of retaining
> the
> >> existing behaviour whe loading SytemImplementation components and have
> >> put
> >> in an alternate behaviour for all others.
> >>
> >> After I have done with this iteration, I can probably take up the case
> of
> >> system components with some help from you / jeremy if at all they also
> >> need
> >> to change.
> >>
> >> Thanks
> >>
> >> - Venkat
> >>
> >>
> >>
> >> On 10/1/06, Jim Marino <jm...@myromatours.com> wrote:
> >> >
> >> > Hi Venkat,
> >> >
> >> > One thing I wanted to make sure about below...
> >> >
> >> > On Oct 1, 2006, at 10:27 AM, Venkata Krishnan wrote:
> >> >
> >> > > Hi Raymond,
> >> > >
> >> > > Just to keep you updated.  I am working on this and have been able
> >> > > to get
> >> > > the simple type property working.  i.e. properties are loaded
> >> > > properly from
> >> > > scdl.   Then I have made some changes to the JavaComponentBuilder
> >> > > to build
> >> > > from these loaded properties.
> >> > Shouldn't any changes for loading properties also apply to system
> >> > services as well?
> >> > >
> >> > > Right now I am trying to see if there is a scheme to get the
> complex
> >> > > properties working as well.  Hope I am able to post something off
> by
> >> > > tomorrow for some review and discussion.  Thanks
> >> > >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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: Queries related to Component Property Loading

Posted by Raymond Feng <en...@gmail.com>.
Hi, Venkata.

Please post a patch to the JIRA and I can help you review and apply it. 
Incremental changes are good and we can go step by step.

Thanks,
Raymond


----- Original Message ----- 
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Monday, October 02, 2006 5:52 AM
Subject: Re: Queries related to Component Property Loading


> Hi Jim / Raymond,
>
> I have completed this... atleast from my little world of understand.  I
> shall post the patch onto a JIRA.  Meanwhile here is a summary that gives 
> an
> idea of the changes that I have made.  I have successfully tried a test 
> with
> a component like this...
>
> <component name="HelloWorldJavaReference">
>        <implementation.java class="helloworld.HelloWorldServiceImpl"/>
>        <property name="greeting">
>            Hullow
>        </property>
>        <property name="helloSayer">
>            <firstName>Tuscany</firstName>
>            <lastName>World</lastName>
>        </property>
> </component>
>
>
> Here are the changes that I have done.
>
> org.apache.tuscany.spi.model.Property
> --------------------------------------
> - I have included an attribute called 'override' that will take one of the
> following values (may, must, no)
> - I have removed the attribute 'required' (I suppose this is now addressed
> under the attribute 'override')
>
> org.apache.tuscany.spi.model.PropertyValue
> ------------------------------------------
> - I have added an attribute called 'valueDocument' that will contain the
> value specified for a property in a component definition in the scdl
>
> org.osoa.sca.annotations.Property
> ---------------------------------
> - removed the attribute 'required'
> - added attributes 'overideOptions' and 'xmlType'
>
>
> org.apache.tuscany.core.loader.PropertyLoader
> ---------------------------------------------
> This class handles the loading of properties from a componentType file
> - just about replaced 'required' with 'overide'.
>
> org.apache.tuscany.core.loader.ComponentLoader
> ----------------------------------------------
> This is the class that loads the component defn. from a scdl
> - The existing behaviour of creating the appropriate ObjectFactory as and
> when the property element is being loaded and setting it to an instance of
> PropertyValue has now been pushed to Builders. Instead the property value
> specified in the scdl is loaded as a Document and set to an instance of
> PropertyValue class. I have pushed the ObjectFactory creation to Builders
> because it they who know how to map a Document data to data that could be
> understood by the implementation that they build.
>
>
> org.apache.tuscany.core.implementation.java.JavaComponentBuilder
> ----------------------------------------------------------------
> This is the java builder that will handle the conversion of the property
> value from Document form to a form that could be understood by the Java
> Implementation (i.e. Java Types).  I guess the builders of other 
> containers
> such as groovy, javascript, ruby will have to do something similar to suit
> groovy, javascript, rubyscript respectively.
> - Here I have used the approach that assumes the following : -
>     - that the java classes that represent properties have a default
> constructor
>     - the name of elements in the document that represents the property
> values maps with the field names (for example if there is a complex 
> property
> Customer that has elements firstName and lastName, then it is expected 
> that
> the corresponding java class has fields with names as firstName, lastName)
>
> - the approach as such is an obvious.  First, since the impl class in 
> known,
> I access from it a field whose name matches the property name in the
> component defn.  Starting from here I reflect recursively into this field
> class as I navigate the property value document and set the value to the
> field all along.
> -  at the end of this recursion I obtain an instance of the property, 
> using
> which I create the object factory and set it into the map.
>
> Concerns
> --------------
> Here are some concerns that are outstanding despite this...
> *)  I am unable to use the .componentType file.  If I used one then I get
> the following exception:
> org.apache.tuscany.spi.loader.UnrecognizedElementException: {
> http://www.osoa.org/xmlns/sca/1.0}componentType [{
> http://www.osoa.org/xmlns/sca/1.0}componentType]
> Context stack trace: [application][HelloWorldJavaReference]
>    at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(
> LoaderRegistryImpl.java:113)
>
> Looks like there is problem if I mention JavaComponentType.class in the 
> load
> method.  I guess this because all othere containers  have worked around 
> this
> aspect.
>
> Am I missing something here?
>
> *)  When I initially clipped the existing property value loading behaviour
> in the ComponentLoader, the system components could never get initialized.
> To go forward with this, I decided to address only application components.
> To this end, I retained the existing behaviour when the component is a
> SystemImplementation and changed it for other cases.   I am not clear 
> about
> the direction for this.
>
> Thanks for patiently reading upto this point. :)
>
> - Venkat
>
>
> On 10/2/06, Venkata Krishnan <fo...@gmail.com> wrote:
>>
>> Hi Jim,
>>
>> I was going to touch upon that once I completed and posted a patch for
>> review.
>>
>> I initially assumed that since our runtime was in Java, the
>> implementation.system components would just about use the Java container.
>> However I observed that they never touched the JavaComponentBuilder. 
>> Also I
>> observed that for system components there were properties that were 
>> getting
>> configured, loaded and built - meaning the property hanlding seemed to be 
>> in
>> place (atleast to the extent that things are working).
>>
>>  In the interest of not disrupting too many things I have chosen to leave
>> the system components alone - atleast in this iteration.  The
>> ComponentLoader is however used while loading all components (system or
>> application) and this is one place I have had to make some changes to the
>> existing behaviour.  For this I have chosen the apporach of retaining the
>> existing behaviour whe loading SytemImplementation components and have 
>> put
>> in an alternate behaviour for all others.
>>
>> After I have done with this iteration, I can probably take up the case of
>> system components with some help from you / jeremy if at all they also 
>> need
>> to change.
>>
>> Thanks
>>
>> - Venkat
>>
>>
>>
>> On 10/1/06, Jim Marino <jm...@myromatours.com> wrote:
>> >
>> > Hi Venkat,
>> >
>> > One thing I wanted to make sure about below...
>> >
>> > On Oct 1, 2006, at 10:27 AM, Venkata Krishnan wrote:
>> >
>> > > Hi Raymond,
>> > >
>> > > Just to keep you updated.  I am working on this and have been able
>> > > to get
>> > > the simple type property working.  i.e. properties are loaded
>> > > properly from
>> > > scdl.   Then I have made some changes to the JavaComponentBuilder
>> > > to build
>> > > from these loaded properties.
>> > Shouldn't any changes for loading properties also apply to system
>> > services as well?
>> > >
>> > > Right now I am trying to see if there is a scheme to get the complex
>> > > properties working as well.  Hope I am able to post something off by
>> > > tomorrow for some review and discussion.  Thanks
>> > >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Jim / Raymond,

I have completed this... atleast from my little world of understand.  I
shall post the patch onto a JIRA.  Meanwhile here is a summary that gives an
idea of the changes that I have made.  I have successfully tried a test with
a component like this...

<component name="HelloWorldJavaReference">
        <implementation.java class="helloworld.HelloWorldServiceImpl"/>
        <property name="greeting">
            Hullow
        </property>
        <property name="helloSayer">
            <firstName>Tuscany</firstName>
            <lastName>World</lastName>
        </property>
 </component>


Here are the changes that I have done.

org.apache.tuscany.spi.model.Property
--------------------------------------
- I have included an attribute called 'override' that will take one of the
following values (may, must, no)
- I have removed the attribute 'required' (I suppose this is now addressed
under the attribute 'override')

org.apache.tuscany.spi.model.PropertyValue
------------------------------------------
- I have added an attribute called 'valueDocument' that will contain the
value specified for a property in a component definition in the scdl

org.osoa.sca.annotations.Property
---------------------------------
- removed the attribute 'required'
- added attributes 'overideOptions' and 'xmlType'


org.apache.tuscany.core.loader.PropertyLoader
---------------------------------------------
This class handles the loading of properties from a componentType file
- just about replaced 'required' with 'overide'.

org.apache.tuscany.core.loader.ComponentLoader
----------------------------------------------
This is the class that loads the component defn. from a scdl
- The existing behaviour of creating the appropriate ObjectFactory as and
when the property element is being loaded and setting it to an instance of
PropertyValue has now been pushed to Builders. Instead the property value
specified in the scdl is loaded as a Document and set to an instance of
PropertyValue class. I have pushed the ObjectFactory creation to Builders
because it they who know how to map a Document data to data that could be
understood by the implementation that they build.


org.apache.tuscany.core.implementation.java.JavaComponentBuilder
----------------------------------------------------------------
This is the java builder that will handle the conversion of the property
value from Document form to a form that could be understood by the Java
Implementation (i.e. Java Types).  I guess the builders of other containers
such as groovy, javascript, ruby will have to do something similar to suit
groovy, javascript, rubyscript respectively.
- Here I have used the approach that assumes the following : -
     - that the java classes that represent properties have a default
constructor
     - the name of elements in the document that represents the property
values maps with the field names (for example if there is a complex property
Customer that has elements firstName and lastName, then it is expected that
the corresponding java class has fields with names as firstName, lastName)

- the approach as such is an obvious.  First, since the impl class in known,
I access from it a field whose name matches the property name in the
component defn.  Starting from here I reflect recursively into this field
class as I navigate the property value document and set the value to the
field all along.
-  at the end of this recursion I obtain an instance of the property, using
which I create the object factory and set it into the map.

Concerns
--------------
Here are some concerns that are outstanding despite this...
*)  I am unable to use the .componentType file.  If I used one then I get
the following exception:
org.apache.tuscany.spi.loader.UnrecognizedElementException: {
http://www.osoa.org/xmlns/sca/1.0}componentType [{
http://www.osoa.org/xmlns/sca/1.0}componentType]
Context stack trace: [application][HelloWorldJavaReference]
    at org.apache.tuscany.core.loader.LoaderRegistryImpl.load(
LoaderRegistryImpl.java:113)

Looks like there is problem if I mention JavaComponentType.class in the load
method.  I guess this because all othere containers  have worked around this
aspect.

Am I missing something here?

*)  When I initially clipped the existing property value loading behaviour
in the ComponentLoader, the system components could never get initialized.
To go forward with this, I decided to address only application components.
To this end, I retained the existing behaviour when the component is a
SystemImplementation and changed it for other cases.   I am not clear about
the direction for this.

Thanks for patiently reading upto this point. :)

- Venkat


On 10/2/06, Venkata Krishnan <fo...@gmail.com> wrote:
>
> Hi Jim,
>
> I was going to touch upon that once I completed and posted a patch for
> review.
>
> I initially assumed that since our runtime was in Java, the
> implementation.system components would just about use the Java container.
> However I observed that they never touched the JavaComponentBuilder.  Also I
> observed that for system components there were properties that were getting
> configured, loaded and built - meaning the property hanlding seemed to be in
> place (atleast to the extent that things are working).
>
>  In the interest of not disrupting too many things I have chosen to leave
> the system components alone - atleast in this iteration.  The
> ComponentLoader is however used while loading all components (system or
> application) and this is one place I have had to make some changes to the
> existing behaviour.  For this I have chosen the apporach of retaining the
> existing behaviour whe loading SytemImplementation components and have put
> in an alternate behaviour for all others.
>
> After I have done with this iteration, I can probably take up the case of
> system components with some help from you / jeremy if at all they also need
> to change.
>
> Thanks
>
> - Venkat
>
>
>
> On 10/1/06, Jim Marino <jm...@myromatours.com> wrote:
> >
> > Hi Venkat,
> >
> > One thing I wanted to make sure about below...
> >
> > On Oct 1, 2006, at 10:27 AM, Venkata Krishnan wrote:
> >
> > > Hi Raymond,
> > >
> > > Just to keep you updated.  I am working on this and have been able
> > > to get
> > > the simple type property working.  i.e. properties are loaded
> > > properly from
> > > scdl.   Then I have made some changes to the JavaComponentBuilder
> > > to build
> > > from these loaded properties.
> > Shouldn't any changes for loading properties also apply to system
> > services as well?
> > >
> > > Right now I am trying to see if there is a scheme to get the complex
> > > properties working as well.  Hope I am able to post something off by
> > > tomorrow for some review and discussion.  Thanks
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
>

Re: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Jim,

I was going to touch upon that once I completed and posted a patch for
review.

I initially assumed that since our runtime was in Java, the
implementation.system components would just about use the Java container.
However I observed that they never touched the JavaComponentBuilder.  Also I
observed that for system components there were properties that were getting
configured, loaded and built - meaning the property hanlding seemed to be in
place (atleast to the extent that things are working).

 In the interest of not disrupting too many things I have chosen to leave
the system components alone - atleast in this iteration.  The
ComponentLoader is however used while loading all components (system or
application) and this is one place I have had to make some changes to the
existing behaviour.  For this I have chosen the apporach of retaining the
existing behaviour whe loading SytemImplementation components and have put
in an alternate behaviour for all others.

After I have done with this iteration, I can probably take up the case of
system components with some help from you / jeremy if at all they also need
to change.

Thanks

- Venkat



On 10/1/06, Jim Marino <jm...@myromatours.com> wrote:
>
> Hi Venkat,
>
> One thing I wanted to make sure about below...
>
> On Oct 1, 2006, at 10:27 AM, Venkata Krishnan wrote:
>
> > Hi Raymond,
> >
> > Just to keep you updated.  I am working on this and have been able
> > to get
> > the simple type property working.  i.e. properties are loaded
> > properly from
> > scdl.   Then I have made some changes to the JavaComponentBuilder
> > to build
> > from these loaded properties.
> Shouldn't any changes for loading properties also apply to system
> services as well?
> >
> > Right now I am trying to see if there is a scheme to get the complex
> > properties working as well.  Hope I am able to post something off by
> > tomorrow for some review and discussion.  Thanks
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Queries related to Component Property Loading

Posted by Jim Marino <jm...@myromatours.com>.
Hi Venkat,

One thing I wanted to make sure about below...

On Oct 1, 2006, at 10:27 AM, Venkata Krishnan wrote:

> Hi Raymond,
>
> Just to keep you updated.  I am working on this and have been able  
> to get
> the simple type property working.  i.e. properties are loaded  
> properly from
> scdl.   Then I have made some changes to the JavaComponentBuilder  
> to build
> from these loaded properties.
Shouldn't any changes for loading properties also apply to system  
services as well?
>
> Right now I am trying to see if there is a scheme to get the complex
> properties working as well.  Hope I am able to post something off by
> tomorrow for some review and discussion.  Thanks
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond,

Just to keep you updated.  I am working on this and have been able to get
the simple type property working.  i.e. properties are loaded properly from
scdl.   Then I have made some changes to the JavaComponentBuilder to build
from these loaded properties.

Right now I am trying to see if there is a scheme to get the complex
properties working as well.  Hope I am able to post something off by
tomorrow for some review and discussion.  Thanks

- Venkat

On 9/27/06, Raymond Feng <en...@gmail.com> wrote:
>
> Hi, Venkat.
>
> Sorry for not responding promptly. Please go ahead to make the changes as
> we
> discussed and I'll help if necessary.
>
> I have attached some code that you may be able to cut and paste into your
> code.
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Venkata Krishnan" <fo...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Tuesday, September 26, 2006 1:51 AM
> Subject: Re: Queries related to Component Property Loading
>
>
> > Hi Raymond... thanks.
> >
> > Please see my understanding of this or more questions :) inline.
> >
> > In all of what you have mentioned I am not clear on the things that
> you'd
> > like me to do.  Please let me know.
> >
> > Thanks again.
> >
> > - Venkat.
> >
> > On 9/26/06, Raymond Feng <en...@gmail.com> wrote:
> >>
> >> Hi, Venkata.
> >>
> >> Please see my comments below.
> >>
> >> Thanks,
> >> Raymond
> >>
> >> ----- Original Message -----
> >> From: "Venkata Krishnan" <fo...@gmail.com>
> >> To: <tu...@ws.apache.org>
> >> Sent: Monday, September 25, 2006 2:52 AM
> >> Subject: Re: Queries related to Component Property Loading
> >>
> >>
> >> > Hi Jeremy, Raymond,
> >> >
> >> > Hi Jeremy / Raymond,
> >> >
> >> > - Here is what I propose to do w.r.t. Component Properties
> >> >
> >> > 1) I have added a new attribute called 'override' to capture the
> >> override
> >> > options and have defined three constants 'must', 'may', 'no' that can
> >> > be
> >> > set
> >> > to this attribute.  I have done away with the attribute called
> >> 'required'
> >>
> >> "required" seems to be from the java @Property annotation. How is it
> >> related
> >> to "override"?
> >
> >
> > But isn't the purpose of this just about the same as the
> 'overideOptions'.
> > i.e. if 'required' stands to denote if a property 'requires' to be
> defined
> > or not, then isnt' it the same as stating the 'overideOptions=must'.  If
> > this is the case then maybe we must change the annotation too.  Or do
> the
> > annotations serve some other purpose which I am missing out?
> >
> >>
> >> > 2) In the component loader, during the property loading phase...
> >> > - PropertyValue objects will be created only if the corresponding
> >> > Property's
> >> > 'override' attribute is either 'may' or 'must'.  It it is 'no', an
> >> > exception
> >> > will be thrown.
> >>
> >> Yes.
> >>
> >> > - After all properties defined in the scdl have been loaded, the list
> >> > of
> >> > properties in the component type will be checked to see if there is
> any
> >> > property who 'override' attribute is 'must' and is not defined as
> part
> >> of
> >> > the component defn.  If there exists one then an exception is thrown
> >>
> >> I think this validation step can only be done at "build" phase, right?
> >
> >
> > From what I can understand, we will be able to do this in loading phase
> > itself.  There are two things required to do this validation 1) the set
> of
> > properties defined in the componentType for an implementation 2) the set
> > of
> > properties defined in the component definition that uses this
> > implementation
> > (in a scdl).  Both of these are available during the loading phase and
> > hence
> > this validation can be done there.
> > But then if there is a possibility of builders adding in properties to a
> > component defn., then yes.. this validation has to be during building.
> > This
> > would mean that for properties not defined in the scdl defaults could
> come
> > from the compontType defn or from the builder.  Is this a possibility?
> >
> >> - I understand that the value of component properties will also be
> >> defined
> >> > as xml similar to how the default values are defined in the component
> >> type
> >> > file i.e. property values will also be xml document fragments
> >>
> >> The current code doesn't handle the property value correctly. The SCA
> >> spec
> >> defines the following syntax:
> >>
> >> <property name="xs:NCName" source="xs:string"? file="xs:anyURI"?>*
> >>     property-value
> >> </property>
> >>
> >> The spec takes the order as "source", "file" and content-value.
> >>
> >> The property value will represented by a DOM Document which can be
> >> evaluated
> >> against the composite property by XPath, loaded from the file URI, or
> >> parsed
> >> from the current StAX reader. Can the XPath evaluation be done at
> "load"
> >> phase? I have the code for the XPath part.
> >
> >
> > I am doubtful about this because when a comp. defn. is being loaded
> there
> > is
> > no guarantee that all of the parent composite's properties are
> completely
> > loaded.  So there is a possibility that the XPath is referring a
> property
> > that is yet to be loaded.
> >
> > IMHO, we could probably start with supporting property values embeded as
> > XML
> > elements within the component defn. and get the rest of the stuff
> working
> > after which we can add the two more cases of reading values thro xpath
> and
> > file.  Because more than supporting loading from diff. sources I want to
> > complete what we do with the loaded property values and how we transform
> > them. What do you say?
> >
> >>    - Each property has an xml type specified, but where do we locate
> the
> >> > xsd for this type?
> >>
> >> Maybe we can start with "xsi:schemaLocation". By the spec, the "type"
> is
> >> required. Should we add an attribute to @Property for xmlType? For
> simple
> >> types, we can use Java2XML mapping in SimpleTypeMapperExtension.
> >
> >
> > Where will  "xsi:schemaLocation" will be defined - as an attribute of
> the
> > 'ComponentType' element or as an attirbute of the 'Composite' element or
> > as
> > an attribute in 'Property' element?  And then there must be an attribute
> > for
> > "xsi:schemaLocation" in @Property too .. right?
> >
> > xmlType in @Property will be required if we are loading componenttype
> info
> > thro introspection only and when the side file is not available.
> >
> > I assume that the Java2XML mapping that you mention here is going to be
> a
> > part of the Databinding-based property factory you have created (as
> > mentioned in the next para by you).  Have you committed this factory -
> can
> > I
> > take a look?  What about mapping the 'not simple' types.  Is it
> something
> > that this factory is going to handle?
> >
> > The current code uses "StAXPropertyFactory" to create the target
> property
> >> value (for simple types). I have created a Databinding-based property
> >> factory which knows how to create the value out of the DOM Document.
> >>
> >> > - The property value as an xml document will be passed to the
> >> > ComponentBuilders (js component builder, ruby component builder...)
> >> which
> >> > will handle the logic of transforming them into data forms that can
> be
> >> > injected into the implementations (javascript, rubyscript...).
> >>
> >> I'm thinking of adding the following "build" logic to
> >> ComponentBuilderExtension.
> >>
> >> For each property in the component type, we either use the default
> value
> >> (override="no" or override="may" but no property value is found), or
> the
> >> configured value from the property value (override="must" or
> >> override="may"
> >> and a matching property is found) to create an instance of
> ObjectFactory
> >> which knows how to transform the DOM Node into the target type using
> our
> >> DataBinding support).
> >
> >
> > 'transforming the DOM Node into the target type' - is what I am lost
> about
> > currently.  Getting around the rest is pretty clear to me.  Do you mean
> > you
> > will transform the DOM to an appropriate target java type even the
> target
> > type is nowhere specified?
> >
> > The JavaComponentBuilder will inject the property values into the target
> >> POJO instance. Other component builders may have their own way to pass
> >> properties to their implementations.
> >
> > Yes this is ok to do when the property values have arrived in the right
> > types they can be injected into the implementaiton instance.
> >
> >>
> >> > Am I on track with this?
> >> >
> >> > Thanks
> >> >
> >> > - Venkat
> >> >
> >> > On 9/20/06, Venkata Krishnan <fo...@gmail.com> wrote:
> >> >>
> >> >> Hi Raymond,
> >> >>
> >> >> I will be out of town tomorrow on some pressing personal work and
> will
> >> be
> >> >> back on Friday.  When I am back I will set on to this with lots of
> >> >> help
> >> >> from
> >> >> you ;-).  Thanks.
> >> >>
> >> >> - Venkat
> >> >>
> >> >> On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
> >> >> >
> >> >> > Couple of comments inline - I'll leave other areas to Raymond.
> >> >> >
> >> >> > On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
> >> >> >
> >> >> > > 1) I find that the DefaultValue in the class Property is
> supposed
> >> >> > > to be
> >> >> > > present as a Document instance.
> >> >> >
> >> >> > >        //Added by Venkat for this mail : should the following
> line
> >> >> > > be added
> >> >> > > to fix this problem.
> >> >> > >        doc.appendChild(root);
> >> >> >
> >> >> > > Is this a right fix?  Otherwise what am I missing here?
> >> >> >
> >> >> > Seems reasonable.
> >> >> >
> >> >> > >
> >> >> > > 2) Assuming the DefaultValue is available in its Document form
> in
> >> the
> >> >> > > implementation (say javascript or ruby container impl), I would
> >> >> > > need to
> >> >> > > convert it to Java Object and from it to data that javascript /
> >> >> > > ruby can
> >> >> > > understand.  I imagine that I must be using the DataBinding
> >> >> > > framework /
> >> >> > > service here for this conversion.  How will this be made
> available
> >> >> > > to the
> >> >> > > implementation - as a autowired service or just as framework
> whos
> >> >> > > classes I
> >> >> > > must instantiate and use appropriately?  Is there a transformer
> in
> >> >> > > the
> >> >> > > databinding framework to convert between Document to Java
> >> >> > > (something like
> >> >> > > OMElement2Java or Java2OMElement) ?
> >> >> >
> >> >> > I would think the builder would autowire to the framework somehow.
> >> >> > Raymond, any details?
> >> >> >
> >> >> > >
> >> >> > > 3) In the ComponentLoader where PropertyValue instances are
> >> >> > > created
> >> >> > > (as a
> >> >> > > result of property specification in the component defn) why
> can't
> >> >> > > it be that
> >> >> > > 'PropertyValue' instances are first created for all 'Property'
> >> >> > > instances as
> >> >> > > found in the componentType.  Then the values are set either to
> >> >> > > whatever is
> >> >> > > specified for value in the component definition or to whatever
> is
> >> >> > > available
> >> >> > > in  'DefaultValue' attribute of the Property class.  So,  when
> the
> >> >> > > component
> >> >> > > builders are called, the component defn. instances that are
> passed
> >> >> > > will be
> >> >> > > already populated with property values.  Is this thinking right?
> >> >> >
> >> >> > I was thinking the builder would just look for the PropertyValue
> >> >> > first and then if nothing was specified go to the default. That
> >> >> > avoids copying the values, and allows for the case where the value
> >> >> > is
> >> >> > totally undefined ( e.g. optional with no default).
> >> >> >
> >> >> > > Again over
> >> >> > > here, to convert the values specified in the component defns. I
> >> >> > > guess we
> >> >> > > should employ the databinding framework - right?
> >> >> >
> >> >> > Yes.
> >> >> >
> >> >> > >
> >> >> > > 4) In the current implementation of ComponentLoader, while
> create
> >> >> > > a
> >> >> > > PropertyValue the 'JavaType' attribute of the property seems to
> be
> >> >> > > required
> >> >> > > so that the right object factories can be created.  However this
> >> >> > > JavaType
> >> >> > > attribute is never set and this results in a NPE.  I guess if
> the
> >> >> > > databinding framework is going to be used here to convert
> Document
> >> >> > > data to
> >> >> > > java objects this problem would be resolved - is this right?
> >> >> >
> >> >> > The ComponentLoader still needs to be converted to using the DOM
> >> >> > form
> >> >> > and have all the xpath stuff added. I think this is just a bug
> that
> >> >> > should go away when these changes are made. I don't think anyone
> is
> >> >> > working on that.
> >> >> >
> >> >> > >
> >> >> > > 5) Finally (if you have managed to bear with me until this
> >> >> > > point :)), why is
> >> >> > > it that I must deal with an object factory to get a property
> >> >> > > value.  Can I
> >> >> > > not be allowed to simply access it as ' propertyValue.getValue
> ()'.
> >> >> > > Now it
> >> >> > > seems like I must do a propertyValue.getValueFactory
> ().getInstance
> >> >> > > () to get
> >> >> > > the value of a property.   Why?
> >> >> >
> >> >> > Because the value may need to be injected multiple times which may
> >> >> > involve creating different instances of it to avoid aliasing bugs.
> >> >> >
> >> >> > --
> >> >> > Jeremy
> >> >> >
> >> >> >
> >> >> >
> ---------------------------------------------------------------------
> >> >> > 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
> >>
> >>
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Queries related to Component Property Loading

Posted by Raymond Feng <en...@gmail.com>.
Hi, Venkat.

Sorry for not responding promptly. Please go ahead to make the changes as we 
discussed and I'll help if necessary.

I have attached some code that you may be able to cut and paste into your 
code.

Thanks,
Raymond

----- Original Message ----- 
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Tuesday, September 26, 2006 1:51 AM
Subject: Re: Queries related to Component Property Loading


> Hi Raymond... thanks.
>
> Please see my understanding of this or more questions :) inline.
>
> In all of what you have mentioned I am not clear on the things that you'd
> like me to do.  Please let me know.
>
> Thanks again.
>
> - Venkat.
>
> On 9/26/06, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi, Venkata.
>>
>> Please see my comments below.
>>
>> Thanks,
>> Raymond
>>
>> ----- Original Message -----
>> From: "Venkata Krishnan" <fo...@gmail.com>
>> To: <tu...@ws.apache.org>
>> Sent: Monday, September 25, 2006 2:52 AM
>> Subject: Re: Queries related to Component Property Loading
>>
>>
>> > Hi Jeremy, Raymond,
>> >
>> > Hi Jeremy / Raymond,
>> >
>> > - Here is what I propose to do w.r.t. Component Properties
>> >
>> > 1) I have added a new attribute called 'override' to capture the
>> override
>> > options and have defined three constants 'must', 'may', 'no' that can 
>> > be
>> > set
>> > to this attribute.  I have done away with the attribute called
>> 'required'
>>
>> "required" seems to be from the java @Property annotation. How is it
>> related
>> to "override"?
>
>
> But isn't the purpose of this just about the same as the 'overideOptions'.
> i.e. if 'required' stands to denote if a property 'requires' to be defined
> or not, then isnt' it the same as stating the 'overideOptions=must'.  If
> this is the case then maybe we must change the annotation too.  Or do the
> annotations serve some other purpose which I am missing out?
>
>>
>> > 2) In the component loader, during the property loading phase...
>> > - PropertyValue objects will be created only if the corresponding
>> > Property's
>> > 'override' attribute is either 'may' or 'must'.  It it is 'no', an
>> > exception
>> > will be thrown.
>>
>> Yes.
>>
>> > - After all properties defined in the scdl have been loaded, the list 
>> > of
>> > properties in the component type will be checked to see if there is any
>> > property who 'override' attribute is 'must' and is not defined as part
>> of
>> > the component defn.  If there exists one then an exception is thrown
>>
>> I think this validation step can only be done at "build" phase, right?
>
>
> From what I can understand, we will be able to do this in loading phase
> itself.  There are two things required to do this validation 1) the set of
> properties defined in the componentType for an implementation 2) the set 
> of
> properties defined in the component definition that uses this 
> implementation
> (in a scdl).  Both of these are available during the loading phase and 
> hence
> this validation can be done there.
> But then if there is a possibility of builders adding in properties to a
> component defn., then yes.. this validation has to be during building. 
> This
> would mean that for properties not defined in the scdl defaults could come
> from the compontType defn or from the builder.  Is this a possibility?
>
>> - I understand that the value of component properties will also be 
>> defined
>> > as xml similar to how the default values are defined in the component
>> type
>> > file i.e. property values will also be xml document fragments
>>
>> The current code doesn't handle the property value correctly. The SCA 
>> spec
>> defines the following syntax:
>>
>> <property name="xs:NCName" source="xs:string"? file="xs:anyURI"?>*
>>     property-value
>> </property>
>>
>> The spec takes the order as "source", "file" and content-value.
>>
>> The property value will represented by a DOM Document which can be
>> evaluated
>> against the composite property by XPath, loaded from the file URI, or
>> parsed
>> from the current StAX reader. Can the XPath evaluation be done at "load"
>> phase? I have the code for the XPath part.
>
>
> I am doubtful about this because when a comp. defn. is being loaded there 
> is
> no guarantee that all of the parent composite's properties are completely
> loaded.  So there is a possibility that the XPath is referring a property
> that is yet to be loaded.
>
> IMHO, we could probably start with supporting property values embeded as 
> XML
> elements within the component defn. and get the rest of the stuff working
> after which we can add the two more cases of reading values thro xpath and
> file.  Because more than supporting loading from diff. sources I want to
> complete what we do with the loaded property values and how we transform
> them. What do you say?
>
>>    - Each property has an xml type specified, but where do we locate the
>> > xsd for this type?
>>
>> Maybe we can start with "xsi:schemaLocation". By the spec, the "type" is
>> required. Should we add an attribute to @Property for xmlType? For simple
>> types, we can use Java2XML mapping in SimpleTypeMapperExtension.
>
>
> Where will  "xsi:schemaLocation" will be defined - as an attribute of the
> 'ComponentType' element or as an attirbute of the 'Composite' element or 
> as
> an attribute in 'Property' element?  And then there must be an attribute 
> for
> "xsi:schemaLocation" in @Property too .. right?
>
> xmlType in @Property will be required if we are loading componenttype info
> thro introspection only and when the side file is not available.
>
> I assume that the Java2XML mapping that you mention here is going to be a
> part of the Databinding-based property factory you have created (as
> mentioned in the next para by you).  Have you committed this factory - can 
> I
> take a look?  What about mapping the 'not simple' types.  Is it something
> that this factory is going to handle?
>
> The current code uses "StAXPropertyFactory" to create the target property
>> value (for simple types). I have created a Databinding-based property
>> factory which knows how to create the value out of the DOM Document.
>>
>> > - The property value as an xml document will be passed to the
>> > ComponentBuilders (js component builder, ruby component builder...)
>> which
>> > will handle the logic of transforming them into data forms that can be
>> > injected into the implementations (javascript, rubyscript...).
>>
>> I'm thinking of adding the following "build" logic to
>> ComponentBuilderExtension.
>>
>> For each property in the component type, we either use the default value
>> (override="no" or override="may" but no property value is found), or the
>> configured value from the property value (override="must" or
>> override="may"
>> and a matching property is found) to create an instance of ObjectFactory
>> which knows how to transform the DOM Node into the target type using our
>> DataBinding support).
>
>
> 'transforming the DOM Node into the target type' - is what I am lost about
> currently.  Getting around the rest is pretty clear to me.  Do you mean 
> you
> will transform the DOM to an appropriate target java type even the target
> type is nowhere specified?
>
> The JavaComponentBuilder will inject the property values into the target
>> POJO instance. Other component builders may have their own way to pass
>> properties to their implementations.
>
> Yes this is ok to do when the property values have arrived in the right
> types they can be injected into the implementaiton instance.
>
>>
>> > Am I on track with this?
>> >
>> > Thanks
>> >
>> > - Venkat
>> >
>> > On 9/20/06, Venkata Krishnan <fo...@gmail.com> wrote:
>> >>
>> >> Hi Raymond,
>> >>
>> >> I will be out of town tomorrow on some pressing personal work and will
>> be
>> >> back on Friday.  When I am back I will set on to this with lots of 
>> >> help
>> >> from
>> >> you ;-).  Thanks.
>> >>
>> >> - Venkat
>> >>
>> >> On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
>> >> >
>> >> > Couple of comments inline - I'll leave other areas to Raymond.
>> >> >
>> >> > On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
>> >> >
>> >> > > 1) I find that the DefaultValue in the class Property is supposed
>> >> > > to be
>> >> > > present as a Document instance.
>> >> >
>> >> > >        //Added by Venkat for this mail : should the following line
>> >> > > be added
>> >> > > to fix this problem.
>> >> > >        doc.appendChild(root);
>> >> >
>> >> > > Is this a right fix?  Otherwise what am I missing here?
>> >> >
>> >> > Seems reasonable.
>> >> >
>> >> > >
>> >> > > 2) Assuming the DefaultValue is available in its Document form in
>> the
>> >> > > implementation (say javascript or ruby container impl), I would
>> >> > > need to
>> >> > > convert it to Java Object and from it to data that javascript /
>> >> > > ruby can
>> >> > > understand.  I imagine that I must be using the DataBinding
>> >> > > framework /
>> >> > > service here for this conversion.  How will this be made available
>> >> > > to the
>> >> > > implementation - as a autowired service or just as framework whos
>> >> > > classes I
>> >> > > must instantiate and use appropriately?  Is there a transformer in
>> >> > > the
>> >> > > databinding framework to convert between Document to Java
>> >> > > (something like
>> >> > > OMElement2Java or Java2OMElement) ?
>> >> >
>> >> > I would think the builder would autowire to the framework somehow.
>> >> > Raymond, any details?
>> >> >
>> >> > >
>> >> > > 3) In the ComponentLoader where PropertyValue instances are 
>> >> > > created
>> >> > > (as a
>> >> > > result of property specification in the component defn) why can't
>> >> > > it be that
>> >> > > 'PropertyValue' instances are first created for all 'Property'
>> >> > > instances as
>> >> > > found in the componentType.  Then the values are set either to
>> >> > > whatever is
>> >> > > specified for value in the component definition or to whatever is
>> >> > > available
>> >> > > in  'DefaultValue' attribute of the Property class.  So,  when the
>> >> > > component
>> >> > > builders are called, the component defn. instances that are passed
>> >> > > will be
>> >> > > already populated with property values.  Is this thinking right?
>> >> >
>> >> > I was thinking the builder would just look for the PropertyValue
>> >> > first and then if nothing was specified go to the default. That
>> >> > avoids copying the values, and allows for the case where the value 
>> >> > is
>> >> > totally undefined ( e.g. optional with no default).
>> >> >
>> >> > > Again over
>> >> > > here, to convert the values specified in the component defns. I
>> >> > > guess we
>> >> > > should employ the databinding framework - right?
>> >> >
>> >> > Yes.
>> >> >
>> >> > >
>> >> > > 4) In the current implementation of ComponentLoader, while create 
>> >> > > a
>> >> > > PropertyValue the 'JavaType' attribute of the property seems to be
>> >> > > required
>> >> > > so that the right object factories can be created.  However this
>> >> > > JavaType
>> >> > > attribute is never set and this results in a NPE.  I guess if the
>> >> > > databinding framework is going to be used here to convert Document
>> >> > > data to
>> >> > > java objects this problem would be resolved - is this right?
>> >> >
>> >> > The ComponentLoader still needs to be converted to using the DOM 
>> >> > form
>> >> > and have all the xpath stuff added. I think this is just a bug that
>> >> > should go away when these changes are made. I don't think anyone is
>> >> > working on that.
>> >> >
>> >> > >
>> >> > > 5) Finally (if you have managed to bear with me until this
>> >> > > point :)), why is
>> >> > > it that I must deal with an object factory to get a property
>> >> > > value.  Can I
>> >> > > not be allowed to simply access it as ' propertyValue.getValue()'.
>> >> > > Now it
>> >> > > seems like I must do a propertyValue.getValueFactory().getInstance
>> >> > > () to get
>> >> > > the value of a property.   Why?
>> >> >
>> >> > Because the value may need to be injected multiple times which may
>> >> > involve creating different instances of it to avoid aliasing bugs.
>> >> >
>> >> > --
>> >> > Jeremy
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > 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: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond... thanks.

Please see my understanding of this or more questions :) inline.

In all of what you have mentioned I am not clear on the things that you'd
like me to do.  Please let me know.

Thanks again.

- Venkat.

On 9/26/06, Raymond Feng <en...@gmail.com> wrote:
>
> Hi, Venkata.
>
> Please see my comments below.
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Venkata Krishnan" <fo...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Monday, September 25, 2006 2:52 AM
> Subject: Re: Queries related to Component Property Loading
>
>
> > Hi Jeremy, Raymond,
> >
> > Hi Jeremy / Raymond,
> >
> > - Here is what I propose to do w.r.t. Component Properties
> >
> > 1) I have added a new attribute called 'override' to capture the
> override
> > options and have defined three constants 'must', 'may', 'no' that can be
> > set
> > to this attribute.  I have done away with the attribute called
> 'required'
>
> "required" seems to be from the java @Property annotation. How is it
> related
> to "override"?


But isn't the purpose of this just about the same as the 'overideOptions'.
i.e. if 'required' stands to denote if a property 'requires' to be defined
or not, then isnt' it the same as stating the 'overideOptions=must'.  If
this is the case then maybe we must change the annotation too.  Or do the
annotations serve some other purpose which I am missing out?

>
> > 2) In the component loader, during the property loading phase...
> > - PropertyValue objects will be created only if the corresponding
> > Property's
> > 'override' attribute is either 'may' or 'must'.  It it is 'no', an
> > exception
> > will be thrown.
>
> Yes.
>
> > - After all properties defined in the scdl have been loaded, the list of
> > properties in the component type will be checked to see if there is any
> > property who 'override' attribute is 'must' and is not defined as part
> of
> > the component defn.  If there exists one then an exception is thrown
>
> I think this validation step can only be done at "build" phase, right?


>From what I can understand, we will be able to do this in loading phase
itself.  There are two things required to do this validation 1) the set of
properties defined in the componentType for an implementation 2) the set of
properties defined in the component definition that uses this implementation
(in a scdl).  Both of these are available during the loading phase and hence
this validation can be done there.
 But then if there is a possibility of builders adding in properties to a
component defn., then yes.. this validation has to be during building.  This
would mean that for properties not defined in the scdl defaults could come
from the compontType defn or from the builder.  Is this a possibility?

> - I understand that the value of component properties will also be defined
> > as xml similar to how the default values are defined in the component
> type
> > file i.e. property values will also be xml document fragments
>
> The current code doesn't handle the property value correctly. The SCA spec
> defines the following syntax:
>
> <property name="xs:NCName" source="xs:string"? file="xs:anyURI"?>*
>     property-value
> </property>
>
> The spec takes the order as "source", "file" and content-value.
>
> The property value will represented by a DOM Document which can be
> evaluated
> against the composite property by XPath, loaded from the file URI, or
> parsed
> from the current StAX reader. Can the XPath evaluation be done at "load"
> phase? I have the code for the XPath part.


I am doubtful about this because when a comp. defn. is being loaded there is
no guarantee that all of the parent composite's properties are completely
loaded.  So there is a possibility that the XPath is referring a property
that is yet to be loaded.

IMHO, we could probably start with supporting property values embeded as XML
elements within the component defn. and get the rest of the stuff working
after which we can add the two more cases of reading values thro xpath and
file.  Because more than supporting loading from diff. sources I want to
complete what we do with the loaded property values and how we transform
them. What do you say?

>    - Each property has an xml type specified, but where do we locate the
> > xsd for this type?
>
> Maybe we can start with "xsi:schemaLocation". By the spec, the "type" is
> required. Should we add an attribute to @Property for xmlType? For simple
> types, we can use Java2XML mapping in SimpleTypeMapperExtension.


Where will  "xsi:schemaLocation" will be defined - as an attribute of the
'ComponentType' element or as an attirbute of the 'Composite' element or as
an attribute in 'Property' element?  And then there must be an attribute for
"xsi:schemaLocation" in @Property too .. right?

xmlType in @Property will be required if we are loading componenttype info
thro introspection only and when the side file is not available.

I assume that the Java2XML mapping that you mention here is going to be a
part of the Databinding-based property factory you have created (as
mentioned in the next para by you).  Have you committed this factory - can I
take a look?  What about mapping the 'not simple' types.  Is it something
that this factory is going to handle?

The current code uses "StAXPropertyFactory" to create the target property
> value (for simple types). I have created a Databinding-based property
> factory which knows how to create the value out of the DOM Document.
>
> > - The property value as an xml document will be passed to the
> > ComponentBuilders (js component builder, ruby component builder...)
> which
> > will handle the logic of transforming them into data forms that can be
> > injected into the implementations (javascript, rubyscript...).
>
> I'm thinking of adding the following "build" logic to
> ComponentBuilderExtension.
>
> For each property in the component type, we either use the default value
> (override="no" or override="may" but no property value is found), or the
> configured value from the property value (override="must" or
> override="may"
> and a matching property is found) to create an instance of ObjectFactory
> which knows how to transform the DOM Node into the target type using our
> DataBinding support).


'transforming the DOM Node into the target type' - is what I am lost about
currently.  Getting around the rest is pretty clear to me.  Do you mean you
will transform the DOM to an appropriate target java type even the target
type is nowhere specified?

The JavaComponentBuilder will inject the property values into the target
> POJO instance. Other component builders may have their own way to pass
> properties to their implementations.

 Yes this is ok to do when the property values have arrived in the right
types they can be injected into the implementaiton instance.

>
> > Am I on track with this?
> >
> > Thanks
> >
> > - Venkat
> >
> > On 9/20/06, Venkata Krishnan <fo...@gmail.com> wrote:
> >>
> >> Hi Raymond,
> >>
> >> I will be out of town tomorrow on some pressing personal work and will
> be
> >> back on Friday.  When I am back I will set on to this with lots of help
> >> from
> >> you ;-).  Thanks.
> >>
> >> - Venkat
> >>
> >> On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
> >> >
> >> > Couple of comments inline - I'll leave other areas to Raymond.
> >> >
> >> > On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
> >> >
> >> > > 1) I find that the DefaultValue in the class Property is supposed
> >> > > to be
> >> > > present as a Document instance.
> >> >
> >> > >        //Added by Venkat for this mail : should the following line
> >> > > be added
> >> > > to fix this problem.
> >> > >        doc.appendChild(root);
> >> >
> >> > > Is this a right fix?  Otherwise what am I missing here?
> >> >
> >> > Seems reasonable.
> >> >
> >> > >
> >> > > 2) Assuming the DefaultValue is available in its Document form in
> the
> >> > > implementation (say javascript or ruby container impl), I would
> >> > > need to
> >> > > convert it to Java Object and from it to data that javascript /
> >> > > ruby can
> >> > > understand.  I imagine that I must be using the DataBinding
> >> > > framework /
> >> > > service here for this conversion.  How will this be made available
> >> > > to the
> >> > > implementation - as a autowired service or just as framework whos
> >> > > classes I
> >> > > must instantiate and use appropriately?  Is there a transformer in
> >> > > the
> >> > > databinding framework to convert between Document to Java
> >> > > (something like
> >> > > OMElement2Java or Java2OMElement) ?
> >> >
> >> > I would think the builder would autowire to the framework somehow.
> >> > Raymond, any details?
> >> >
> >> > >
> >> > > 3) In the ComponentLoader where PropertyValue instances are created
> >> > > (as a
> >> > > result of property specification in the component defn) why can't
> >> > > it be that
> >> > > 'PropertyValue' instances are first created for all 'Property'
> >> > > instances as
> >> > > found in the componentType.  Then the values are set either to
> >> > > whatever is
> >> > > specified for value in the component definition or to whatever is
> >> > > available
> >> > > in  'DefaultValue' attribute of the Property class.  So,  when the
> >> > > component
> >> > > builders are called, the component defn. instances that are passed
> >> > > will be
> >> > > already populated with property values.  Is this thinking right?
> >> >
> >> > I was thinking the builder would just look for the PropertyValue
> >> > first and then if nothing was specified go to the default. That
> >> > avoids copying the values, and allows for the case where the value is
> >> > totally undefined ( e.g. optional with no default).
> >> >
> >> > > Again over
> >> > > here, to convert the values specified in the component defns. I
> >> > > guess we
> >> > > should employ the databinding framework - right?
> >> >
> >> > Yes.
> >> >
> >> > >
> >> > > 4) In the current implementation of ComponentLoader, while create a
> >> > > PropertyValue the 'JavaType' attribute of the property seems to be
> >> > > required
> >> > > so that the right object factories can be created.  However this
> >> > > JavaType
> >> > > attribute is never set and this results in a NPE.  I guess if the
> >> > > databinding framework is going to be used here to convert Document
> >> > > data to
> >> > > java objects this problem would be resolved - is this right?
> >> >
> >> > The ComponentLoader still needs to be converted to using the DOM form
> >> > and have all the xpath stuff added. I think this is just a bug that
> >> > should go away when these changes are made. I don't think anyone is
> >> > working on that.
> >> >
> >> > >
> >> > > 5) Finally (if you have managed to bear with me until this
> >> > > point :)), why is
> >> > > it that I must deal with an object factory to get a property
> >> > > value.  Can I
> >> > > not be allowed to simply access it as ' propertyValue.getValue()'.
> >> > > Now it
> >> > > seems like I must do a propertyValue.getValueFactory().getInstance
> >> > > () to get
> >> > > the value of a property.   Why?
> >> >
> >> > Because the value may need to be injected multiple times which may
> >> > involve creating different instances of it to avoid aliasing bugs.
> >> >
> >> > --
> >> > Jeremy
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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: Queries related to Component Property Loading

Posted by Raymond Feng <en...@gmail.com>.
Hi, Venkata.

Please see my comments below.

Thanks,
Raymond

----- Original Message ----- 
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Monday, September 25, 2006 2:52 AM
Subject: Re: Queries related to Component Property Loading


> Hi Jeremy, Raymond,
>
> Hi Jeremy / Raymond,
>
> - Here is what I propose to do w.r.t. Component Properties
>
> 1) I have added a new attribute called 'override' to capture the override
> options and have defined three constants 'must', 'may', 'no' that can be 
> set
> to this attribute.  I have done away with the attribute called 'required'

"required" seems to be from the java @Property annotation. How is it related 
to "override"?

>
> 2) In the component loader, during the property loading phase...
> - PropertyValue objects will be created only if the corresponding 
> Property's
> 'override' attribute is either 'may' or 'must'.  It it is 'no', an 
> exception
> will be thrown.

Yes.

> - After all properties defined in the scdl have been loaded, the list of
> properties in the component type will be checked to see if there is any
> property who 'override' attribute is 'must' and is not defined as part of
> the component defn.  If there exists one then an exception is thrown

I think this validation step can only be done at "build" phase, right?

> - I understand that the value of component properties will also be defined
> as xml similar to how the default values are defined in the component type
> file i.e. property values will also be xml document fragments

The current code doesn't handle the property value correctly. The SCA spec 
defines the following syntax:

<property name="xs:NCName" source="xs:string"? file="xs:anyURI"?>*
    property-value
</property>

The spec takes the order as "source", "file" and content-value.

The property value will represented by a DOM Document which can be evaluated 
against the composite property by XPath, loaded from the file URI, or parsed 
from the current StAX reader. Can the XPath evaluation be done at "load" 
phase? I have the code for the XPath part.

>    - Each property has an xml type specified, but where do we locate the
> xsd for this type?

Maybe we can start with "xsi:schemaLocation". By the spec, the "type" is 
required. Should we add an attribute to @Property for xmlType? For simple 
types, we can use Java2XML mapping in SimpleTypeMapperExtension.

The current code uses "StAXPropertyFactory" to create the target property 
value (for simple types). I have created a Databinding-based property 
factory which knows how to create the value out of the DOM Document.

> - The property value as an xml document will be passed to the
> ComponentBuilders (js component builder, ruby component builder...) which
> will handle the logic of transforming them into data forms that can be
> injected into the implementations (javascript, rubyscript...).

I'm thinking of adding the following "build" logic to 
ComponentBuilderExtension.

For each property in the component type, we either use the default value 
(override="no" or override="may" but no property value is found), or the 
configured value from the property value (override="must" or override="may" 
and a matching property is found) to create an instance of ObjectFactory 
which knows how to transform the DOM Node into the target type using our 
DataBinding support).

The JavaComponentBuilder will inject the property values into the target 
POJO instance. Other component builders may have their own way to pass 
properties to their implementations.


>
> Am I on track with this?
>
> Thanks
>
> - Venkat
>
> On 9/20/06, Venkata Krishnan <fo...@gmail.com> wrote:
>>
>> Hi Raymond,
>>
>> I will be out of town tomorrow on some pressing personal work and will be
>> back on Friday.  When I am back I will set on to this with lots of help 
>> from
>> you ;-).  Thanks.
>>
>> - Venkat
>>
>> On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
>> >
>> > Couple of comments inline - I'll leave other areas to Raymond.
>> >
>> > On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
>> >
>> > > 1) I find that the DefaultValue in the class Property is supposed
>> > > to be
>> > > present as a Document instance.
>> >
>> > >        //Added by Venkat for this mail : should the following line
>> > > be added
>> > > to fix this problem.
>> > >        doc.appendChild(root);
>> >
>> > > Is this a right fix?  Otherwise what am I missing here?
>> >
>> > Seems reasonable.
>> >
>> > >
>> > > 2) Assuming the DefaultValue is available in its Document form in the
>> > > implementation (say javascript or ruby container impl), I would
>> > > need to
>> > > convert it to Java Object and from it to data that javascript /
>> > > ruby can
>> > > understand.  I imagine that I must be using the DataBinding
>> > > framework /
>> > > service here for this conversion.  How will this be made available
>> > > to the
>> > > implementation - as a autowired service or just as framework whos
>> > > classes I
>> > > must instantiate and use appropriately?  Is there a transformer in 
>> > > the
>> > > databinding framework to convert between Document to Java
>> > > (something like
>> > > OMElement2Java or Java2OMElement) ?
>> >
>> > I would think the builder would autowire to the framework somehow.
>> > Raymond, any details?
>> >
>> > >
>> > > 3) In the ComponentLoader where PropertyValue instances are created
>> > > (as a
>> > > result of property specification in the component defn) why can't
>> > > it be that
>> > > 'PropertyValue' instances are first created for all 'Property'
>> > > instances as
>> > > found in the componentType.  Then the values are set either to
>> > > whatever is
>> > > specified for value in the component definition or to whatever is
>> > > available
>> > > in  'DefaultValue' attribute of the Property class.  So,  when the
>> > > component
>> > > builders are called, the component defn. instances that are passed
>> > > will be
>> > > already populated with property values.  Is this thinking right?
>> >
>> > I was thinking the builder would just look for the PropertyValue
>> > first and then if nothing was specified go to the default. That
>> > avoids copying the values, and allows for the case where the value is
>> > totally undefined ( e.g. optional with no default).
>> >
>> > > Again over
>> > > here, to convert the values specified in the component defns. I
>> > > guess we
>> > > should employ the databinding framework - right?
>> >
>> > Yes.
>> >
>> > >
>> > > 4) In the current implementation of ComponentLoader, while create a
>> > > PropertyValue the 'JavaType' attribute of the property seems to be
>> > > required
>> > > so that the right object factories can be created.  However this
>> > > JavaType
>> > > attribute is never set and this results in a NPE.  I guess if the
>> > > databinding framework is going to be used here to convert Document
>> > > data to
>> > > java objects this problem would be resolved - is this right?
>> >
>> > The ComponentLoader still needs to be converted to using the DOM form
>> > and have all the xpath stuff added. I think this is just a bug that
>> > should go away when these changes are made. I don't think anyone is
>> > working on that.
>> >
>> > >
>> > > 5) Finally (if you have managed to bear with me until this
>> > > point :)), why is
>> > > it that I must deal with an object factory to get a property
>> > > value.  Can I
>> > > not be allowed to simply access it as ' propertyValue.getValue()'.
>> > > Now it
>> > > seems like I must do a propertyValue.getValueFactory().getInstance
>> > > () to get
>> > > the value of a property.   Why?
>> >
>> > Because the value may need to be injected multiple times which may
>> > involve creating different instances of it to avoid aliasing bugs.
>> >
>> > --
>> > Jeremy
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Jeremy, Raymond,

Hi Jeremy / Raymond,

- Here is what I propose to do w.r.t. Component Properties

1) I have added a new attribute called 'override' to capture the override
options and have defined three constants 'must', 'may', 'no' that can be set
to this attribute.  I have done away with the attribute called 'required'

2) In the component loader, during the property loading phase...
- PropertyValue objects will be created only if the corresponding Property's
'override' attribute is either 'may' or 'must'.  It it is 'no', an exception
will be thrown.
- After all properties defined in the scdl have been loaded, the list of
properties in the component type will be checked to see if there is any
property who 'override' attribute is 'must' and is not defined as part of
the component defn.  If there exists one then an exception is thrown
- I understand that the value of component properties will also be defined
as xml similar to how the default values are defined in the component type
file i.e. property values will also be xml document fragments
    - Each property has an xml type specified, but where do we locate the
xsd for this type?
- The property value as an xml document will be passed to the
ComponentBuilders (js component builder, ruby component builder...) which
will handle the logic of transforming them into data forms that can be
injected into the implementations (javascript, rubyscript...).

Am I on track with this?

Thanks

- Venkat

On 9/20/06, Venkata Krishnan <fo...@gmail.com> wrote:
>
> Hi Raymond,
>
> I will be out of town tomorrow on some pressing personal work and will be
> back on Friday.  When I am back I will set on to this with lots of help from
> you ;-).  Thanks.
>
> - Venkat
>
> On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
> >
> > Couple of comments inline - I'll leave other areas to Raymond.
> >
> > On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
> >
> > > 1) I find that the DefaultValue in the class Property is supposed
> > > to be
> > > present as a Document instance.
> >
> > >        //Added by Venkat for this mail : should the following line
> > > be added
> > > to fix this problem.
> > >        doc.appendChild(root);
> >
> > > Is this a right fix?  Otherwise what am I missing here?
> >
> > Seems reasonable.
> >
> > >
> > > 2) Assuming the DefaultValue is available in its Document form in the
> > > implementation (say javascript or ruby container impl), I would
> > > need to
> > > convert it to Java Object and from it to data that javascript /
> > > ruby can
> > > understand.  I imagine that I must be using the DataBinding
> > > framework /
> > > service here for this conversion.  How will this be made available
> > > to the
> > > implementation - as a autowired service or just as framework whos
> > > classes I
> > > must instantiate and use appropriately?  Is there a transformer in the
> > > databinding framework to convert between Document to Java
> > > (something like
> > > OMElement2Java or Java2OMElement) ?
> >
> > I would think the builder would autowire to the framework somehow.
> > Raymond, any details?
> >
> > >
> > > 3) In the ComponentLoader where PropertyValue instances are created
> > > (as a
> > > result of property specification in the component defn) why can't
> > > it be that
> > > 'PropertyValue' instances are first created for all 'Property'
> > > instances as
> > > found in the componentType.  Then the values are set either to
> > > whatever is
> > > specified for value in the component definition or to whatever is
> > > available
> > > in  'DefaultValue' attribute of the Property class.  So,  when the
> > > component
> > > builders are called, the component defn. instances that are passed
> > > will be
> > > already populated with property values.  Is this thinking right?
> >
> > I was thinking the builder would just look for the PropertyValue
> > first and then if nothing was specified go to the default. That
> > avoids copying the values, and allows for the case where the value is
> > totally undefined ( e.g. optional with no default).
> >
> > > Again over
> > > here, to convert the values specified in the component defns. I
> > > guess we
> > > should employ the databinding framework - right?
> >
> > Yes.
> >
> > >
> > > 4) In the current implementation of ComponentLoader, while create a
> > > PropertyValue the 'JavaType' attribute of the property seems to be
> > > required
> > > so that the right object factories can be created.  However this
> > > JavaType
> > > attribute is never set and this results in a NPE.  I guess if the
> > > databinding framework is going to be used here to convert Document
> > > data to
> > > java objects this problem would be resolved - is this right?
> >
> > The ComponentLoader still needs to be converted to using the DOM form
> > and have all the xpath stuff added. I think this is just a bug that
> > should go away when these changes are made. I don't think anyone is
> > working on that.
> >
> > >
> > > 5) Finally (if you have managed to bear with me until this
> > > point :)), why is
> > > it that I must deal with an object factory to get a property
> > > value.  Can I
> > > not be allowed to simply access it as ' propertyValue.getValue()'.
> > > Now it
> > > seems like I must do a propertyValue.getValueFactory().getInstance
> > > () to get
> > > the value of a property.   Why?
> >
> > Because the value may need to be injected multiple times which may
> > involve creating different instances of it to avoid aliasing bugs.
> >
> > --
> > Jeremy
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
>

Re: Queries related to Component Property Loading

Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond,

I will be out of town tomorrow on some pressing personal work and will be
back on Friday.  When I am back I will set on to this with lots of help from
you ;-).  Thanks.

- Venkat

On 9/19/06, Jeremy Boynes <jb...@apache.org> wrote:
>
> Couple of comments inline - I'll leave other areas to Raymond.
>
> On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:
>
> > 1) I find that the DefaultValue in the class Property is supposed
> > to be
> > present as a Document instance.
>
> >        //Added by Venkat for this mail : should the following line
> > be added
> > to fix this problem.
> >        doc.appendChild(root);
>
> > Is this a right fix?  Otherwise what am I missing here?
>
> Seems reasonable.
>
> >
> > 2) Assuming the DefaultValue is available in its Document form in the
> > implementation (say javascript or ruby container impl), I would
> > need to
> > convert it to Java Object and from it to data that javascript /
> > ruby can
> > understand.  I imagine that I must be using the DataBinding
> > framework /
> > service here for this conversion.  How will this be made available
> > to the
> > implementation - as a autowired service or just as framework whos
> > classes I
> > must instantiate and use appropriately?  Is there a transformer in the
> > databinding framework to convert between Document to Java
> > (something like
> > OMElement2Java or Java2OMElement) ?
>
> I would think the builder would autowire to the framework somehow.
> Raymond, any details?
>
> >
> > 3) In the ComponentLoader where PropertyValue instances are created
> > (as a
> > result of property specification in the component defn) why can't
> > it be that
> > 'PropertyValue' instances are first created for all 'Property'
> > instances as
> > found in the componentType.  Then the values are set either to
> > whatever is
> > specified for value in the component definition or to whatever is
> > available
> > in  'DefaultValue' attribute of the Property class.  So,  when the
> > component
> > builders are called, the component defn. instances that are passed
> > will be
> > already populated with property values.  Is this thinking right?
>
> I was thinking the builder would just look for the PropertyValue
> first and then if nothing was specified go to the default. That
> avoids copying the values, and allows for the case where the value is
> totally undefined (e.g. optional with no default).
>
> > Again over
> > here, to convert the values specified in the component defns. I
> > guess we
> > should employ the databinding framework - right?
>
> Yes.
>
> >
> > 4) In the current implementation of ComponentLoader, while create a
> > PropertyValue the 'JavaType' attribute of the property seems to be
> > required
> > so that the right object factories can be created.  However this
> > JavaType
> > attribute is never set and this results in a NPE.  I guess if the
> > databinding framework is going to be used here to convert Document
> > data to
> > java objects this problem would be resolved - is this right?
>
> The ComponentLoader still needs to be converted to using the DOM form
> and have all the xpath stuff added. I think this is just a bug that
> should go away when these changes are made. I don't think anyone is
> working on that.
>
> >
> > 5) Finally (if you have managed to bear with me until this
> > point :)), why is
> > it that I must deal with an object factory to get a property
> > value.  Can I
> > not be allowed to simply access it as 'propertyValue.getValue()'.
> > Now it
> > seems like I must do a propertyValue.getValueFactory().getInstance
> > () to get
> > the value of a property.   Why?
>
> Because the value may need to be injected multiple times which may
> involve creating different instances of it to avoid aliasing bugs.
>
> --
> Jeremy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Re: Queries related to Component Property Loading

Posted by Jeremy Boynes <jb...@apache.org>.
Couple of comments inline - I'll leave other areas to Raymond.

On Sep 19, 2006, at 10:54 AM, Venkata Krishnan wrote:

> 1) I find that the DefaultValue in the class Property is supposed  
> to be
> present as a Document instance.

>        //Added by Venkat for this mail : should the following line  
> be added
> to fix this problem.
>        doc.appendChild(root);

> Is this a right fix?  Otherwise what am I missing here?

Seems reasonable.

>
> 2) Assuming the DefaultValue is available in its Document form in the
> implementation (say javascript or ruby container impl), I would  
> need to
> convert it to Java Object and from it to data that javascript /  
> ruby can
> understand.  I imagine that I must be using the DataBinding  
> framework /
> service here for this conversion.  How will this be made available  
> to the
> implementation - as a autowired service or just as framework whos  
> classes I
> must instantiate and use appropriately?  Is there a transformer in the
> databinding framework to convert between Document to Java  
> (something like
> OMElement2Java or Java2OMElement) ?

I would think the builder would autowire to the framework somehow.  
Raymond, any details?

>
> 3) In the ComponentLoader where PropertyValue instances are created  
> (as a
> result of property specification in the component defn) why can't  
> it be that
> 'PropertyValue' instances are first created for all 'Property'  
> instances as
> found in the componentType.  Then the values are set either to  
> whatever is
> specified for value in the component definition or to whatever is  
> available
> in  'DefaultValue' attribute of the Property class.  So,  when the  
> component
> builders are called, the component defn. instances that are passed  
> will be
> already populated with property values.  Is this thinking right?

I was thinking the builder would just look for the PropertyValue  
first and then if nothing was specified go to the default. That  
avoids copying the values, and allows for the case where the value is  
totally undefined (e.g. optional with no default).

> Again over
> here, to convert the values specified in the component defns. I  
> guess we
> should employ the databinding framework - right?

Yes.

>
> 4) In the current implementation of ComponentLoader, while create a
> PropertyValue the 'JavaType' attribute of the property seems to be  
> required
> so that the right object factories can be created.  However this  
> JavaType
> attribute is never set and this results in a NPE.  I guess if the
> databinding framework is going to be used here to convert Document  
> data to
> java objects this problem would be resolved - is this right?

The ComponentLoader still needs to be converted to using the DOM form  
and have all the xpath stuff added. I think this is just a bug that  
should go away when these changes are made. I don't think anyone is  
working on that.

>
> 5) Finally (if you have managed to bear with me until this  
> point :)), why is
> it that I must deal with an object factory to get a property  
> value.  Can I
> not be allowed to simply access it as 'propertyValue.getValue()'.   
> Now it
> seems like I must do a propertyValue.getValueFactory().getInstance 
> () to get
> the value of a property.   Why?

Because the value may need to be injected multiple times which may  
involve creating different instances of it to avoid aliasing bugs.

--
Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org