I'm not very keen on injecting the Module instance into a CSI.  I
consider the Module to be part of the internals of HiveMind and want
to hide it as much as possible from end-user code.

I strongly object to injecting or otherwise exposing the Registry;
anything you'd need from the Registry is available from the Module,
and will do visibility checks properly from the Module.


On Wed, 27 Oct 2004 15:03:38 +0200, Knut Wannheden
<[EMAIL PROTECTED]> wrote:
> I haven't thought to hard about it either, but I think you're right:
> it would need a reference to the Registry or any Module object.  Since
> I don't think it's currently possible to inject either of these into
> the core implementation it would have to be a method parameter.
> Shouldn't be a problem for factory services which do have access to
> the invoking Module object.
> 
> Note that we already have a class named DependencyDescriptor in
> HiveMind. And wouldn't it almost be easier for the client to perform
> the dependency injection itself than using this 2nd method?  E.g.
> 
> PropertyUtils.write(dependentObject, propertyName,
> Registry.getService(dependencyId);
> 
> instead of:
> 
> serviceInjector.injectDependencies(registry, dependentObject, new
> DependencyDescriptor[] { new DependencyDescriptorImpl(dependencyType,
> propertyName, dependencyId) });
> 
> But instead of an array of DependencyDescriptors the client could
> maybe pass a set of objects, which the service could select from for
> the injection.
> 
> --knut
> 
> On Wed, 27 Oct 2004 08:36:42 -0400, James Carman
> 
> 
> <[EMAIL PROTECTED]> wrote:
> > Do you think it would be overkill to also provide a method which performs
> > specified injection?  Something like this...
> >
> > public void injectDependencies( Registry registry, Object dependentObject );
> > public void injectDependencies( Registry registry, Object dependentObject,
> > DependencyDescriptor[] dependencies );
> >
> > A DependencyDescriptor would look like...
> >
> > public class DependencyDescriptor
> > {
> >   public Class getDependencyType();
> >   public String getPropertyName();
> >   public String getDependencyId();
> > }
> >
> > Basically, this is for when you have multiple service points with the same
> > service interface.  I added the Registry parameter because I don't know
> > whether or not this should be a service.  Maybe it could just be a helper
> > method somewhere (or added to Registry itself).  Wouldn't we run into a
> > chicken and egg situation if we wanted to make this a service?  I mean, what
> > builds the service implementation for this service?  BuilderFactory?  But,
> > what does BuilderFactory use to wire together the implementation object?
> > Even if we make it a primitive service (which I don't think is built by
> > BuilderFactory), what injects its dependencies?  I may be wrong here, as I
> > haven't really thought through it completely (need more coffee), but
> > something just doesn't smell right to me (maybe I need a shower too).
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to