[Top] [All Lists]

Re: using EnhancementWorkers for Specification Inheritance

Subject: Re: using EnhancementWorkers for Specification Inheritance
From: "Raul Cesar Teixeira"
Date: Mon, 30 Oct 2006 22:18:47 -0300

Did your enhancement worker finally work? I tried to implement your
solution to the same problem I am having, but still no dice. I keep
getting an error saying "Parameter location must not be null."
How are you creating your ASO? I'm trying to create mine like this:

       <contribution configuration-id="tapestry.state.ApplicationObjects">
                <state-object name="aso" scope="session">
                        <create-instance  class="xyz.AsoClass" />

Any help would be great! I'm stuck on this for 3 days now!!!

On 4/10/06, Mark Lehmacher <mark.lehmacher@xxxxxx> wrote:

For future reference: Solved my problem by simply contributing my
enhancement worker with before="tapestry.enhance.inject-specification"
instead of before="tapestry.enhance.abstract-property"!

> --- Ursprüngliche Nachricht ---
> Von: "Mark Lehmacher" <mark.lehmacher@xxxxxxxxx>
> An: tapestry-user@xxxxxxxxxxxxxxxxxx
> Betreff: using EnhancementWorkers for Specification Inheritance
> Datum: Tue, 4 Apr 2006 12:59:36 +0200
> Hello,
> I am using JDK1.4 and for that reason can not use the annotations.
> However,
> I would still like be able to provide for "specification inheritance",
> i.e.
> getting my ASO injected to all classes which derive from my BasePage
> without
> having to specify an inject declaration in each of my page xml specs. I
> thought I could do that by using EnhancementWorkers but I still end up
> getting a NPE when accessing my  allegedly inserted ASO. My
> EnhancementWorker impl looks as follows:
>     public void performEnhancement(EnhancementOperation op,
> IComponentSpecification spec) {
>         if (op.implementsInterface(BasePage.class)) {
>             // xml fragment:  <inject property="aso" type="state"
> object="aso"/>
>             InjectSpecification asoInjSpec = new
> InjectSpecificationImpl();
>             asoInjSpec.setType("state");
>             asoInjSpec.setProperty("aso");
>             asoInjSpec.setObject("aso");
>             spec.addInjectSpecification (asoInjSpec);
>         }
> }
> where BasePage.class is the class of the base page for all my pages. My
> hivemind contribution looks as follows:
>     <contribution configuration-id="tapestry.enhance.EnhancementWorkers">
>         <command id="enhance-basePage-worker"
>                 object="service:BasePageEnhancementWorker"
>                 before="tapestry.enhance.abstract-property" />
>     </contribution>
>     <service-point id="BasePageEnhancementWorker"
>         interface="org.apache.tapestry.enhance.EnhancementWorker">
>         <invoke-factory>
>             <construct
>                 class="mailadm.web.enhance.BasePageEnhancementWorker">
>             </construct>
>         </invoke-factory>
>     </service-point>
> When I add debug statements to my EnhancementWorker I see it gets executed
> just fine. Moreover I added debug statements to
> org.apache.tapestry.enhance.InjectStateWorker and it works on my aso
> inject
> spec. However, the funny thing is that when using a state inject spec from
> my xml page spec, the InjectStateWorker logs two invocations for one
> injection, whereas for my EnhancementWorker only one invocation is logged
> and I end up with a non-working injection (i.e. the NPE when trying to
> access the injected property).
> Any help would be greatly appreciated. Thanks!

"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx

To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • Re: using EnhancementWorkers for Specification Inheritance, Raul Cesar Teixeira <=