You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Avenante <d....@gmail.com> on 2007/07/06 17:22:37 UTC

Re: T5 IOC questions

Ok,

I continue my investigation.
So I think I don't need to override my service but only override my
service configuration.

So my service is :
PageRenderInitializer
and my service configuration is :
contributePageRenderInitializer( ...

As write in the documentation :
"The extensibility comes from the fact multiple modules may all
contribute to the same service configuration:"

So I override the the contributePageRenderInitializer with :

public void contributePageRenderInitializer(OrderedConfiguration<PageRenderCommand>
configuration,
                                                final SymbolSource symbolSource,
                                                final AssetSource assetSource) {
        configuration.add("PageRenderSupport", new PageRenderCommand() {
            public void cleanup(Environment environment) {
                environment.pop(PageRenderSupport.class);
                Document document = environment.peek(Document.class);
                DocumentScriptBuilder builder =
environment.pop(DocumentScriptBuilder.class);
                builder.updateDocument(document);
            }

            public void setup(Environment environment) {
                DocumentScriptBuilder builder = new
MyOwnDocumentScriptBuilderImpl();
                environment.push(DocumentScriptBuilder.class, builder);
                environment.push(PageRenderSupport.class, new
PageRenderSupportImpl(builder,
                        symbolSource, assetSource));
            }
        }, "before:*");

    }

It's an ordered list so I add the "before:*" statement to reflect the
order that I can see in the original method.

But this approach don't work : first my method is call twice !!!!
And the method throw and exception like :

11:21:18,796 - [SocketListener0-1] ERROR - PageRenderInitializer:
Construction of service PageRenderInitializer failed: Error invoking
service builder method
org.apache.tapestry.services.TapestryModule.build(List) (at
TapestryModule.java:988) (for service 'PageRenderInitializer'): Error
invoking service contribution method
com.illuminate.services.AppModule.contributePageRenderInitializer(OrderedConfiguration,
SymbolSource, AssetSource): java.lang.NullPointerException
java.lang.RuntimeException: Error invoking service builder method
org.apache.tapestry.services.TapestryModule.build(List) (at
TapestryModule.java:988) (for service 'PageRenderInitializer'): Error
invoking service contribution method
com.illuminate.services.AppModule.contributePageRenderInitializer(OrderedConfiguration,
SymbolSource, AssetSource): java.lang.NullPointerException
...
...
Caused by: java.lang.RuntimeException: Error invoking service
contribution method
com.illuminate.services.AppModule.contributePageRenderInitializer(OrderedConfiguration,
SymbolSource, AssetSource): java.lang.NullPointerException

Thank for any input ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 IOC questions

Posted by David Avenante <d....@gmail.com>.
Hummm after debug time I found that impossible to me to add in ordered
list the same Id (see class Orderer code).

So if it's impossible I need to override the component
PageRenderInitializer and all the associated configuration.

So I continue my investigation with aliasOveridesService.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org