If you require wiring of "beans" (not hivemind services), I'd look for
an aspect-oriented solution.  The spring framework supports this
through the @Configurable annotation.  It wouldn't be too tough to
come up with something like that for HiveMind.  I did some work
enabling AspectJ and HiveMind
(http://svn.javaforge.com/svn/hivemind/hivemind-aspectj).  That could
get you started.  Basically, what you need is an aspect that can
autowire a bean given a HiveMind registry.  The trick is setting the
registry property of the aspect, but that shoulnd't be too tough with
a custom factory of some sorts (like I do in hivemind-aspectj, but
you'd just set the registry property on the aspect instance).

On 7/12/07, Johan Lindquist <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stephane,

My ask first what you exactly are trying to do?  What is the reason you
would like to define the parent/child object within Hivemind and then
persist them?

Are the parent/child objects not simple beans just now which (without
involving hivemind) can be stored/retrieved etc using the DAO service
(which is defined in Hivemind as a service)?

Cheers,

Johan

Stephane Decleire wrote:
> ================
> Approach 1 :
>
> I have two pojos : Parent and Child with there respective interface
> IParent and IChild.
>
> public Interface IParent {
>     public void setChild(IChild child);
>     public IChild getChild();
> }
>
> In Hivemind, i have declared the services below :
>
>   <service-point id="Parent" interface="IParent">
>       <invoke-factory>
>           <construct class="Parent">
>                 <set-object property="child" value="service:Child"/>
>           </construct>
>       </invoke-factory>
>   </service-point>
>
>   <service-point id="Child" interface="IChild">
>       <invoke-factory>
>           <construct class="Child"/>
>       </invoke-factory>
>   </service-point>
>
>
> Hivemind works with interfaces so, in my code, i get a child from its
> parent :
>     IChild child1 = parent.getChild();
> Using this approach, i assume that child1 is in fact a Hivemind proxy on
> my child1 pojo (tell me if i'm wrong). So i can't convert IChild into
> Child ...
>
> And then, i would like to persist my pojo child1 using a DAO :
>
> public Interface IChildDao {
>     public void persist(IChild child);
> }
>
> But Hibernate doesn't know how to persist IChild because what it really
> try to persist is a Hivemind proxy !
>
> ================
> Approach 2 :
>
> I know that Hibernate isn't able to persist the interface so the my DAO
> interface becomes :
>
> public Interface IChildDao {
>     public void persist(Child child);
> }
>
> So i need to get the instance of my pojo Child and not an interface from
> my pojo Parent :
>     Child child1 = parent.getChild();
>
> That's implies that my parent interface becomes :
>
> public Interface IParent {
>     public void setChild(Child child);
>     public Child getChild();
> }
>
> And in this case Hivemind doesn't build my services !
>
> I can't find the architecture which satisfies both framework ...
> Any help would be very appreciated !
>
> Stephane.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGlkJm1Tv8wj7aQ34RAh+yAJ40Nv8xouId2bclT0z5e/swnJJnGACbBtS2
n+vhFnCEXUC+LHDgURkiYYU=
=YE45
-----END PGP SIGNATURE-----

Reply via email to