MetaWorker extends CCTW2 so a @Contribute(CCTW2.class) needs qualification for tapestry-ioc to understand what is being contributed to.
The ComponentClassTransformWorker service id is unchanged, which is why contributeComponentClassTransformWorker2() does not work using the naming convention. Same service id as 5.2, new interface. However, contributions of type CCTW are automatically type-coerced to CCTW2. On Sat, Aug 27, 2011 at 6:38 AM, Josh Canfield <joshcanfi...@gmail.com> wrote: > The solution is to the MetaWorker issue is to add @Primary with @Contribute( > ComponentClassTransformWorker2). There is a dependency that I honestly > haven't spent the time to understand, but I happened upon a jira ticket that > pointed the way. > On Aug 27, 2011 6:16 AM, "Steve Eynon" <steve.ey...@alienfactory.co.uk> > wrote: >> Hi, >> >> I was converting some components from T5.2 to T5.3 and I came across >> some confusing behaviour / error messages. The following replicates >> what I found: >> >> If you put the following in your module - i.e. contributing to the new >> ComponentClassTransformWorker2 >> >> @Contribute(ComponentClassTransformWorker2.class) >> public static void >> > notMetaWorkerContributions(OrderedConfiguration<ComponentClassTransformWorker2> >> configuration) { >> configuration.add("NotMetaWorker", new ComponentClassTransformWorker2() { >> public void transform(PlasticClass plasticClass, >> TransformationSupport support, MutableComponentModel model) {} >> }); >> } >> >> then you receive the following error message about trying to >> contribute a MetaWorker...? >> >> Registry - Service 'MetaWorker' is configured using >> org.apache.tapestry5.ioc.MappedConfiguration, not >> org.apache.tapestry5.ioc.OrderedConfiguration. >> Registry - Operations trace: >> Registry - [ 1] Constructing instance of page class >> com.alienfactory.thag.web.pages.Index >> Registry - [ 2] Creating ComponentAssembler for >> com.alienfactory.thag.web.pages.Index >> Registry - [ 3] Creating instantiator for component class >> com.alienfactory.thag.web.pages.Index >> Registry - [ 4] Running component class transformations on >> com.alienfactory.thag.web.base.ArticlePageBase >> Registry - [ 5] Realizing service MetaWorker >> Registry - [ 6] Invoking service creator >> org.apache.tapestry5.internal.services.meta.MetaWorkerImpl(Map) (at >> MetaWorkerImpl.java:33) via >> org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at >> TapestryModule.java:303) >> Registry - [ 7] Invoking constructor >> org.apache.tapestry5.internal.services.meta.MetaWorkerImpl(Map) (at >> MetaWorkerImpl.java:33) via >> org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at >> TapestryModule.java:303) >> Registry - [ 8] Determining injection value for parameter #1 > (java.util.Map) >> Registry - [ 9] Collecting mapped configuration for service MetaWorker >> Registry - [10] Invoking method >> > com.alienfactory.thag.web.services.ThagModule.contributeComponentClassTransformWorker(OrderedConfiguration) >> (at ThagModule.java:81). >> Registry - [11] Determining injection value for parameter #1 >> (org.apache.tapestry5.ioc.OrderedConfiguration) >> MetaWorker - Construction of service MetaWorker failed: Error invoking >> constructor > org.apache.tapestry5.internal.services.meta.MetaWorkerImpl(Map) >> (at MetaWorkerImpl.java:33) via >> org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at >> TapestryModule.java:303) (for service 'MetaWorker'): Error invoking >> service contribution method >> > com.alienfactory.thag.web.services.ThagModule.contributeComponentClassTransformWorker(OrderedConfiguration): >> Service 'MetaWorker' is configured using >> org.apache.tapestry5.ioc.MappedConfiguration, not >> org.apache.tapestry5.ioc.OrderedConfiguration. >> >> So I removed the @Contribute annotation and tried the method name >> convention and received: >> >> public static void contributeComponentClassTransformWorker2(...) >> >> java.lang.IllegalArgumentException: Contribution >> > com.alienfactory.thag.web.services.ThagModule.contributeComponentClassTransformWorker2(OrderedConfiguration) >> (at ThagModule.java:79) is for service >> 'ComponentClassTransformWorker2', which does not exist. >> >> Trying the older deprecated ComponentClassTransformWorker gives an >> (expected) error: >> >> @Contribute(ComponentClassTransformWorker.class) >> public static void notMetaWorkerContributions(...) >> >> java.lang.IllegalArgumentException: Contribution >> > com.alienfactory.thag.web.services.ThagModule.notMetaWorkerContributions(OrderedConfiguration) >> (at ThagModule.java:82) is for service 'interface >> org.apache.tapestry5.services.ComponentClassTransformWorker' qualified >> with marker annotations [], which does not exist. >> >> Finally, if you try the method name convention for the deprecated >> ComponentClassTransformWorker then all works fine: >> >> public static void >> > contributeComponentClassTransformWorker(OrderedConfiguration<ComponentClassTransformWorker2> >> configuration) { >> configuration.add("NotMetaWorker", new ComponentClassTransformWorker2() { >> public void transform(PlasticClass plasticClass, >> TransformationSupport support, MutableComponentModel model) {} >> }); >> } >> >> Can anyone explain what is going on? For it made the upgrade a little > tricky. >> >> I did find the following in TapestryModule which explains why only the >> deprecated service exists but my T5-IoC foo fell short of deciphering >> the other error messages. >> >> @Marker(Primary.class) >> public ComponentClassTransformWorker2 buildComponentClassTransformWorker( >> List<ComponentClassTransformWorker2> configuration) { >> return chainBuilder.build(ComponentClassTransformWorker2.class, >> configuration); >> } >> >> Cheers, >> >> Steve. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > -- 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: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org