You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ivan Dubrov <wf...@gmail.com> on 2007/05/27 17:03:00 UTC

Component transformation: how to extend method at the beginning

Hello,

I'm trying to implement an AcegiWorker that will add support for Acegi
"Secured" annotation to components. Annotation applied to the class will
enable security check when the page is attached and annotation applied
to the method will enable security check when method is called (for
example, event). However, I do not see a way to add some code at the
method beginning in the "ClassTransformation" interface. I see
"addMethod", but if I use it it completely replaces the method of the
transformed component.

How can I implement this functionality (I want the ability to secured
particular methods of the page, primarily for securing event handlers)?

-- 
WBR,
Ivan S. Dubrov



Re: Lehky_SPAM: Re: T5 Decoupling a Template From its Component Class

Posted by Juan Maya <ma...@gmail.com>.
yes, that;s still supported and documented here:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html

On 5/31/07, Jiri Mares <Ji...@svt.cz> wrote:
>
>
> Hi Howard,
>
> I would like to ask, whether there is still possibility to have localized
> templates?
>
> eg.
>
> org/example/myapp/components/CClamp.html
> org/example/myapp/components/CClamp_en.html
> org/example/myapp/components/CClamp_en_US.html
> org/example/myapp/components/CClamp_de.html
>
> Thanks
>
> Howard Lewis Ship napsal(a):
> > There are internal services that can be overridden to handle those kinds
> of
> > situations.
> >
> > The goal is to create something that works amazingly well for all the
> more
> > typical cases, then start going after these others.  Often it will
> involve
> > moving a private interface out into the public space ... but once that's
> > done, its very hard to change the interface in the future without
> breaking
> > backwards compatibility, so we're pretty conservative about pulling back
> > the
> > curtain until we know the interface is full and complete.
> >
> > On 5/30/07, David Kendall <da...@lithium.com> wrote:
> >>
> >> I am a Tapestry newbie getting up to speed on Tap 5. I am working on an
> >> application with extensive co-branding requirements.
> >>
> >> As I understand things, there is - by default - a tight coupling
> between
> >> a component class name and its template path. For example - if a
> >> component has a FQCN of...
> >>
> >> org.example.myapp.components.CClamp
> >>
> >> ...then the template has to be on the classpath as....
> >>
> >> org/example/myapp/components/CClamp.html
> >>
> >> It would be very helpful if the mapping between the component and the
> >> template could be decoupled - this would allow me to pull in component
> >> templates that have been tweaked for a particular co-brand.
> >>
> >> For example - I might want to have a template on the class path as
> >>
> >> org/example/myapp/override/cobrand1/components/CClamp.html
> >>
> >> Is there any way to do this?
> >>
> >> Thanks in advance.
> >>
> >> David Kendall
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
>
> --
> Jiří Mareš (mailto:Jiri.Mares@svt.cz)
> ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
> Czech Republic
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Lehky_SPAM: Re: T5 Decoupling a Template From its Component Class

Posted by Jiri Mares <Ji...@svt.cz>.
Hi Howard,

I would like to ask, whether there is still possibility to have localized templates?

eg.

org/example/myapp/components/CClamp.html
org/example/myapp/components/CClamp_en.html
org/example/myapp/components/CClamp_en_US.html
org/example/myapp/components/CClamp_de.html

Thanks

Howard Lewis Ship napsal(a):
> There are internal services that can be overridden to handle those kinds of
> situations.
> 
> The goal is to create something that works amazingly well for all the more
> typical cases, then start going after these others.  Often it will involve
> moving a private interface out into the public space ... but once that's
> done, its very hard to change the interface in the future without breaking
> backwards compatibility, so we're pretty conservative about pulling back
> the
> curtain until we know the interface is full and complete.
> 
> On 5/30/07, David Kendall <da...@lithium.com> wrote:
>>
>> I am a Tapestry newbie getting up to speed on Tap 5. I am working on an
>> application with extensive co-branding requirements.
>>
>> As I understand things, there is - by default - a tight coupling between
>> a component class name and its template path. For example - if a
>> component has a FQCN of...
>>
>> org.example.myapp.components.CClamp
>>
>> ...then the template has to be on the classpath as....
>>
>> org/example/myapp/components/CClamp.html
>>
>> It would be very helpful if the mapping between the component and the
>> template could be decoupled - this would allow me to pull in component
>> templates that have been tweaked for a particular co-brand.
>>
>> For example - I might want to have a template on the class path as
>>
>> org/example/myapp/override/cobrand1/components/CClamp.html
>>
>> Is there any way to do this?
>>
>> Thanks in advance.
>>
>> David Kendall
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
Jiří Mareš (mailto:Jiri.Mares@svt.cz)
ČSAD SVT Praha, s.r.o. (http://www.svt.cz)
Czech Republic

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


Re: Antwort: Re: Antwort: RE: T5 Decoupling a Template From its Component Class

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Tue, 2007-07-03 at 08:27 +0200, Kristian Marinkovic wrote:
> 
> just remove the InjectService annotation from your service  
> method and try it again :)
Cool, really easy :)

Thanx a lot,
cheers,
Martin


> 
> 
> 
> Martin Grotzke
> <ma...@javakaffee.de> 
> 
> 02.07.2007 16:50 
>         Bitte antworten an
>          "Tapestry users"
>     <us...@tapestry.apache.org>
> 
> 
> 
> 
>                An
> Tapestry users
> <us...@tapestry.apache.org> 
>             Kopie
> 
>             Thema
> Re: Antwort: RE:
> T5 Decoupling a
> Template >From
> its Component
> Class
> 
> 
> 
> 
> 
> 
> 
> 
> On Mon, 2007-07-02 at 16:06 +0200, Kristian Marinkovic wrote:
> > 
> > service implementations contributed to the alias service will  
> > override the other service implementations. this is also true for 
> > implementations originally provided by tapestry 
> > 
> > the additional id is to distinguish multiple implementations of the 
> > same interface. in your case you should only need it twice: 
> > 1) to define your service 
> > 2) to contribute to the alias service.... then you can forget it :) 
> 
> If I understand you correctly, you say that 
> 
>   public static PageResponseRenderer decoratePageResponseRenderer(
>           @InjectService("PageMarkupRenderer")
>           final PageMarkupRenderer markupRenderer,
>           @InjectService("MarkupWriterFactory")
>           final MarkupWriterFactory markupWriterFactory,
>           final Object delegate )
> 
> should provide our custom MarkupWriterFactory?
> This is not the fact - with @InjectService("MarkupWriterFactory")
> T5 provides its MarkupWriterFactoryImpl and not our custom
> MarkupWriterFactory.
> Did I understand you wrong, or is this a "bug" in T5?
> 
> Cheers,
> Martin
> 
> 
> 
> > 
> > g, 
> > kris 
> > 
> > 
> > 
> > Martin Grotzke
> > <ma...@javakaffee.de> 
> > 
> > 02.07.2007 14:10 
> >         Bitte antworten an
> >          "Tapestry users"
> >     <us...@tapestry.apache.org>
> > 
> > 
> > 
> > 
> >                An
> > Tapestry users
> > <us...@tapestry.apache.org> 
> >             Kopie
> > 
> >             Thema
> > RE: T5 Decoupling
> > a Template From
> > its Component
> > Class
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Mon, 2007-07-02 at 11:03 +0200, Kristian Marinkovic wrote:
> > > 
> > > hi martin, 
> > > 
> > > if you use the ServiceBinder to contribute a class that implements
> > an
> > > already 
> > > "contributed" interface you have to assign an id for your class by
> > > invoking withId, 
> > > because the Interface is no longer sufficient to identifiy the
> > service
> > > 
> > >  binder.bind(PageTemplateLocator.class, 
> > >         MyPageTemplateLocatorImpl.class).withId("myLocator"); 
> > > 
> > > furthermore you have to contribute to the aliasOverrides Service 
> > > to actually replace the old implementation: 
> > > 
> > > public static void contributeAliasOverrides( 
> > >             @InjectService("myLocator") PageTemplateLocator
> > locator, 
> > >             Configuration<AliasContribution> configuration) { 
> > >              
> > >    configuration.add( 
> > >          AliasContribution.create( 
> > >                  PageTemplateLocator.class, locator)); 
> > 
> > Great, this works - thanx a lot!
> > 
> > Just for clarification: the specified id has to be used anywhere
> else,
> > right? E.g. for us the service in question is the
> MarkupWriterFactory,
> > and previously we also had this in our AppModule:
> > 
> >    public static PageResponseRenderer decoratePageResponseRenderer(
> >            @InjectService("PageMarkupRenderer")
> >            final PageMarkupRenderer markupRenderer,
> >            @InjectService("MarkupWriterFactory")
> >            final MarkupWriterFactory markupWriterFactory,
> >            final Object delegate )
> > 
> > which we have to change to @InjectService("myMarkupWriterFactory")
> > then.
> > Is this the intended way? Is it guaranteed, that T5 does not
> reference
> > the MarkupWriterFactory implementation by the id
> > "MarkupWriterFactory"?
> > 
> > Thanx && cheers,
> > Martin 
> > 
> > 
> > > 
> > > 
> > > g, 
> > > kris 
> > > 
> > > 
> > > 
> > > Martin Grotzke
> > > <ma...@javakaffee.de> 
> > > 
> > > 02.07.2007 10:00 
> > >         Bitte antworten an
> > >          "Tapestry users"
> > >     <us...@tapestry.apache.org>
> > > 
> > > 
> > > 
> > > 
> > >                An
> > > Tapestry users
> > > <us...@tapestry.apache.org> 
> > >             Kopie
> > > 
> > >             Thema
> > > RE: T5 Decoupling
> > > a Template From
> > > its Component
> > > Class
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > > Digging through the code I notice there is a PageTemplateLocator
> > > > interface which seems like the appropriate service to override.
> > What
> > > I
> > > > have tried is to add the following method to my AppModule
> > class....
> > > > 
> > > > 
> > > > public static void bind(ServiceBinder binder) {
> > > >   ServiceBindingOptions options = 
> > > >                                   binder.bind(
> > > >
> > >  PageTemplateLocator.class,
> > > >
> > >  MyPageTemplateLocatorImpl.class
> > > >                                                    );
> > > > }
> > > > 
> > > > 
> > > > ...but I get the following exception at startup.....
> > > > 
> > > > 
> > > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > > already
> > > > been defined by
> > > 
> > > Did you solve this issue? I get the same exception with another
> > > Service
> > > that's defined in TapestryModule that I want to override in my
> > > AppModule
> > > with my custom implementation...
> > > 
> > > Thx && cheers,
> > > Martin
> > > 
> > > 
> > > On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > > > > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > > > > Sent: Wednesday, May 30, 2007 5:15 PM
> > > > > There are internal services that can be overridden to handle
> > > those 
> > > > > kinds of situations.
> > > > > The goal is to create something that works amazingly well for
> > all 
> > > > > the more typical cases, then start going after these others.
> > >  Often 
> > > > > it will involve moving a private interface out into the public
> > > space
> > > > ..
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Thanks Howard - I appreciate your prompt response.  However - I
> am
> > > not
> > > > clear if you are saying it cannot be done currently - or if you
> > mean
> > > > that it can be done - but that I would be treading on somewhat
> > > unstable
> > > > ground given that the internal interfaces are subject to change.
> > > > 
> > > > Digging through the code I notice there is a PageTemplateLocator
> > > > interface which seems like the appropriate service to override.
> > What
> > > I
> > > > have tried is to add the following method to my AppModule
> > class....
> > > > 
> > > > 
> > > > public static void bind(ServiceBinder binder) {
> > > >   ServiceBindingOptions options = 
> > > >                                   binder.bind(
> > > >
> > >  PageTemplateLocator.class,
> > > >
> > >  MyPageTemplateLocatorImpl.class
> > > >                                                    );
> > > > }
> > > > 
> > > > 
> > > > ...but I get the following exception at startup.....
> > > > 
> > > > 
> > > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > > already
> > > > been defined by
> > > >
> > >
> >
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> > > > ComponentClassResolver) (at InternalModule.java:231) and may not
> > be
> > > > redefined by
> > > > org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl()
> > (at
> > > > AppModule.java:159). You should rename one of the service
> builder
> > > > methods.
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Am I wasting my time trying this? I can tolerate a certain
> amount
> > of
> > > > instability when pulling in subsequent revisions of Tap5 -
> however
> > -
> > > I
> > > > would like to get a proof of concept up and running if at all
> > > possible.
> > > > 
> > > > Any thoughts on this?
> > > > 
> > > > Thanks again.
> > > > 
> > > > David Kendall
> > > > 
> > > > 
> > > > 
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > 
> > > -- 
> > > Martin Grotzke
> > > http://www.javakaffee.de/blog/
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > -- 
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> -- 
> Martin Grotzke
> http://www.javakaffee.de/blog/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Antwort: Re: Antwort: RE: T5 Decoupling a Template From its Component Class

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
just remove the InjectService annotation from your service 
method and try it again :)




Martin Grotzke <ma...@javakaffee.de> 
02.07.2007 16:50
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Re: Antwort: RE: T5 Decoupling a Template From its Component Class






On Mon, 2007-07-02 at 16:06 +0200, Kristian Marinkovic wrote:
> 
> service implementations contributed to the alias service will 
> override the other service implementations. this is also true for 
> implementations originally provided by tapestry 
> 
> the additional id is to distinguish multiple implementations of the 
> same interface. in your case you should only need it twice: 
> 1) to define your service 
> 2) to contribute to the alias service.... then you can forget it :) 

If I understand you correctly, you say that 

   public static PageResponseRenderer decoratePageResponseRenderer(
           @InjectService("PageMarkupRenderer")
           final PageMarkupRenderer markupRenderer,
           @InjectService("MarkupWriterFactory")
           final MarkupWriterFactory markupWriterFactory,
           final Object delegate )

should provide our custom MarkupWriterFactory?
This is not the fact - with @InjectService("MarkupWriterFactory")
T5 provides its MarkupWriterFactoryImpl and not our custom
MarkupWriterFactory.
Did I understand you wrong, or is this a "bug" in T5?

Cheers,
Martin



> 
> g, 
> kris 
> 
> 
> 
> Martin Grotzke
> <ma...@javakaffee.de> 
> 
> 02.07.2007 14:10 
>         Bitte antworten an
>          "Tapestry users"
>     <us...@tapestry.apache.org>
> 
> 
> 
> 
>                An
> Tapestry users
> <us...@tapestry.apache.org> 
>             Kopie
> 
>             Thema
> RE: T5 Decoupling
> a Template From
> its Component
> Class
> 
> 
> 
> 
> 
> 
> 
> 
> On Mon, 2007-07-02 at 11:03 +0200, Kristian Marinkovic wrote:
> > 
> > hi martin, 
> > 
> > if you use the ServiceBinder to contribute a class that implements
> an
> > already 
> > "contributed" interface you have to assign an id for your class by
> > invoking withId, 
> > because the Interface is no longer sufficient to identifiy the
> service
> > 
> >  binder.bind(PageTemplateLocator.class, 
> >         MyPageTemplateLocatorImpl.class).withId("myLocator"); 
> > 
> > furthermore you have to contribute to the aliasOverrides Service 
> > to actually replace the old implementation: 
> > 
> > public static void contributeAliasOverrides( 
> >             @InjectService("myLocator") PageTemplateLocator
> locator, 
> >             Configuration<AliasContribution> configuration) { 
> > 
> >    configuration.add( 
> >          AliasContribution.create( 
> >                  PageTemplateLocator.class, locator)); 
> 
> Great, this works - thanx a lot!
> 
> Just for clarification: the specified id has to be used anywhere else,
> right? E.g. for us the service in question is the MarkupWriterFactory,
> and previously we also had this in our AppModule:
> 
>    public static PageResponseRenderer decoratePageResponseRenderer(
>            @InjectService("PageMarkupRenderer")
>            final PageMarkupRenderer markupRenderer,
>            @InjectService("MarkupWriterFactory")
>            final MarkupWriterFactory markupWriterFactory,
>            final Object delegate )
> 
> which we have to change to @InjectService("myMarkupWriterFactory")
> then.
> Is this the intended way? Is it guaranteed, that T5 does not reference
> the MarkupWriterFactory implementation by the id
> "MarkupWriterFactory"?
> 
> Thanx && cheers,
> Martin 
> 
> 
> > 
> > 
> > g, 
> > kris 
> > 
> > 
> > 
> > Martin Grotzke
> > <ma...@javakaffee.de> 
> > 
> > 02.07.2007 10:00 
> >         Bitte antworten an
> >          "Tapestry users"
> >     <us...@tapestry.apache.org>
> > 
> > 
> > 
> > 
> >                An
> > Tapestry users
> > <us...@tapestry.apache.org> 
> >             Kopie
> > 
> >             Thema
> > RE: T5 Decoupling
> > a Template From
> > its Component
> > Class
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Digging through the code I notice there is a PageTemplateLocator
> > > interface which seems like the appropriate service to override.
> What
> > I
> > > have tried is to add the following method to my AppModule
> class....
> > > 
> > > 
> > > public static void bind(ServiceBinder binder) {
> > >   ServiceBindingOptions options = 
> > >                                   binder.bind(
> > >
> >  PageTemplateLocator.class,
> > >
> >  MyPageTemplateLocatorImpl.class
> > >                                                    );
> > > }
> > > 
> > > 
> > > ...but I get the following exception at startup.....
> > > 
> > > 
> > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > already
> > > been defined by
> > 
> > Did you solve this issue? I get the same exception with another
> > Service
> > that's defined in TapestryModule that I want to override in my
> > AppModule
> > with my custom implementation...
> > 
> > Thx && cheers,
> > Martin
> > 
> > 
> > On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > > > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > > > Sent: Wednesday, May 30, 2007 5:15 PM
> > > > There are internal services that can be overridden to handle
> > those 
> > > > kinds of situations.
> > > > The goal is to create something that works amazingly well for
> all 
> > > > the more typical cases, then start going after these others.
> >  Often 
> > > > it will involve moving a private interface out into the public
> > space
> > > ..
> > > 
> > > 
> > > 
> > > 
> > > Thanks Howard - I appreciate your prompt response.  However - I am
> > not
> > > clear if you are saying it cannot be done currently - or if you
> mean
> > > that it can be done - but that I would be treading on somewhat
> > unstable
> > > ground given that the internal interfaces are subject to change.
> > > 
> > > Digging through the code I notice there is a PageTemplateLocator
> > > interface which seems like the appropriate service to override.
> What
> > I
> > > have tried is to add the following method to my AppModule
> class....
> > > 
> > > 
> > > public static void bind(ServiceBinder binder) {
> > >   ServiceBindingOptions options = 
> > >                                   binder.bind(
> > >
> >  PageTemplateLocator.class,
> > >
> >  MyPageTemplateLocatorImpl.class
> > >                                                    );
> > > }
> > > 
> > > 
> > > ...but I get the following exception at startup.....
> > > 
> > > 
> > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > already
> > > been defined by
> > >
> >
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> > > ComponentClassResolver) (at InternalModule.java:231) and may not
> be
> > > redefined by
> > > org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl()
> (at
> > > AppModule.java:159). You should rename one of the service builder
> > > methods.
> > > 
> > > 
> > > 
> > > 
> > > Am I wasting my time trying this? I can tolerate a certain amount
> of
> > > instability when pulling in subsequent revisions of Tap5 - however
> -
> > I
> > > would like to get a proof of concept up and running if at all
> > possible.
> > > 
> > > Any thoughts on this?
> > > 
> > > Thanks again.
> > > 
> > > David Kendall
> > > 
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > 
> > -- 
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> -- 
> Martin Grotzke
> http://www.javakaffee.de/blog/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


Re: Antwort: RE: T5 Decoupling a Template From its Component Class

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Mon, 2007-07-02 at 16:06 +0200, Kristian Marinkovic wrote:
> 
> service implementations contributed to the alias service will  
> override the other service implementations. this is also true for 
> implementations originally provided by tapestry 
> 
> the additional id is to distinguish multiple implementations of the 
> same interface. in your case you should only need it twice: 
> 1) to define your service 
> 2) to contribute to the alias service.... then you can forget it :) 

If I understand you correctly, you say that 

   public static PageResponseRenderer decoratePageResponseRenderer(
           @InjectService("PageMarkupRenderer")
           final PageMarkupRenderer markupRenderer,
           @InjectService("MarkupWriterFactory")
           final MarkupWriterFactory markupWriterFactory,
           final Object delegate )

should provide our custom MarkupWriterFactory?
This is not the fact - with @InjectService("MarkupWriterFactory")
T5 provides its MarkupWriterFactoryImpl and not our custom
MarkupWriterFactory.
Did I understand you wrong, or is this a "bug" in T5?

Cheers,
Martin



> 
> g, 
> kris 
> 
> 
> 
> Martin Grotzke
> <ma...@javakaffee.de> 
> 
> 02.07.2007 14:10 
>         Bitte antworten an
>          "Tapestry users"
>     <us...@tapestry.apache.org>
> 
> 
> 
> 
>                An
> Tapestry users
> <us...@tapestry.apache.org> 
>             Kopie
> 
>             Thema
> RE: T5 Decoupling
> a Template From
> its Component
> Class
> 
> 
> 
> 
> 
> 
> 
> 
> On Mon, 2007-07-02 at 11:03 +0200, Kristian Marinkovic wrote:
> > 
> > hi martin, 
> > 
> > if you use the ServiceBinder to contribute a class that implements
> an
> > already 
> > "contributed" interface you have to assign an id for your class by
> > invoking withId, 
> > because the Interface is no longer sufficient to identifiy the
> service
> > 
> >  binder.bind(PageTemplateLocator.class, 
> >         MyPageTemplateLocatorImpl.class).withId("myLocator"); 
> > 
> > furthermore you have to contribute to the aliasOverrides Service 
> > to actually replace the old implementation: 
> > 
> > public static void contributeAliasOverrides( 
> >             @InjectService("myLocator") PageTemplateLocator
> locator, 
> >             Configuration<AliasContribution> configuration) { 
> >              
> >    configuration.add( 
> >          AliasContribution.create( 
> >                  PageTemplateLocator.class, locator)); 
> 
> Great, this works - thanx a lot!
> 
> Just for clarification: the specified id has to be used anywhere else,
> right? E.g. for us the service in question is the MarkupWriterFactory,
> and previously we also had this in our AppModule:
> 
>    public static PageResponseRenderer decoratePageResponseRenderer(
>            @InjectService("PageMarkupRenderer")
>            final PageMarkupRenderer markupRenderer,
>            @InjectService("MarkupWriterFactory")
>            final MarkupWriterFactory markupWriterFactory,
>            final Object delegate )
> 
> which we have to change to @InjectService("myMarkupWriterFactory")
> then.
> Is this the intended way? Is it guaranteed, that T5 does not reference
> the MarkupWriterFactory implementation by the id
> "MarkupWriterFactory"?
> 
> Thanx && cheers,
> Martin 
> 
> 
> > 
> > 
> > g, 
> > kris 
> > 
> > 
> > 
> > Martin Grotzke
> > <ma...@javakaffee.de> 
> > 
> > 02.07.2007 10:00 
> >         Bitte antworten an
> >          "Tapestry users"
> >     <us...@tapestry.apache.org>
> > 
> > 
> > 
> > 
> >                An
> > Tapestry users
> > <us...@tapestry.apache.org> 
> >             Kopie
> > 
> >             Thema
> > RE: T5 Decoupling
> > a Template From
> > its Component
> > Class
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Digging through the code I notice there is a PageTemplateLocator
> > > interface which seems like the appropriate service to override.
> What
> > I
> > > have tried is to add the following method to my AppModule
> class....
> > > 
> > > 
> > > public static void bind(ServiceBinder binder) {
> > >   ServiceBindingOptions options = 
> > >                                   binder.bind(
> > >
> >  PageTemplateLocator.class,
> > >
> >  MyPageTemplateLocatorImpl.class
> > >                                                    );
> > > }
> > > 
> > > 
> > > ...but I get the following exception at startup.....
> > > 
> > > 
> > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > already
> > > been defined by
> > 
> > Did you solve this issue? I get the same exception with another
> > Service
> > that's defined in TapestryModule that I want to override in my
> > AppModule
> > with my custom implementation...
> > 
> > Thx && cheers,
> > Martin
> > 
> > 
> > On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > > > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > > > Sent: Wednesday, May 30, 2007 5:15 PM
> > > > There are internal services that can be overridden to handle
> > those 
> > > > kinds of situations.
> > > > The goal is to create something that works amazingly well for
> all 
> > > > the more typical cases, then start going after these others.
> >  Often 
> > > > it will involve moving a private interface out into the public
> > space
> > > ..
> > > 
> > > 
> > > 
> > > 
> > > Thanks Howard - I appreciate your prompt response.  However - I am
> > not
> > > clear if you are saying it cannot be done currently - or if you
> mean
> > > that it can be done - but that I would be treading on somewhat
> > unstable
> > > ground given that the internal interfaces are subject to change.
> > > 
> > > Digging through the code I notice there is a PageTemplateLocator
> > > interface which seems like the appropriate service to override.
> What
> > I
> > > have tried is to add the following method to my AppModule
> class....
> > > 
> > > 
> > > public static void bind(ServiceBinder binder) {
> > >   ServiceBindingOptions options = 
> > >                                   binder.bind(
> > >
> >  PageTemplateLocator.class,
> > >
> >  MyPageTemplateLocatorImpl.class
> > >                                                    );
> > > }
> > > 
> > > 
> > > ...but I get the following exception at startup.....
> > > 
> > > 
> > > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> > already
> > > been defined by
> > >
> >
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> > > ComponentClassResolver) (at InternalModule.java:231) and may not
> be
> > > redefined by
> > > org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl()
> (at
> > > AppModule.java:159). You should rename one of the service builder
> > > methods.
> > > 
> > > 
> > > 
> > > 
> > > Am I wasting my time trying this? I can tolerate a certain amount
> of
> > > instability when pulling in subsequent revisions of Tap5 - however
> -
> > I
> > > would like to get a proof of concept up and running if at all
> > possible.
> > > 
> > > Any thoughts on this?
> > > 
> > > Thanks again.
> > > 
> > > David Kendall
> > > 
> > > 
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > 
> > -- 
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> -- 
> Martin Grotzke
> http://www.javakaffee.de/blog/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Antwort: RE: T5 Decoupling a Template From its Component Class

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
service implementations contributed to the alias service will 
override the other service implementations. this is also true for
implementations originally provided by tapestry

the additional id is to distinguish multiple implementations of the
same interface. in your case you should only need it twice:
1) to define your service
2) to contribute to the alias service.... then you can forget it :)

g,
kris




Martin Grotzke <ma...@javakaffee.de> 
02.07.2007 14:10
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
RE: T5 Decoupling a Template From its Component Class






On Mon, 2007-07-02 at 11:03 +0200, Kristian Marinkovic wrote:
> 
> hi martin, 
> 
> if you use the ServiceBinder to contribute a class that implements an
> already 
> "contributed" interface you have to assign an id for your class by
> invoking withId, 
> because the Interface is no longer sufficient to identifiy the service
> 
>  binder.bind(PageTemplateLocator.class, 
>         MyPageTemplateLocatorImpl.class).withId("myLocator"); 
> 
> furthermore you have to contribute to the aliasOverrides Service 
> to actually replace the old implementation: 
> 
> public static void contributeAliasOverrides( 
>             @InjectService("myLocator") PageTemplateLocator locator, 
>             Configuration<AliasContribution> configuration) { 
> 
>    configuration.add( 
>          AliasContribution.create( 
>                  PageTemplateLocator.class, locator)); 

Great, this works - thanx a lot!

Just for clarification: the specified id has to be used anywhere else,
right? E.g. for us the service in question is the MarkupWriterFactory,
and previously we also had this in our AppModule:

    public static PageResponseRenderer decoratePageResponseRenderer(
            @InjectService("PageMarkupRenderer")
            final PageMarkupRenderer markupRenderer,
            @InjectService("MarkupWriterFactory")
            final MarkupWriterFactory markupWriterFactory,
            final Object delegate )

which we have to change to @InjectService("myMarkupWriterFactory") then.
Is this the intended way? Is it guaranteed, that T5 does not reference
the MarkupWriterFactory implementation by the id "MarkupWriterFactory"?

Thanx && cheers,
Martin 


> 
> 
> g, 
> kris 
> 
> 
> 
> Martin Grotzke
> <ma...@javakaffee.de> 
> 
> 02.07.2007 10:00 
>         Bitte antworten an
>          "Tapestry users"
>     <us...@tapestry.apache.org>
> 
> 
> 
> 
>                An
> Tapestry users
> <us...@tapestry.apache.org> 
>             Kopie
> 
>             Thema
> RE: T5 Decoupling
> a Template From
> its Component
> Class
> 
> 
> 
> 
> 
> 
> 
> 
> > Digging through the code I notice there is a PageTemplateLocator
> > interface which seems like the appropriate service to override. What
> I
> > have tried is to add the following method to my AppModule class....
> > 
> > 
> > public static void bind(ServiceBinder binder) {
> >   ServiceBindingOptions options = 
> >                                   binder.bind(
> >
>  PageTemplateLocator.class,
> >
>  MyPageTemplateLocatorImpl.class
> >                                                    );
> > }
> > 
> > 
> > ...but I get the following exception at startup.....
> > 
> > 
> > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> already
> > been defined by
> 
> Did you solve this issue? I get the same exception with another
> Service
> that's defined in TapestryModule that I want to override in my
> AppModule
> with my custom implementation...
> 
> Thx && cheers,
> Martin
> 
> 
> On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > > Sent: Wednesday, May 30, 2007 5:15 PM
> > > There are internal services that can be overridden to handle
> those 
> > > kinds of situations.
> > > The goal is to create something that works amazingly well for all 
> > > the more typical cases, then start going after these others.
>  Often 
> > > it will involve moving a private interface out into the public
> space
> > ..
> > 
> > 
> > 
> > 
> > Thanks Howard - I appreciate your prompt response.  However - I am
> not
> > clear if you are saying it cannot be done currently - or if you mean
> > that it can be done - but that I would be treading on somewhat
> unstable
> > ground given that the internal interfaces are subject to change.
> > 
> > Digging through the code I notice there is a PageTemplateLocator
> > interface which seems like the appropriate service to override. What
> I
> > have tried is to add the following method to my AppModule class....
> > 
> > 
> > public static void bind(ServiceBinder binder) {
> >   ServiceBindingOptions options = 
> >                                   binder.bind(
> >
>  PageTemplateLocator.class,
> >
>  MyPageTemplateLocatorImpl.class
> >                                                    );
> > }
> > 
> > 
> > ...but I get the following exception at startup.....
> > 
> > 
> > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> already
> > been defined by
> >
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> > ComponentClassResolver) (at InternalModule.java:231) and may not be
> > redefined by
> > org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl() (at
> > AppModule.java:159). You should rename one of the service builder
> > methods.
> > 
> > 
> > 
> > 
> > Am I wasting my time trying this? I can tolerate a certain amount of
> > instability when pulling in subsequent revisions of Tap5 - however -
> I
> > would like to get a proof of concept up and running if at all
> possible.
> > 
> > Any thoughts on this?
> > 
> > Thanks again.
> > 
> > David Kendall
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> -- 
> Martin Grotzke
> http://www.javakaffee.de/blog/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


RE: T5 Decoupling a Template From its Component Class

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Mon, 2007-07-02 at 11:03 +0200, Kristian Marinkovic wrote:
> 
> hi martin, 
> 
> if you use the ServiceBinder to contribute a class that implements an
> already 
> "contributed" interface you have to assign an id for your class by
> invoking withId, 
> because the Interface is no longer sufficient to identifiy the service
> 
>  binder.bind(PageTemplateLocator.class, 
>         MyPageTemplateLocatorImpl.class).withId("myLocator"); 
> 
> furthermore you have to contribute to the aliasOverrides Service 
> to actually replace the old implementation: 
> 
> public static void contributeAliasOverrides( 
>             @InjectService("myLocator") PageTemplateLocator locator, 
>             Configuration<AliasContribution> configuration) { 
>              
>    configuration.add( 
>          AliasContribution.create( 
>                  PageTemplateLocator.class, locator)); 

Great, this works - thanx a lot!

Just for clarification: the specified id has to be used anywhere else,
right? E.g. for us the service in question is the MarkupWriterFactory,
and previously we also had this in our AppModule:

    public static PageResponseRenderer decoratePageResponseRenderer(
            @InjectService("PageMarkupRenderer")
            final PageMarkupRenderer markupRenderer,
            @InjectService("MarkupWriterFactory")
            final MarkupWriterFactory markupWriterFactory,
            final Object delegate )

which we have to change to @InjectService("myMarkupWriterFactory") then.
Is this the intended way? Is it guaranteed, that T5 does not reference
the MarkupWriterFactory implementation by the id "MarkupWriterFactory"?

Thanx && cheers,
Martin 


> 
> 
> g, 
> kris 
> 
> 
> 
> Martin Grotzke
> <ma...@javakaffee.de> 
> 
> 02.07.2007 10:00 
>         Bitte antworten an
>          "Tapestry users"
>     <us...@tapestry.apache.org>
> 
> 
> 
> 
>                An
> Tapestry users
> <us...@tapestry.apache.org> 
>             Kopie
> 
>             Thema
> RE: T5 Decoupling
> a Template From
> its Component
> Class
> 
> 
> 
> 
> 
> 
> 
> 
> > Digging through the code I notice there is a PageTemplateLocator
> > interface which seems like the appropriate service to override. What
> I
> > have tried is to add the following method to my AppModule class....
> > 
> > 
> > public static void bind(ServiceBinder binder) {
> >   ServiceBindingOptions options = 
> >                                   binder.bind(
> >
>  PageTemplateLocator.class,
> >
>  MyPageTemplateLocatorImpl.class
> >                                                    );
> > }
> > 
> > 
> > ...but I get the following exception at startup.....
> > 
> > 
> > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> already
> > been defined by
> 
> Did you solve this issue? I get the same exception with another
> Service
> that's defined in TapestryModule that I want to override in my
> AppModule
> with my custom implementation...
> 
> Thx && cheers,
> Martin
> 
> 
> On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > > Sent: Wednesday, May 30, 2007 5:15 PM
> > > There are internal services that can be overridden to handle
> those 
> > > kinds of situations.
> > > The goal is to create something that works amazingly well for all 
> > > the more typical cases, then start going after these others.
>  Often 
> > > it will involve moving a private interface out into the public
> space
> > ..
> > 
> > 
> > 
> > 
> > Thanks Howard - I appreciate your prompt response.  However - I am
> not
> > clear if you are saying it cannot be done currently - or if you mean
> > that it can be done - but that I would be treading on somewhat
> unstable
> > ground given that the internal interfaces are subject to change.
> > 
> > Digging through the code I notice there is a PageTemplateLocator
> > interface which seems like the appropriate service to override. What
> I
> > have tried is to add the following method to my AppModule class....
> > 
> > 
> > public static void bind(ServiceBinder binder) {
> >   ServiceBindingOptions options = 
> >                                   binder.bind(
> >
>  PageTemplateLocator.class,
> >
>  MyPageTemplateLocatorImpl.class
> >                                                    );
> > }
> > 
> > 
> > ...but I get the following exception at startup.....
> > 
> > 
> > java.lang.RuntimeException: Service id 'PageTemplateLocator' has
> already
> > been defined by
> >
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> > ComponentClassResolver) (at InternalModule.java:231) and may not be
> > redefined by
> > org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl() (at
> > AppModule.java:159). You should rename one of the service builder
> > methods.
> > 
> > 
> > 
> > 
> > Am I wasting my time trying this? I can tolerate a certain amount of
> > instability when pulling in subsequent revisions of Tap5 - however -
> I
> > would like to get a proof of concept up and running if at all
> possible.
> > 
> > Any thoughts on this?
> > 
> > Thanks again.
> > 
> > David Kendall
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> -- 
> Martin Grotzke
> http://www.javakaffee.de/blog/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

RE: T5 Decoupling a Template From its Component Class

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi martin,

if you use the ServiceBinder to contribute a class that implements an 
already
"contributed" interface you have to assign an id for your class by 
invoking withId,
because the Interface is no longer sufficient to identifiy the service

 binder.bind(PageTemplateLocator.class,
        MyPageTemplateLocatorImpl.class).withId("myLocator");

furthermore you have to contribute to the aliasOverrides Service
to actually replace the old implementation:

public static void contributeAliasOverrides(
            @InjectService("myLocator") PageTemplateLocator locator,
            Configuration<AliasContribution> configuration) {
 
   configuration.add(
         AliasContribution.create(
                 PageTemplateLocator.class, locator));


g,
kris




Martin Grotzke <ma...@javakaffee.de> 
02.07.2007 10:00
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
RE: T5 Decoupling a Template From its Component Class






> Digging through the code I notice there is a PageTemplateLocator
> interface which seems like the appropriate service to override. What I
> have tried is to add the following method to my AppModule class....
> 
> 
> public static void bind(ServiceBinder binder) {
>   ServiceBindingOptions options = 
>                                binder.bind(
> PageTemplateLocator.class,
> MyPageTemplateLocatorImpl.class
>                                                );
> }
> 
> 
> ...but I get the following exception at startup.....
> 
> 
> java.lang.RuntimeException: Service id 'PageTemplateLocator' has already
> been defined by

Did you solve this issue? I get the same exception with another Service
that's defined in TapestryModule that I want to override in my AppModule
with my custom implementation...

Thx && cheers,
Martin


On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > Sent: Wednesday, May 30, 2007 5:15 PM
> > There are internal services that can be overridden to handle those 
> > kinds of situations.
> > The goal is to create something that works amazingly well for all 
> > the more typical cases, then start going after these others.  Often 
> > it will involve moving a private interface out into the public space
> ..
> 
> 
> 
> 
> Thanks Howard - I appreciate your prompt response.  However - I am not
> clear if you are saying it cannot be done currently - or if you mean
> that it can be done - but that I would be treading on somewhat unstable
> ground given that the internal interfaces are subject to change.
> 
> Digging through the code I notice there is a PageTemplateLocator
> interface which seems like the appropriate service to override. What I
> have tried is to add the following method to my AppModule class....
> 
> 
> public static void bind(ServiceBinder binder) {
>   ServiceBindingOptions options = 
>                                binder.bind(
> PageTemplateLocator.class,
> MyPageTemplateLocatorImpl.class
>                                                );
> }
> 
> 
> ...but I get the following exception at startup.....
> 
> 
> java.lang.RuntimeException: Service id 'PageTemplateLocator' has already
> been defined by
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> ComponentClassResolver) (at InternalModule.java:231) and may not be
> redefined by
> org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl() (at
> AppModule.java:159). You should rename one of the service builder
> methods.
> 
> 
> 
> 
> Am I wasting my time trying this? I can tolerate a certain amount of
> instability when pulling in subsequent revisions of Tap5 - however - I
> would like to get a proof of concept up and running if at all possible.
> 
> Any thoughts on this?
> 
> Thanks again.
> 
> David Kendall
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


RE: T5 Decoupling a Template From its Component Class

Posted by Martin Grotzke <ma...@javakaffee.de>.
> Digging through the code I notice there is a PageTemplateLocator
> interface which seems like the appropriate service to override. What I
> have tried is to add the following method to my AppModule class....
> 
> 
> public static void bind(ServiceBinder binder) {
>   ServiceBindingOptions options = 
> 		binder.bind(
> 			PageTemplateLocator.class,
> 			MyPageTemplateLocatorImpl.class
> 			);
> }
> 
> 
> ...but I get the following exception at startup.....
> 
> 
> java.lang.RuntimeException: Service id 'PageTemplateLocator' has already
> been defined by

Did you solve this issue? I get the same exception with another Service
that's defined in TapestryModule that I want to override in my AppModule
with my custom implementation...

Thx && cheers,
Martin


On Wed, 2007-05-30 at 19:17 -0700, David Kendall wrote:
> > From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> > Sent: Wednesday, May 30, 2007 5:15 PM
> > There are internal services that can be overridden to handle those 
> > kinds of situations.
> > The goal is to create something that works amazingly well for all 
> > the more typical cases, then start going after these others.  Often 
> > it will involve moving a private interface out into the public space
> ..
> 
> 
> 
> 
> Thanks Howard - I appreciate your prompt response.  However - I am not
> clear if you are saying it cannot be done currently - or if you mean
> that it can be done - but that I would be treading on somewhat unstable
> ground given that the internal interfaces are subject to change.
> 
> Digging through the code I notice there is a PageTemplateLocator
> interface which seems like the appropriate service to override. What I
> have tried is to add the following method to my AppModule class....
> 
> 
> public static void bind(ServiceBinder binder) {
>   ServiceBindingOptions options = 
> 		binder.bind(
> 			PageTemplateLocator.class,
> 			MyPageTemplateLocatorImpl.class
> 			);
> }
> 
> 
> ...but I get the following exception at startup.....
> 
> 
> java.lang.RuntimeException: Service id 'PageTemplateLocator' has already
> been defined by
> org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
> ComponentClassResolver) (at InternalModule.java:231) and may not be
> redefined by
> org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl() (at
> AppModule.java:159). You should rename one of the service builder
> methods.
> 
> 
> 
> 
> Am I wasting my time trying this? I can tolerate a certain amount of
> instability when pulling in subsequent revisions of Tap5 - however - I
> would like to get a proof of concept up and running if at all possible.
> 
> Any thoughts on this?
> 
> Thanks again.
> 
> David Kendall
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

RE: T5 Decoupling a Template From its Component Class

Posted by David Kendall <da...@lithium.com>.
> From: Howard Lewis Ship [mailto:hlship@gmail.com] 
> Sent: Wednesday, May 30, 2007 5:15 PM
> There are internal services that can be overridden to handle those 
> kinds of situations.
> The goal is to create something that works amazingly well for all 
> the more typical cases, then start going after these others.  Often 
> it will involve moving a private interface out into the public space
..




Thanks Howard - I appreciate your prompt response.  However - I am not
clear if you are saying it cannot be done currently - or if you mean
that it can be done - but that I would be treading on somewhat unstable
ground given that the internal interfaces are subject to change.

Digging through the code I notice there is a PageTemplateLocator
interface which seems like the appropriate service to override. What I
have tried is to add the following method to my AppModule class....


public static void bind(ServiceBinder binder) {
  ServiceBindingOptions options = 
		binder.bind(
			PageTemplateLocator.class,
			MyPageTemplateLocatorImpl.class
			);
}


...but I get the following exception at startup.....


java.lang.RuntimeException: Service id 'PageTemplateLocator' has already
been defined by
org.apache.tapestry.internal.services.InternalModule.build(AssetFactory,
ComponentClassResolver) (at InternalModule.java:231) and may not be
redefined by
org.example.myapp.services.AppModule$MyPageTemplateLocatorImpl() (at
AppModule.java:159). You should rename one of the service builder
methods.




Am I wasting my time trying this? I can tolerate a certain amount of
instability when pulling in subsequent revisions of Tap5 - however - I
would like to get a proof of concept up and running if at all possible.

Any thoughts on this?

Thanks again.

David Kendall



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


Re: T5 Decoupling a Template From its Component Class

Posted by Howard Lewis Ship <hl...@gmail.com>.
There are internal services that can be overridden to handle those kinds of
situations.

The goal is to create something that works amazingly well for all the more
typical cases, then start going after these others.  Often it will involve
moving a private interface out into the public space ... but once that's
done, its very hard to change the interface in the future without breaking
backwards compatibility, so we're pretty conservative about pulling back the
curtain until we know the interface is full and complete.

On 5/30/07, David Kendall <da...@lithium.com> wrote:
>
> I am a Tapestry newbie getting up to speed on Tap 5. I am working on an
> application with extensive co-branding requirements.
>
> As I understand things, there is - by default - a tight coupling between
> a component class name and its template path. For example - if a
> component has a FQCN of...
>
> org.example.myapp.components.CClamp
>
> ...then the template has to be on the classpath as....
>
> org/example/myapp/components/CClamp.html
>
> It would be very helpful if the mapping between the component and the
> template could be decoupled - this would allow me to pull in component
> templates that have been tweaked for a particular co-brand.
>
> For example - I might want to have a template on the class path as
>
> org/example/myapp/override/cobrand1/components/CClamp.html
>
> Is there any way to do this?
>
> Thanks in advance.
>
> David Kendall
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
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

T5 Decoupling a Template From its Component Class

Posted by David Kendall <da...@lithium.com>.
I am a Tapestry newbie getting up to speed on Tap 5. I am working on an
application with extensive co-branding requirements. 

As I understand things, there is - by default - a tight coupling between
a component class name and its template path. For example - if a
component has a FQCN of...

org.example.myapp.components.CClamp

...then the template has to be on the classpath as....

org/example/myapp/components/CClamp.html

It would be very helpful if the mapping between the component and the
template could be decoupled - this would allow me to pull in component
templates that have been tweaked for a particular co-brand. 

For example - I might want to have a template on the class path as 

org/example/myapp/override/cobrand1/components/CClamp.html

Is there any way to do this?

Thanks in advance.

David Kendall




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