hi nicloas,

you could use a builder method to decouple tapestry ioc from 3rd party 
libraries/constructors

public SomethingManager buildSomethinManager(Map<> map, ...)
{
     return new SomethingManger(map, ... );
}

public void contributeSomethingManager(MappedConfiguration<> map)
{}

g,
kris


Von:    Nicolas Barrera <nbarr...@gmail.com>
An:     Tapestry users <users@tapestry.apache.org>
Datum:  20.01.2011 12:55
Betreff:        Re: Question on Tapesry Services IoC



Thanks Josh,

sorry for my verbosity

So in order to use contributions to a Service (SomethingManager) through a
MappedConfiguration,

this SomethingManager should have a constructor that receives the
corresponding Map, and tapestry will inject the contributed
MappedConfiguration into it?

ok i got it..., tomorrow  I m going to test it on code.., the thing is 
that
in my case SomethingManager is a 3rd party class 
(tapestry-spring-security)
but i think i can handle it with this information.

thanks for the concept.

Do you know why will Alias Contributions be deprecated? I guess that what
you explained me will be the defacto way of contributing and overriding
contributions?

thanks again and cheers

Nicolás.-


On Wed, Jan 19, 2011 at 8:04 PM, Josh Canfield 
<joshcanfi...@gmail.com>wrote:

> You had me all the way up until you started talking about what you
> wanted to do. Here is a short primer:
>
> You have a service that manages a collection of Something:
>
> private Map<String, Something> allMyConfiguredSomethings;
>
> // I get my Somethings in the constructor
> public SomeThingManagerImpl(Map<String, Something> somethingMap) {
>    this.allMyConfiguredSomethings = somethingMap;
> }
>
> // In your app module you tell tapestry about your SomethingManager
> service.
>
>  public static void bind(ServiceBinder binder) {
>        binder.bind(SomethingManager.class, SomethingManagerImpl.class);
>  }
>
> // and  tell the something manager which somethings it's going to manage
>
> public static void
> contributeSomethingManager(MappendConfiguration<String, Something>
> configuration) {
>  // put items in that eventually end up in SomethingManager
> }
>
> MappedConfiguration has an override method which you can use to set a
> value on top of another from within your contribute method.
>
> Josh
>
> On Wed, Jan 19, 2011 at 12:09 PM, Nicolas Barrera <nbarr...@gmail.com>
> wrote:
> > Hi,
> >
> > I 'm trying to understand how does Tapestry IoC works.., I 'm 
currently
> > reading the new docs and I 'm also putting my hands on an example I 
got
> on a
> > working application.
> >
> > What I can't understand yet is how does contribution works,
> >
> > I got that you can define a Service like:
> >
> > public static SaltSourceService buildXxx(...) {
> >>
> >
> > and that you can configure Xxx's dependencies contributing with:
> >
> > public static void contributeXxx(final MappedConfiguration<String,
> String>
> >> configuration) {
> >>
> >
> > where you add entries to the parameter received map, but... in the
> example I
> > 'm looking at, I only see values being put in the map but never
> retrieved,
> >
> > would I be looking at an incomplete example or there's some tapestry
> magic
> > over this?
> >
> >
> > The example I mention is an application which uses
> tapestry-spring-security
> > and I want to override a property value from a service,
> > I want to set service AuthenticationProcessingFilter's property
> > alwaysUseDefaultTargetUrl to true in my AppModule.
> >
> > hope someone throws some light on this one as it usually happens here 
in
> the
> > ml :)
> >
> > cheers,
> > Nicolás.-
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to