Re: Dynamic configuration

Jonas Bonér <[email protected]> Fri, 09 May 2003 20:59:17 +0200
Newsgroups gmane.comp.java.aspectwerkz
Message-ID <[email protected]>
Hi Vincent.

At the moment you can't add new pointcuts. This since it requires the 
class to be re-weaved (meaning reloaded as well). I have support for 
that coming but it is not at all stable yet. In the future you will be 
able to change the definition file at runtime and when you reload your 
class it will get weaved with the new definition, e.g. the new pointcuts.

So the solution for today is to be very generous when defining the 
pointcuts. I.e. if you define an aspect like:

<aspect pattern="myclasses..">
	<pointcut type="method" pattern"* *(..)"/>
</aspect>

Now it will weave all methods in all classes under the myclasses 
package. And you will be able to add and remove advices as much as you 
want.

Sincererly, Jonas.

Vincent Tencé wrote:
> Hi Jonas,
> 
> I understood that I can add/manage aspects at runtime and associate them to
> pointcuts. I don't need to reload classes for that, right? Now, what do I
> need to do to add pointcuts at runtime without going through the
> configuration file? How do you see that could be implemented? I have  been
> looking at the definition package, but I must admit I got lost quick ;-) I
> need a little help to get me started.
> 
> Thanks,
> -- Vincent
> 
> 
>>-----Original Message-----
>>From: Jonas Bonér [mailto:[email protected]]
>>Sent: Wednesday, May 07, 2003 09:42
>>To: Vincent Tencé
>>Cc: [email protected]
>>Subject: Re: [aspectwerkz-developer] Dynamic configuration
>>
>>
>>Hi again.
>>
>>I forgot to tell you that you can retrieve the pointcuts for
>>a certain
>>method/field like this:
>>
>>// first create a MethodMetaData object holding info. about
>>the method
>>(similar usage with fields)
>>
>>// retrieve all the pointcuts for the method specified
>>MethodPointcut[] pointcuts = AspectWerkz.getAspect("test.MyClass").
>>getMethodPointcut(MethodMetaData metaData);
>>
>>// do stuff...
>>
>>Vincent Tencé wrote:
>>
>>>Thats' great!
>>>
>>>I am looking forward to that release. In the meantime,
>>
>>could you give me
>>
>>>some details of how the new dynamic feature work?
>>>
>>>Thanks,
>>>-- Vincent
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Jonas Bonér [mailto:[email protected]]
>>>>Sent: Wednesday, May 07, 2003 07:27
>>>>To: Vincent Tencé
>>>>Cc: [email protected]
>>>>Subject: Re: [aspectwerkz-developer] Dynamic configuration
>>>>
>>>>
>>>>Hi Vincent.
>>>>
>>>>Today I implemented the feature of being able to add completely new
>>>>advices at runtime. This will be included in the next
>>
>>official release
>>
>>>>(this or next week).
>>>>
>>>>If you (after a while) are feeling constraint in what you want to be
>>>>able to do, just drop me an email telling me know what you
>>
>>need and we
>>
>>>>can have a talk about it.
>>>>
>>>>It is in my highest interest to make AspectWerkz a *very*
>>>>dynamic framework.
>>>>
>>>>Sincerely, Jonas.
>>>>
>>>>
>>>>Vincent Tencé wrote:
>>>>
>>>>
>>>>>Jonas Bonér wrote:
>>>>>
>>>>>
>>>>>
>>>>>>The advices can be dynamically be added, rearranged and removed at
>>>>>>runtime without reloading your classes. (See the docs:
>>>>>>[http://aspectwerkz.sourceforge.net/documentation.html#Hot%20d
>>>>>>eployment].)
>>>>>>
>>>>>>The limitation is that you can only do this at pointcuts that has
>>>>>>already been advised. I.e. you have to know the places where
>>>>>>you want to
>>>>>>be able to handle the advices dynamically. (Either you know
>>>>>>these points
>>>>>>or you have to be *very* generous when defining your pointcuts.)
>>>>>>
>>>>>>If you reload your classes at runtime then you should as well
>>>>>>be able to
>>>>>>change the pointcuts, e.g. transform your classes according to a
>>>>>>modified XML defininition. This since the framework reloads the
>>>>>>definition file as soon as it has been updated (or the
>>>>>>attributes if you
>>>>>>are using runtime attributes). This feature I have not had
>>>>>>the time to
>>>>>>test thoroughly.
>>>>>
>>>>>
>>>>>Thanks for the pointer.
>>>>>
>>>>>I guess I can get around this in a first phase by generating the
>>>>>config file on the fly then loading/reloading the framework.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>I don't know if this is sufficient for you.
>>>>>
>>>>>
>>>>>At some point, I will look into adding the ability to specify
>>>>>aspects using the API. Any thoughts/issues on/with that?
>>>>>
>>>>>Thanks,
>>>>>-- Vincent
>>>>>
>>>>>
>>>>>
>>>>>-------------------------------------------------------
>>>>>Enterprise Linux Forum Conference & Expo, June 4-6, 2003,
>>>>
>>>>Santa Clara
>>>>
>>>>
>>>>>The only event dedicated to issues related to Linux
>>>>
>>>>enterprise solutions
>>>>
>>>>
>>>>>www.enterpriselinuxforum.com
>>>>>
>>>>>_______________________________________________
>>>>>aspectwerkz-developer mailing list
>>>>>[email protected]
>>>>>https://lists.sourceforge.net/lists/listinfo/aspectwerkz-developer
>>>>>
>>>>>
>>>>
>>>>
>>>>--
>>>>Jonas
>>>>http://freeroller.net/page/jboner
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>Enterprise Linux Forum Conference & Expo, June 4-6, 2003,
>>
>>Santa Clara
>>
>>>The only event dedicated to issues related to Linux
>>
>>enterprise solutions
>>
>>>www.enterpriselinuxforum.com
>>>
>>>_______________________________________________
>>>aspectwerkz-developer mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/aspectwerkz-developer
>>>
>>>
>>
>>
>>--
>>Jonas
>>http://freeroller.net/page/jboner
>>
>>
>>
>>
> 
> 
> 
> 
> -------------------------------------------------------
> Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> The only event dedicated to issues related to Linux enterprise solutions
> www.enterpriselinuxforum.com
> 
> _______________________________________________
> aspectwerkz-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aspectwerkz-developer
> 
> 


-- 
Jonas
http://freeroller.net/page/jboner





-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com