Resolving MetaData/Annotations
bill.burke Jan 7, 2005 5:31 PMI'd like to discuss the interfaces for how metadata and/or annotations are resolved.
IMO, there are two types of metadata.
Static metadata
Dynamic metadata
Dynamic metadata is defined on the context of the invocation, on a per invocation basis. Static metadata is defined at compile (annotations) or deployment time. Aspects need to be able to resolve both dynamic and static metadata.
Aspects need to distinguish between static and dynamic data because they may want to be assured that the metadata they are obtaining is coming only from static configuration and not overriden dynamically at runtime by the calling client.
Conversely, Aspects may want Dynamic metadata that overrides existing static metadata to give flexibility to the calling client.
That's why I think there needs to be two separate apis. One to get/set metadata dynamically on the current joinpoint, and one to get at statically defined metadata.
Basically, I think Joinpoint should be a static construct(it is immutable metadata defined at deployment time) that models closely after the java.lang.reflect package. THis will allow us to have one interface that can represent metadata for JMX, java.lang.reflect, and Javassist or any other model that requires joinpoint-like metadata.
Another thing about metadata is the need to support JDK annotations. It is conceivable that we will want to override annotations at both the bean and class level. JBoss AOP can already support overriding at the class level.
Also, regarding annotations, some of the aspects that I have written have the need to get metadata from the "invocationContext", statically from the joinpoint, and to also get metadata from the joinpoint's declaring class. That's why I think the Joinpoint class hierarchy needs to support some method like getDeclaringType that can return annotations of the joinpoint's declaring class.
So, here's what this post boils down to. We need:
* dynamic definable metadata per joinpoint(this can be typed or untyped) that can be defined by the calling client to override statically defined metadata.
* statically definable metadata per joinpoint that can be resolved separately from the dynamic interface. Static data can be overriden by the container. (annotation overrides) but should be a deployment time thing.
* We need the notion of getDeclaredType so that the aspect can obtain Class level annotation data.
Bill