Long post ..
"Andrzej Krzywda" wrote : Hi!
  | ....
  | You can write an aspect which contains only precedence rules.  This aspect you can 
use as a configuration file of your application:
  | 
  | public aspect ForumConfiguration {
  |   |    declare precedence: Security, Logging, *;
  |   | }
  | 
  | It doesn't couple different concerns.
  | 
  | Andrzej Krzywda


Hi.

I was thinking a little about it and did some tests.

First you're right. That's way to achieve it in AspectJ. It could be sth similar for 
JBossAOP in future.

Second: this solution implies that a developer who uses your AOP library _must_ know 
AspectJ/JBossAOP syntax, etc. And this is not quite OK, and  here is why I think so:

Imagine Jim, a developer of, say TicketsReservation system. Business logic for this 
world is easy and simple. He prototyped his object world with POJOs only, so he has 
nice running system with tests, and all of it, but these are only POJOs. He still 
needs persistence, transactions, GUI. 
And now is the time for him to think about it a little bit. Of course he finds PAT for 
persistence ;) and some other AOP libraries for other services. But he doesn't know 
nothing about AOP. He's heard from a friend but didn't write any aspect. And he don't 
have to!
He wishes to annotate transactions, to annotate important business classes, _maybe_ 
adopt build.xml. But that should be all for him. Compilation (weaving), tests and 
system runs.

So, what I'm trying to tell in this user story, is about some developer who only 
wishes to use _our_ work. And it happens that our work is to develop set of services 
for him. And that's great and for us and for him.


But for now, we have a problem, with order of aspects (AOP libraries) applied which is 
still unsolved.
And I'm even not sure if Jim should know about problems with precedence at all!

What my idea is:existence of some known repository of known services and their 
precedence priorities and relations to each other. Just like /etc/services has all 
over the world known port numbers and names, in the same way, maybe there would exist 
a list of such AOP libraries. But this is only idea and I don't think if it's even 
realizable...

Another low level idea would be to give to our Jim sth like this one:
aopc -classpath aop-services/*.aop:$CLASSPATH$
  |          -Daop.precedence=persistence,transactions
  |           jim.bookingsystem.*
  | 

In this case both libraries must not use the same annotations names of course.


Ok. And back to reality: there is another related problem I've discovered today.
I thought that with this code:
    /** 
  |      * @@first
  |      * @@second
  |      * @@third
  |      */
  |     public int method1()
  |     {   
  |         System.out.println("Method body.. :) ");
  |         return 17;
  |     }

I will get:
     [java] ==O==[main] FirstInterceptor: 28: @first: {}
  |      [java] ==O==[main] SecondInterceptor: 28: @second: {}
  |      [java] ==O==[main] ThirdInterceptor: 28: @third: {}

But that's not the case!
I got      [java] ==O==[main] SecondInterceptor: 28: @second: {}
  |      [java] ==O==[main] FirstInterceptor: 28: @first: {}
  |      [java] ==O==[main] ThirdInterceptor: 28: @third: {}
  | 

because definition of poincuts in jboss-aop.xml file was:
   <bind pointcut="execution(* *->@second(..))">
  |        <interceptor class="SecondInterceptor"/>
  |    </bind>
  |    <bind pointcut="execution(* *->@first(..))">
  |        <interceptor class="FirstInterceptor"/>
  |    </bind>
  |    <bind pointcut="execution(* *->@third(..))">
  |        <interceptor class="ThirdInterceptor"/>
  |    </bind>

And I must say I don't like it.

As a end user (Jim) I assume that the order of advices (defined by annotations) will 
be the same as order of their definition in method's comment.
To be more verbose, I want @@securable before @@transactionable before @@persistable.

And as you see I prefer annotations as a way of specifying system concerns instead of 
"normal" poincuts definition. 

Best regards,
Tomasz

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3849088#3849088

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3849088


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to