On Sat, Dec 15, 2001 at 01:26:05PM -0800, Craig R. McClanahan wrote:
> There's been a lot of interest, both here (COMMONS-DEV), on the Struts
> mailing lists, and elsewhere in the idea of a JavaBean-like thing where
> the set of properties can be dynamically defined. If support for this was
> integrated into the BeanUtils package in Commons, we could also make the
> methods in BeanUtils and PropertyUtils treat the properties of these beans
> like they do for regular JavaBeans, and thus be able to leverage them in
> environments based on BeanUtils (such as Struts).
>
> The purpose of this email is to summarize a set of design requirements for
> discussion purposes, so we can coalesce on a design and then get it
> implemented. For extra fun, I've thrown in a very-raw idea of what the
> APIs might look like -- but I'd like to have the group's agreement before
> turning that into code.
>
> Before embarking on the actual development of dynamic beans support, we
> should also do a release of BeanUtils with the current enhancements, to
> provide a stable starting point.
>
> Please let me know what you think!
>
>
> BACKGROUND:
>
> The purpose of the DynaBean design (I'm not firmly attached to the name,
> but kinda like it :-) is to support application programming designs based
> on JavaBeans design patterns, but where the static nature of JavaBeans
> themselves (i.e. the fact that the set of properties is fixed at compile
> time) is too restrictive. Some typical use cases for such a capability:
>
> * A bean object that represents a Row from a JDBC ResultSet
> (the names and types of the column properties cannot be known
> in advance because they are based on the SELECT statement).
>
> * A way to construct and use "value objects" that extract the
> properties of an EJB into a structure that can be utilized by a
> presentation tier technology such as JSP pages, without having
> to hand code the value object.
>
> * A way to capture *all* of the request parameters from a servlet
> request as a single object.
>
> * A way to dynamically represnt XML input data as a tree of Java objects.
>
>
> DESIGN REQUIREMENTS:
>
> * Support a completely arbitrary set of properties and corresponding
> values, with the ability to add and remove properties dynamically.
>
> * Support the ability to dynamically register the set of property
> names that are allowed, and then enforce storing only those
> property names.
>
> * Support the ability to register data types (Java classes) for each
> property, along with the names, with automatic type checking.
>
> CONCEPTUAL API:
>
> public interface DynaBean {
>
There is a very interesting article on "transparent data piplines"
(http://www.onjava.com/pub/a/onjava/2001/12/12/tdp.html). Neither
the intent nor the solution is exactly the same, but rather similar.
The similarity is that both of them wants to give a data structure
that can encapsulate dynamic data but can be accessed in a uniform way.
The author's solution is to map the W3C's infoset to a java object tree.
The data structures are more or less interchangeable (Dynabean seems
to be a bit more scriptable), but the article raises some interesting
usage environments, where the inherently hierarchical nature of it's
design can be convenient.
incze
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>