Re: T5: How to inject a service into a component?
Sure beats abstract properties, though! On 5/4/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: Tapestry works by identifying the points at which a variable is read or updated and often replaces that with a method invocation that does something more complicated (such as persistent field values or component parameters). If the field is private, Tapestry is able to make the changes within a single class. If we supported non-private members, it gets a couple of orders of magnitude more complicated. You can no longer perform the instrumentation on a class-by-class basic; instead you have to identify every possible class and perform all the instrumentations at once. This is more like how APT or AspectJ works and isn't feasible for Tapestry, since by design, many of the instrumentations are only known about, or implementable, at runtime. On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > I hope that's not the only reason. ...The framework should be working > hard - > not the users. ;) > > On 5/4/07, Massimo Lusetti <[EMAIL PROTECTED]> wrote: > > > > On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > > > > I wonder why this is as well, it's happened at least a couple times > now > > - > > > at least enough that this idea may need to be re-evaluated. (I can > help > > if > > > it's just reflection stuff) > > > > This way the framework (inner javassist stuff) only need to 'scan' for > > private instances. > > > > -- > > Massimo > > http://meridio.blogspot.com > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Jesse Kuhnert > Tapestry/Dojo team member/developer > > Open source based consulting work centered around > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com > -- 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 -- 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
Re: T5: How to inject a service into a component?
Tapestry works by identifying the points at which a variable is read or updated and often replaces that with a method invocation that does something more complicated (such as persistent field values or component parameters). If the field is private, Tapestry is able to make the changes within a single class. If we supported non-private members, it gets a couple of orders of magnitude more complicated. You can no longer perform the instrumentation on a class-by-class basic; instead you have to identify every possible class and perform all the instrumentations at once. This is more like how APT or AspectJ works and isn't feasible for Tapestry, since by design, many of the instrumentations are only known about, or implementable, at runtime. On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: I hope that's not the only reason. ...The framework should be working hard - not the users. ;) On 5/4/07, Massimo Lusetti <[EMAIL PROTECTED]> wrote: > > On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > > I wonder why this is as well, it's happened at least a couple times now > - > > at least enough that this idea may need to be re-evaluated. (I can help > if > > it's just reflection stuff) > > This way the framework (inner javassist stuff) only need to 'scan' for > private instances. > > -- > Massimo > http://meridio.blogspot.com > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com -- 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
Re: T5: How to inject a service into a component?
You should be seeing some logged console messages about private variables. Only private instance variables may have annotations on them; yours is "package private" not private. On 5/4/07, Michael Maier <[EMAIL PROTECTED]> wrote: Hi List, I'm trying to inject via @Inject annotation a service (internal service RequestPageCache) into a component: public class Menu { @Inject("RequestPageCache") RequestPageCache requestPageCache; public String getPageName() { ComponentResources pageResources= resources.getPage ().getComponentResources(); String pageClassName= pageResources.getCompleteId(); Page page= requestPageCache.getByClassName(pageClassName); return page.getName(); } } so...while rendering the page with the menu component ${pageName} a null pointer exception occures, because "requestPageCache" is null. What is getting wrong? Is RequestPageCache not injectable? What I want: I just try to get the page of the component. Then the menu component should highlight by providing a special css-class the corresponding menu item of the -list for the active page. Therefore the menu component must know the current page that is rendered. In Tapestry 3 is just call the method getPage of the component. Now every component has no parent class... While we are talking about injection: the docs are a little bit confusing: @Inject @Service("xxx") (which did not work with 5.0.3, because Service annotation does not exist) or @Inject("xxx") or @Inject( "service:xxx" ) (what kind of prefixes (service:) exists and what meaning have they?) sometimes: @Inject ("alias:request" )...is there somewhere a list with all objects that are able to be injected from tapestry-core? thanks for any help cheers Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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
Re: T5: How to inject a service into a component?
I hope that's not the only reason. ...The framework should be working hard - not the users. ;) On 5/4/07, Massimo Lusetti <[EMAIL PROTECTED]> wrote: On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > I wonder why this is as well, it's happened at least a couple times now - > at least enough that this idea may need to be re-evaluated. (I can help if > it's just reflection stuff) This way the framework (inner javassist stuff) only need to 'scan' for private instances. -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Re: T5: How to inject a service into a component?
On 5/4/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: I wonder why this is as well, it's happened at least a couple times now - at least enough that this idea may need to be re-evaluated. (I can help if it's just reflection stuff) This way the framework (inner javassist stuff) only need to 'scan' for private instances. -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: How to inject a service into a component?
I wonder why this is as well, it's happened at least a couple times now - at least enough that this idea may need to be re-evaluated. (I can help if it's just reflection stuff) On 5/4/07, Michael Maier <[EMAIL PROTECTED]> wrote: ok, I solved... requestPageCache must be private...I don't know why the variable to be injected must be declared private but tapestry could log a warning, that the instance variable is not private and therefor it won't be injected... -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Re: T5: How to inject a service into a component?
ok, I solved... requestPageCache must be private...I don't know why the variable to be injected must be declared private but tapestry could log a warning, that the instance variable is not private and therefor it won't be injected... Am 04.05.2007 um 11:37 schrieb Michael Maier: @Inject("RequestPageCache") RequestPageCache requestPageCache; cheers Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: How to inject a service into a component?
hi michael, it should work with just @Inject. You can take a look at the BeanEditForm component... it uses a bunch of @Injects. (T5.0.4) g, kris Michael Maier <[EMAIL PROTECTED]> 04.05.2007 11:37 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema T5: How to inject a service into a component? Hi List, I'm trying to inject via @Inject annotation a service (internal service RequestPageCache) into a component: public class Menu { @Inject("RequestPageCache") RequestPageCache requestPageCache; public String getPageName() { ComponentResources pageResources= resources.getPage ().getComponentResources(); String pageClassName= pageResources.getCompleteId(); Page page= requestPageCache.getByClassName(pageClassName); return page.getName(); } } so...while rendering the page with the menu component ${pageName} a null pointer exception occures, because "requestPageCache" is null. What is getting wrong? Is RequestPageCache not injectable? What I want: I just try to get the page of the component. Then the menu component should highlight by providing a special css-class the corresponding menu item of the -list for the active page. Therefore the menu component must know the current page that is rendered. In Tapestry 3 is just call the method getPage of the component. Now every component has no parent class... While we are talking about injection: the docs are a little bit confusing: @Inject @Service("xxx") (which did not work with 5.0.3, because Service annotation does not exist) or @Inject("xxx") or @Inject( "service:xxx" ) (what kind of prefixes (service:) exists and what meaning have they?) sometimes: @Inject ("alias:request" )...is there somewhere a list with all objects that are able to be injected from tapestry-core? thanks for any help cheers Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]