On Feb 1, 2008, at 9:34 AM, Kevan Miller wrote:

On Feb 1, 2008, at 11:23 AM, [EMAIL PROTECTED] wrote:

Author: dain
Date: Fri Feb  1 08:23:21 2008
New Revision: 617547

URL: http://svn.apache.org/viewvc?rev=617547&view=rev
Log:
Work in progress on graph building

Hey Dain,
Having fun? ;-)

Can you give us an idea on what you mean by graph building and where you're heading with this?

Lately, I have been working on replacing the simple DI code in plexus with xbean-reflect. Plexus currently doesn't support lost of stuff like constructor injection, static factory injection or factor beans. The idea is that instead of trying to add these features to the current DI code in plexus that we make the DI engine pluggable, and xbean-reflect will be the first plugin (with pico to follow).

Currently, xbean-reflect can build a single object instance by specifying the instance class and properties. The value of the properties can be either an object or a "recipe" describing how to build another object instance. So, if you sit back and think about it, xbean-reflect can currently build a tree of object instances (child nodes are object instances created and injected into the outer object). For plexus, we need to support having references between objects by name.

The new code adds a name to each recipe and a reference recipe. With these two small additions, we have all the information necessary to build a complex object graph. The hard part of this change was not expanding the build logic to support refs (I copied my code from CXF that does the same thing for RPC-Encoded), it was figuring out how to expose the feature, and this is one of the big things I'm still testing up. If you want to see how it works in detail, take a look at the AbstractObjectGraphTest. From the high level you create an ObjectGraph, and load it up with recipes for all the objects you can create. Then say, "create me foo" and the code creates the object named foo. It is pretty simple.

If there is anything else you want to know let me know. It is still a work in progress (I'm hacking on it today).

-dain




Reply via email to