You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-dev@geronimo.apache.org by Kevan Miller <ke...@gmail.com> on 2008/02/01 18:34:25 UTC

Re: svn commit: r617547 [1/3] - in /geronimo/xbean/trunk/xbean-reflect/src: main/java/org/apache/xbean/recipe/ test/java/org/apache/xbean/recipe/

On Feb 1, 2008, at 11:23 AM, dain@apache.org 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?

--kevan

Re: svn commit: r617547 [1/3] - in /geronimo/xbean/trunk/xbean-reflect/src: main/java/org/apache/xbean/recipe/ test/java/org/apache/xbean/recipe/

Posted by Dain Sundstrom <da...@iq80.com>.
On Feb 1, 2008, at 9:34 AM, Kevan Miller wrote:

> On Feb 1, 2008, at 11:23 AM, dain@apache.org 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