Have you read the documentation? There's a careful relationship between the main service interface and the related filter interface.
Disambiguation can be by explicit service id (a last resort) or by using marker annotation, including the special built-in @Local annotation. You can also help with disambiguation ... check the docs about overriding services. You will not get that list of filters anywhere but contributed into the service implementation (or service builder method). Remember; filters wrap around services. Each filter sees the service as its delegate (the extra parameter). If you have multiple filters, the delegate is actually a special bridge to the next filter (!). The service itself is the stack of filters plus a terminator (which implements the service interface) ... one is supplied if you don't provide a terminator. So the first step is to define your own service and filter interfaces. The final service, which can be injected into pages, represents that whole stack: the filters, the bridges, the terminator. It also includes the lazy instantiation of the whole stack. The PipelineBuilder returns an object that implements the service interface: either the terminator itself, or the bridge around the outermost filter. It's fun stuff! On Thu, Oct 1, 2009 at 4:35 PM, Steve Cowx <[email protected]> wrote: > Hi > > I have a few questions, I am looking for understanding rather than a > solution to any particular problem. > > The following code comes from the > org.apache.tapestry.services.TapestryModule > > /** > * A wrapper around {...@link > <%...@link>org.apache.tapestry5.internal.services.PageRenderQueue} used > for partial > page renders. > * Supports an ordered configuration of {...@link > <%...@link>org.apache.tapestry5.services.PartialMarkupRendererFilter}s. > * > * @see > #contributePartialMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration, > org.apache.tapestry5.Asset, > * org.apache.tapestry5.ioc.services.SymbolSource, AssetSource) > */ > public PartialMarkupRenderer buildPartialMarkupRenderer(Logger logger, > > List<PartialMarkupRendererFilter> configuration, > �...@autobuild > PartialMarkupRendererTerminator terminator) > { > return pipelineBuilder.build(logger, PartialMarkupRenderer.class, > PartialMarkupRendererFilter.class, > configuration, terminator); > } > > > The questions that I have relate to the code above: > > 1) What is the type of the instance of the class that gets built by the > pipelineBuilder (ignoring the fact that it is a proxy)? I would have > expected it to be a PartialMarkupRenderer but some experimenting has led me > to believe that it may be an instance of a > PartialMarkupRendererFilter. The source of my confusion is that I have > built an almost exact replica of the setup in the TapestryModule for this > particular pipeline (using all my own mirror interfaces to avoid > ambigouity). I have then injected my service into a component and called a > service method on the injected instance and received the following > error "Method > void renderMarkup(org.apache.tapestry5.MarkupWriter, > org.apache.tapestry5.json.JSONObject) has no match in filter > interface com.mypackage.PartialMarkupRendererFilter." suggesting that an > instance of the Filter that was injected into my component and not an > instance of the service (which does have that method) > > 2) If I was to copy the above code exactly and paste it into my own module > then change the name to buildMyOwnPartialMarkupRenderer() > a) how would I disambiguate the two services which were built (i.e. the > one in the TapestryModule and the one in my module) so that I did not get > the error "Automatic dependency resolution requires that exactly one service > implement the interface". > b) Assumin gthat this is possible how would I then disambiguate in the > page or a component where the service is to be injected. > c) would the List of PartialMarkupRendererFilters which gets passed > into my builder method be the same instance that gets passed in to the > TapestryModule builder method? > > Regards > > Stephen > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
