Right, but how does that intersect with Tapestry IoC? Anything that scans the classpath for classes won't see any proxy classes, just the original classes.
On Wed, Apr 20, 2011 at 2:39 PM, Igor Drobiazko <[email protected]> wrote: > Any library which scans the classpath for their specific annotations fails > while the annotations are lost. Here are some examples: > > http://download.oracle.com/javaee/5/api/javax/jws/WebService.html > http://download.oracle.com/javaee/6/api/javax/ws/rs/Path.html > > In the past I had also a lot of problems integrating spring-integration into > a Tapestry app. > > http://www.springsource.org/spring-integration > > If you want to use annotations to mark you services as routers, splitter > transformers and endpoints, you are lost: > > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Router.html > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Splitter.html > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Transformer.html > > The issue is that third party libraries need to read the annotations from > classes. They just don't know what to do with ServiceResources. > > On Wed, Apr 20, 2011 at 10:46 PM, Howard Lewis Ship <[email protected]> > wrote: >> >> Can you give me a specific example of the problem integrating with a >> REST lib? I'm trying to find where an interface point would exist >> that has access to the proxy, but not to the ServiceResources object. >> >> On Wed, Apr 20, 2011 at 1:14 PM, Igor Drobiazko >> <[email protected]> wrote: >> > I would hate to move away from copying annotation to proxies. It would >> > definitely break some of the existing apps. It would also a very big >> > limitation for creating integrations with libraries which need to read >> > annotations from classes. A good example a REST libs. >> > >> > If I recall it correctly, when implementing the copying annotations with >> > Javassist there was an issue with the abstract class named >> > AbstractInvocation. It doesn't implement the getMethodAnnotation method >> > because it is generated somewhere. For components it is in >> > InternalClassTransformationImpl. I don't recall the place for the >> > service >> > layer. Might it be the issue with plastic? >> > >> > On Wed, Apr 20, 2011 at 9:14 PM, Howard Lewis Ship <[email protected]> >> > wrote: >> >> >> >> Been struggling with this. I must have screwed up the logic that >> >> mixes-and-matches annotations from the implementation class with >> >> annotations from the interface. >> >> >> >> The problems with JPA are caused by this code from >> >> CommitAfterMethodAdvice: >> >> >> >> private EntityTransaction getTransaction(final Invocation >> >> invocation) >> >> { >> >> final PersistenceContext annotation = invocation >> >> .getMethodAnnotation(PersistenceContext.class); >> >> >> >> EntityManager em = JpaInternalUtils.getEntityManager(manager, >> >> annotation); >> >> >> >> if (em == null) >> >> return null; >> >> >> >> return em.getTransaction(); >> >> } >> >> >> >> >> >> The annotation is always null. Tracing with the debugger shows that >> >> the method being invoked is a method on the Plastic Proxy class. >> >> >> >> What I'm having trouble figuring out is why things worked when using >> >> ClassFactory and not PlasticProxyFactory. Did I miss some code >> >> somewhere that copied annotations from the interface into the proxy? >> >> Normally, when you look at a method of a class, you see just the >> >> annotations on that method, even if the method itself is an >> >> implementation of an interface method that does have annotations: >> >> >> >> public class Experiment >> >> { >> >> public interface Foo >> >> { >> >> @Deprecated >> >> void foo(); >> >> } >> >> >> >> public static class FooImpl >> >> { >> >> public void foo() >> >> { >> >> >> >> } >> >> } >> >> >> >> public static void main(String[] args) throws SecurityException, >> >> NoSuchMethodException >> >> { >> >> System.out.println("Foo : " + >> >> Foo.class.getMethod("foo").getAnnotation(Deprecated.class)); >> >> System.out.println("FooImpl: " + >> >> FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class)); >> >> } >> >> } >> >> >> >> Output: >> >> >> >> Foo : @java.lang.Deprecated() >> >> FooImpl: null >> >> >> >> >> >> ... I wonder if it is not too late to find a way to expose method >> >> annotations via the AnnotationProvider interface; this would make it >> >> much easier, as we already have AnnotationProvider and idea like >> >> AnnotationProviderChain. It would be very nice if we could move away >> >> from copying annotation from one class to another. >> >> >> >> >> >> -- >> >> 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 >> > >> > >> > >> > -- >> > Best regards, >> > >> > Igor Drobiazko >> > http://tapestry5.de >> > >> >> >> >> -- >> 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 > > > > -- > Best regards, > > Igor Drobiazko > http://tapestry5.de > -- 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]
