[Yanel-dev] Moving toward the node based repository interface
Andreas Wuest
awuest at student.ethz.ch
Thu Feb 15 18:26:41 CET 2007
Hi
Here's a short summary of what we've discussed today with regard to the
node based repository interface.
In the long and medium term, we would like to move to a node interface
which contains typed properties (we already have that), and a default
property (which we don't have yet). On those properties, getType() can
be called to enquire for the property's type. If the type is e.g.
binary, then getInputStream() should be called to retrieve its value, if
the type is character, then getReader(), etc.
The default property marks one of the properties as kind of "main". A
node would also implement the Property interface, whose methods would be
used as a shortcut to access the node's default property.
When creating new nodes, not only should the creation method be
parametrised with the distinction between collection and resource, but
also with the content type (in case it is a resource). Subsequently, the
correct method should be called to set the content of the default
property, e.g. getOutputStream() for binary resources, getWriter() for
character resources, etc.
Since this would require some refactoring, we decided to just implement
an isBinary() method on the node, in order to be able to decide if
getInputStream() or getReader() should be called to read the content's
of the resource. The downside of this is that we can only distinguish
between character data and binary data, and therefore lose type
information, if the repo back-end had provided some (e.g. using an SQL
resource, whose values sport much finer-grained type information than
only character and binary).
--
Kind regards,
Andi
More information about the Yanel-development
mailing list