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

Reply via email to