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" <[EMAIL PROTECTED]> > An: tapestry-user@jakarta.apache.org > 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]