Pardon my ignorance - this is my first serious stint with EnhancementWorkers.
So in our case we want to write up a Custom EnhancementWorker that enhances the renderComponent() method. Since the tacos worker InjectAjaxComponentRenderWorker is already enhancing renderComponent() method, are we not in a contention situation where two enhancement workers are enhancing the same method and one would override the changes of the other?
So for eg InjectAjaxComponentRenderWorker would inject some code in renderComponent()
public void renderComponent() {
//InjectAjaxComponentRenderWorker's code goes here
}
And after Custom EnhancementWorker we should reach a situation where
public void renderComponent() {
//InjectAjaxComponentRenderWorker's code goes here
//Custom EnhancementWorker's code goes here
}
And NOT a situation where we lose InjectAjaxComponentRenderWorker's contribution like below!
public void renderComponent() {
//Custom EnhancementWorker's code goes here
}
Thanks, Karthik.
On 11/14/06, andyhot <[EMAIL PROTECTED]> wrote:
Tapestry will eventually apply all the enhancers +
it'll do this in the order you define when you contribute to
tapestry.enhance.EnhancementWorkers
So, you don't really have to override tacos worker...
I guess it's your choice but i'd go for a new worker...
it feels more correct
Karthik N wrote:
> Hi Andy!
>
> Thanks for the pointer.
>
> Our idea is to actually override the renderComponent() method to
> implement our security concerns.
>
> We want to write a custom EnhancementWorker to change the IWriter
> accordingly after calling a SecurityContext.isUserInRoles( {'ADMIN',
> 'SUPERVISOR'} ) which will check a ThreadLocal etc. (left out the gory
> details)
>
> But since the renderComponent() method is already enhanced by tacos
> InjectAjaxComponentRenderWorker, it appears that we would need to
> extend this class and add our code in the subclass?
>
> And also override in hivemind using the approach here -
> http://hivemind.apache.org/override.html
>
>
> Any thoughts?
>
> Thanks! Karthik
>
> On 11/14/06, *andyhot* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
>
> tacos also registers a FormComponentEventWorker.
> It's responsible for adding 2 more parameters to all form
> components...
> "eventListener" and "formatter"
> https://svn.sourceforge.net/svnroot/tacos/tacos-4.0/trunk/tacos-core/src/java/net/sf/tacos/ajax/impl/FormComponentEventWorker.java
> <https://svn.sourceforge.net/svnroot/tacos/tacos-4.0/trunk/tacos-core/src/java/net/sf/tacos/ajax/impl/FormComponentEventWorker.java >
>
> Here's their registration
> https://svn.sourceforge.net/svnroot/tacos/tacos-4.0/trunk/tacos-core/src/descriptor/META-INF/tacos.enhance.xml
> <https://svn.sourceforge.net/svnroot/tacos/tacos-4.0/trunk/tacos-core/src/descriptor/META-INF/tacos.enhance.xml >
>
> So, my question is why don't you create your own enhancment worker and
> contribute it to
> tapestry.enhance.EnhancementWorkers configuration point?
>
>
>
> Karthik N wrote:
> > Hello,
> >
> > Tacos 4.0.1 - We are contemplating adding an EnhancementWorker
> to the
> > renderComponent method of AbstractComponent.
> >
> > The idea is to be able to perform certain "Security" operations
> in a
> > (hopefully) elegant fashion.
> >
> > For eg. we have cases where a Tab should hide/show itself, a
> TextField
> > should hide/show itself.
> >
> > Here are the thoughts:
> >
> > 1) Introduce a formal parameter for each component something like
> > renderIfUserInRoles ognl:{'ADMIN', 'SUPERVISOR'}
> >
> > 2) A custom EnhancementWorker to change the IWriter accordingly
> after
> > calling a SecurityContext.isUserInRoles ( {'ADMIN', 'SUPERVISOR'} )
> > which will check a ThreadLocal etc. (left out the gory details)
> >
> > 3) If the user is not in roles pass on a NullWriter to the
> component,
> > so that it will not render its content.
> >
> > So here are the questions:
> >
> > 1) After some digging we find that InjectAjaxComponentRenderWorker
> > already enhances AbstractComponent.renderComponent(). Methods of
> > this Worker are protected, so we plan to further override this
> > implementation and use the approach described in
> > http://hivemind.apache.org/override.html to override the
> service-point
> > id="ComponentRenderInterceptor"
> >
> > 2) Is this a good idea?! We would love to hear some feedback.
> >
> > Thanks, Karthik
> >
> ------------------------------------------------------------------------
> >
> >
> -------------------------------------------------------------------------
>
> > Using Tomcat but need to do more? Need to support web services,
> security?
> > Get stuff done quickly with pre-integrated technology to make
> your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on
> Apache Geronimo
> >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> < http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tacos-devel mailing list
> > Tacos-devel@lists.sourceforge.net
> <mailto: Tacos-devel@lists.sourceforge.net>
> > https://lists.sourceforge.net/lists/listinfo/tacos-devel
> >
>
>
> --
> Andreas Andreou - [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -
> http://andyhot.di.uoa.gr
> Tapestry / Tacos developer
> Open Source / J2EE Consulting
>
>
> -------------------------------------------------------------------------
>
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
> _______________________________________________
> Tacos-devel mailing list
> Tacos-devel@lists.sourceforge.net
> <mailto:Tacos-devel@lists.sourceforge.net >
> https://lists.sourceforge.net/lists/listinfo/tacos-devel
> < https://lists.sourceforge.net/lists/listinfo/tacos-devel>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tacos-devel mailing list
> Tacos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tacos-devel
>
--
Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
Tacos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tacos-devel
--
Thanks, Karthik
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Tacos-devel mailing list Tacos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tacos-devel