I would like to get started on support for for XPath in SCDL as it is
part of the recent SCA spec changes. This will likely require
changes to the loader infrastructure and in particular
StringParserPropertyFactory. Instead of having a PropertyFactory
create an ObjectFactory responsible for returning a value that is
injected into a component implementation instance, we will need to
have a more flexible approach as property values may now be based off
of XPath expressions to composite properties.
What I would like to propose is that we have creation of the
ObjectFactory for the property handled by the builder in much the
same way as it handles wires. I think we can leverage the data
transformation service for this. In this case, the builder will be
given a representation of the parsed XML, probably DOM. If the
property value was an XPath expression, the builder will have to use
an XPath engine to evaluate and retrieve this actual value (Jaxen?)
represented as a Node. The builder will then in turn use the
transformation service to create a "bound type". The builder will
subsequently create an ObjectFactory for the bound type responsible
for injecting on the target component implementation instance. The
specific kind of ObjectFactory will depend on the kind of property it
is:
- If it is immutable, the builder will use a SingletonObjectFactory
- If it is mutable, but the property is configured as "safe" (i.e.
the component does not mutate it), the builder will use a
SingletonObjectFactory). We can also assume by default values are
"safe" unless explicitly marked.
- If it is mutable, marked "not safe," and Cloneable, a
CloningObjectFactory is used which clones on getInstance()
-If it is mutable, marked "not safe" and is not Cloneable, the
builder avoids the call to the transformation service and instead
uses an ObjectFactory which calls out the to transformation service
on every getInstance() invoke.
For some implementation types, a builder may not want to use
ObjectFactory (perhaps the implementation just takes a DOM or some
other format). In that case, the builder would be free to use the
transformation service or not.
Raymond, does this sound like it would fit with the transformation
service? If so, I think we need to look at incorporating the base
data transformation framework into SPI and core.
I'd also be willing to work on an XStream binding extension which
would enable handling of basic POJO binding.
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]