Re: Using registry in a factory

2007-05-17 Thread Mark Addleman
I tried injecting an ObjectProvider into my AppModule buildService method, but 
it doesn't work.  Tapestry reports that Service id "ObjectLocator" isn't 
defined by any module.  I see that the MasterObjectProvider is available, but I 
don't think that's what I want.

Here's my code:
static public ServiceFactory buildServiceFactory(@InjectService("ObjectLocator")
ObjectLocator objectLocator) throws Exception
{

}
 
Any suggestions?




- Original Message 
From: Howard Lewis Ship <[EMAIL PROTECTED]>
To: Tapestry users 
Sent: Wednesday, May 16, 2007 2:55:44 PM
Subject: Re: Using registry in a factory

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






Re: Using registry in a factory

2007-05-16 Thread Howard Lewis Ship

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


Using registry in a factory

2007-05-16 Thread Mark Addleman
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?