-
1. Re: Metadata Chaining in JBoss AOP 1.0 Beta
bill.burke Mar 29, 2004 9:37 PM (in response to minamoto)Ok, in 1.0 Beta things have changed a little bit.
There is class metadata, but it is different from default metadata.
Class metadata is data you have tagged the class with, but is not a part of the chaining. Default metadata still exists, but you must declare it within XML. JSR-175 doesn't have the concept of default metadata, so I didn't put it in the Doclet tags. So, to add default data you must define it in XML<annotation tag="yourTag" class="org.yoyo.MyClassYo"> <default> <something>someval</something> </default> </annotation>
Let me know if this is a good enough explanation.
Bill -
2. Re: Metadata Chaining in JBoss AOP 1.0 Beta
minamoto Mar 29, 2004 10:28 PM (in response to minamoto)Thank you for the quick responce.
Now I see how the default metadata works.
But It's not clear to me when & how to use the class metadata inside interceptors."Bill Burke" wrote:
There is class metadata, but it is different from default metadata.
Class metadata is data you have tagged the class with, but is not a part of the chaining.
Miki -
3. Re: Metadata Chaining in JBoss AOP 1.0 Beta
bill.burke Mar 29, 2004 11:13 PM (in response to minamoto)class metadata wasn't meant to be used in interceptors, but to annotate at the class level like you would in JSR-175 and then be able to use the attributes within pointcut expressions
execution(* @billable->get(..))
pointcut on execution of any get method of any class tagged as billable.
One thing I do want to add is some type safety to the metadata stuff. String just don't cut it. In the near future I'll add real annotation support with JDK 1.5 and some wrapper shit so that you can do it with JDK 1.4 stuff (like JAM or something similar).
Bill -
4. Re: Metadata Chaining in JBoss AOP 1.0 Beta
bill.burke Mar 29, 2004 11:15 PM (in response to minamoto)P.S. any feedback on whether you like/dislike or suggestions on the metadata stuff or framework in general would be most appreciated.
Thanks for taking the time to look into this stuff.
Bill -
5. Re: Metadata Chaining in JBoss AOP 1.0 Beta
mikezzz May 7, 2004 3:23 AM (in response to minamoto)I think including class metadata in the chain is a good idea. The case I was looking at was similar to the following:
/** * @@persistent pk=Id */ public POJO { String Id; String name; /** * @@persistent_getter */ public void getName() { return name; } } public GetInterceptor implements Interceptor { public Object invoke(Invocation inv) throws Throwable { String pkFieldName = inv.getMetaData("persistent", "pk"); Object o = inv.targetObject; Field f = o.getClass().getField(pkFieldName); selectFromDatabase("select * from POJO where id = ?", f.get(o)); // Set the results in the target object. return inv.invokeNext(); } }
I would of thought that metadata could have similar semantics to variables with regard to scoping. Class metadata could be overridden by Method or invocation metadata. I realise it is still possible to get the class metadata from the advisor, but I am still confused as to why it isn't part of the chain. Is it merely a JSR-175 compliance thing (if so I'll stop my whining)?
Mike. -
6. Re: Metadata Chaining in JBoss AOP 1.0 Beta
bill.burke May 9, 2004 11:17 AM (in response to minamoto)"mikezzz" wrote:
I think including class metadata in the chain is a good idea. The case I was looking at was similar to the following:/** * @@persistent pk=Id */ public POJO { String Id; String name; /** * @@persistent_getter */ public void getName() { return name; } } public GetInterceptor implements Interceptor { public Object invoke(Invocation inv) throws Throwable { String pkFieldName = inv.getMetaData("persistent", "pk"); Object o = inv.targetObject; Field f = o.getClass().getField(pkFieldName); selectFromDatabase("select * from POJO where id = ?", f.get(o)); // Set the results in the target object. return inv.invokeNext(); } }
I would of thought that metadata could have similar semantics to variables with regard to scoping. Class metadata could be overridden by Method or invocation metadata. I realise it is still possible to get the class metadata from the advisor, but I am still confused as to why it isn't part of the chain. Is it merely a JSR-175 compliance thing (if so I'll stop my whining)?
Mike.
I think your suggestion is correct AND incorrect.
The metadata should model how JSR-175 models metadata. A Class is a different thing than a method. So, I disagree that classmetadata should be overriden with Method data. That is what default metadata is for.
BUT, where I do agree is that Class metadata should be overridable from the invocation or ThreadMetaData. In other words, there should be a getClassMetadata method on invocation or something like that. I need to think about the correct semantics.
Bill