Further to my last mail I think it could be possible to have a module
method convention like:

        public static com.acme.service.MyService bindByConfiguration() {
        }

This would look for a symbol "com.acme.service.MyService" based on the
return type and use a variant on the ConstructorServiceCreator to
instantiate the service.

Or perhaps a ServiceBinder.bind(MyService.class,
"the.symbol.name.for.impl.class") method would work. It seems a bit
tidier.

Either should be possible since ServiceBuilderMethodInvoker is able to
resolve symbols as parameters via
InternalUtils.calculateParametersForMethod. It's just that the current
code/encapsulation level isn't really geared for what I want to do -- I
need a bit of both ConstructorServiceCreator and
ServiceBuilderMethodInvoker. But I'll keep digging.

Regards, Alfie.

-----Original Message-----
From: Massimo Lusetti [mailto:mluse...@gmail.com] 
Sent: 14 July 2009 13:47
To: Tapestry users
Subject: Re: Dynamic service binding based on symbol source

On Tue, Jul 14, 2009 at 2:43 PM, Alfie
Kirkpatrick<alfie.kirkpatr...@ioko.com> wrote:


> I would like to instantiate a different service implementation
depending
> on property file configuration, eg. a stub for testing and a real
> service for deployments. I'd like to put the FQN in my property file
> which is then wrapped in a SymbolProvider.

I highly suggest you to build a chain of command or a strategy pattern
depending on service type and let the IoC do the work for you.

-- 
Massimo
http://meridio.blogspot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to