Thanks a lot Kristian,

for the archives t5 doc on ServiceOverride is currently here:

 http://tapestry.apache.org/ioc-cookbook-overriding-ioc-services.html


I 've read it and learned about overriding, but I think that although they
're useful to achieve what I need..., I think as if they were thought to
solve more complicated problems.

Concisely what I want is to get a Service from a 3rd party module and change
one of it's properties, any ideas on the simplest way to do it without
instantiating the whole object again?

Nicolás.-


On Tue, Jan 25, 2011 at 8:41 AM, Kristian Marinkovic <
kristian.marinko...@porscheinformatik.at> wrote:

> Hi Nicolas,
>
> you can't contribute if you only have a string or no parameter. it has to
> be either a map, a list or a collection.
>
> you can contribute a ServiceOverride to replace a service with another
> implementation (see documentation)
>
> g,
> kris
>
>
>
>
>
> Von:    Nicolas Barrera <nbarr...@gmail.com>
> An:     Tapestry users <users@tapestry.apache.org>
> Datum:  21.01.2011 17:27
> Betreff:        Re: Question on Tapesry Services IoC
>
>
>
> Thanks Kristian,
>
> first I want to ask a conceptual question:
>
> if a build method receives for example a String value not a map,... can I
> contribute to that build method using Configuration/OrderedConfiguration?
>
> what if the build method has no parameters?, is it possible to contribute?
>
>
> in practice...,
> now I 'm facing this problem:
>
> I need to override a property from the service
> AuthenticationProcessingFilter, (this is from tapestry-spring-security.. I
> can't modify that code):
>
> here's it's build method
>
>    @Marker(SpringSecurityServices.class)
> >     public static AuthenticationProcessingFilter
> > buildRealAuthenticationProcessingFilter(
> >             @SpringSecurityServices
> >             final AuthenticationManager manager, @SpringSecurityServices
> >             final RememberMeServices rememberMeServices, @Inject
> >             @Value("${spring-security.check.url}")
> >             final String authUrl, @Inject
> >             @Value("${spring-security.target.url}")
> >             final String targetUrl, @Inject
> >             @Value("${spring-security.failure.url}")
> >             final String failureUrl) throws Exception {
> >         AuthenticationProcessingFilter filter = new
> > AuthenticationProcessingFilter();
> >         filter.setAuthenticationManager(manager);
> >         filter.setAuthenticationFailureUrl(failureUrl);
> >         filter.setDefaultTargetUrl(targetUrl);
> >         filter.setFilterProcessesUrl(authUrl);
> >         filter.setRememberMeServices(rememberMeServices);
> >         filter.afterPropertiesSet();
> >         return filter;
> >     }
> >
> What I 'd like to do is to have something like filter.set
> AlwaysUseDefaultTargetUrl(true) in my own AppModule as a contribution
>
>
> Here, for example is another build method from the same library module,
> which uses that object:
>
>    @Marker(SpringSecurityServices.class)
> >     public static HttpServletRequestFilter
> > buildAuthenticationProcessingFilter(
> >             final AuthenticationProcessingFilter filter) throws
> Exception {
> >         return new HttpServletRequestFilterWrapper(filter);
> >     }
> >
>
>
> I 'd need some advice on how to "contribute" and set that property to the
> required value in my AppModule, I guess that in the
> tapestry-spring-security
> site they say something about overriding values using contributeAlias, but
> as I 'ver read that this type of contribution is going to be deprecated on
> 5.3 I didn't try that way yet.
>
> hope I was clear,
>
> thanks as usual...
>
> Nicolás.-
>
>
> On Thu, Jan 20, 2011 at 9:01 AM, Kristian Marinkovic <
> kristian.marinko...@porscheinformatik.at> wrote:
>
> > 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