You can't get the Registry, but you can get an ObjectLocator, which includes
all the key methods of Registry.  This can be injected into your
ServiceFactory implementation.

On 5/16/07, Mark Addleman <[EMAIL PROTECTED]> wrote:

I'd like to use tapestry-ioc outside the context of a web app but I'm
running into a conceptual problem.  I need to create and destroy objects in
response to asynchronous events, so I've defined the following interface:

public interface ServiceFactory
{
   public Service createService(Registry registry);
}

I pass the registry object so the service factory can look up all the
necessary services in order to construct the particular service.

I'd like the event publisher to be in the Tapestry Registry with the
following interface:

public interface EventPublisher
{
    public void addServiceFactory(ServiceFactory factory);
}

The problem is, I don't know how to get the registry object into the
EventPublisher's implementation.  Ideally, I'd like to inject the Registry
into the EventPublisherImpl's constructor, but I know that's impossible
under 5.0.4's implementation.  What do you think about enhancing injection
to support this kind of bootstrapping?




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Reply via email to