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!

Reply via email to