Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Hi All ! Got a couple of questions regarding AspectJ

HI All,

	Thank you for your replies..

   Currently I am using BCEL for my instrumentation, but in the near
future, there might be a requirement of more instrumentations, I thought
that rather than dealing with instruction level (as in BCEL), I was
thinking of shifting to AspectJ or AspectWerkz, which provides an
abstraction over instruction level with their own language constructs.
So that I as user can instrument easily with these technologies.
(ofcourse aspectJ also uses BCEL, but it is abstracted from the aspectJ
user)

   And the aspect I wanted is to be a more generic one, i.e it is not
aware atleast of what type of applications, it is going to instrument.
i.e I have different applications from differet projects, but I want the
same aspect for all of them..so what I can do is to create a generic
aspect, where the advices, pointcuts,also the classes to be instrumented
will be stored in some configuration file (ex: my.xml, not  aop.xml of
AspectJ 5) and then during load time,I will weave this aspects to the
application.

	for ex: my aspect would be something like this

public aspect AutoLog{
  							
  pointcut publicMethods() : execution(**********FROM CONFIGURATION
FILE**************);

  pointcut logObjectCalls() :   execution(*********FROM CONFIGURATION
FILE**********);
    
  before() : publicMethods(){
	if( enabled (ALSO FROM CONFIG FILE) ) // as Wes Isberg was
mentioning
    // STATEMENT TO BE INSTRUMENTED FROM CONFIG FILE
  }
    
  after() : loggableCalls(){
    // STATEMENT TO BE INSTRUMENTED FROM CONFIG FILE  }
} 

	However the above just shows a blue print of my aspect, it will
be created using concrete aspect tag during LTW.


	As you can see, it is more general aspect, which can be used in
any number of applications, irrespective of the classes or methods or
statements that should be instrumented.

	The my.xml is created at runtime, when the user selects some
particular methods of a class to be instrumented.
	
	I will have a processor, which reads my.xml and inserts concrete
aspects into aop.xml file.

	
	but, Can I have advices just as pointcut elements in this
concrete aspect tag of aop.xml? 

             <!-- define a concrete aspect inline -->
              <concrete-aspect name="com.xyz.tracing.MyTracing"
extends="tracing.AbstractTracing">
                <pointcut name="tracingScope"
expression="within(org.maw.*)"/>

		    CAN I HAVE HERE SOMETHING LIKE THE FOLLOWING HERE,
if not where should I define the advices for this concrete aspect..
		    <advice>...........before........ </advice>
		    <advice>...........after......... </advice>

              </concrete-aspect>   as shown in     
http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc
/ajdk15notebook/ltw-configuration.html


	sorry if it is silly, as I did not go thru the documentation
yet. 

Regarding LTW: 

	As far as I understood from the discussion: 
	
The configruation support will be available from AspectJ 5.
	
This support is already provided by AspectWerkz (according to Adrian).

	Btw, according to Alex: LTW in AJ1.2 has some disadvantages in
App/web servers. Which is also an imporant concern for me.

	Any comments????
	
Thank you
Reddy
	
>-----Original Message-----
>From: aspectj-users-admin@xxxxxxxxxxx 
>[mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of Alexandre Vasseur
>Sent: Mittwoch, 16. Februar 2005 22:23
>To: aspectj-users@xxxxxxxxxxx
>Subject: Re: [aspectj-users] Hi All ! Got a couple of 
>questions regarding AspectJ
>
>
>Just a note: LTW as it is in AJ 1.2 relies on a Java 1.4 option, and
>if you plan to use it for LTW in the context of an app server / web
>server that will not do the job correctly due to the classloader
>complexity.
>Hence the AspectJ 5 plans.
>
>Alex
>
>
>On Wed, 16 Feb 2005 12:33:13 -0800, Wes Isberg 
><wes@xxxxxxxxxxxxxx> wrote:
>> Hi Adrian,
>> 
>> No harm, no problem, no need to reply...
>> 
>> Just for the record, only the aspects need to be compiled with ajc.
>> 
>> Without LTW:
>> 
>>  CLASSPATH="classes"
>>  java Main
>> 
>> With LTW:
>> 
>>  ajc -sourceroots aspectj-src/ -outjar aspects.jar
>>  export ASPECTPATH=aspects.jar
>>  {aspectj-1.2.1}/bin/aj Main
>> 
>> Enjoy -
>> Wes
>> 
>> ------------Original Message------------
>> From: Adrian Powell <apowell@xxxxxxxxxx>
>> To: aspectj-users@xxxxxxxxxxx
>> Date: Wed, Feb-16-2005 12:16 PM
>> Subject: Re: [aspectj-users] Hi All ! Got a couple of 
>questions regarding    AspectJ
>> 
>> Wes,
>> 
>> I haven't used the LTW in AspectJ, but from what I read, it 
>requires that you compile the Java files with ajc (iajc ant 
>task) which isn't what Reddy had asked.  His question about 
>providing pointcuts at runtime also sounded more like an 
>AspectWerkz-like LTW feature with the XML-configuration file.  
>I agree though, that your answer is more helpful.
>> 
>> cheers,
>> -adrian.
>> --
>> Adrian Powell
>> Centre for IBM e-Business Innovation :: Vancouver
>> apowell@xxxxxxxxxx / 604-297-3194
>> 
>> "Wes Isberg" <wes@xxxxxxxxxxxxxx>
>> Sent by: aspectj-users-admin@xxxxxxxxxxx
>> 02/16/2005 11:52 AM Please respond to
>> aspectj-users
>> 
>> Toaspectj-users@xxxxxxxxxxx
>> cc
>> SubjectRe: [aspectj-users] Hi All ! Got a couple of 
>questions regarding        AspectJ
>> 
>> 
>> Load-time weaving support has been in AspectJ since 1.2.
>> See the bin directory and the examples in the AspectJ 1.2.1 release.
>> 
>> Wes
>> 
>> ------------Original Message------------
>> From: Adrian Powell <apowell@xxxxxxxxxx>
>> To: aspectj-users@xxxxxxxxxxx
>> Cc: aspectj-users@xxxxxxxxxxx
>> Date: Wed, Feb-16-2005 11:22 AM
>> Subject: Re: [aspectj-users] Hi All ! Got a couple of 
>questions regarding AspectJ
>> 
>> Reddy,
>> 
>> It sounds like you want support for Load-Time Weavers.  
>There is some notes about the future direction of AspectJ to 
>support this in the Developer's Notebook: 
>http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj
>-home/doc/ajdk15notebook/ltw.html.  It will have notes about 
>how to compile your source and drop in aspects at runtime, how 
>to use XML files to configure the pointcuts and advice, and 
>other handy features.  AFAIK, this isn't well supported in 
>AspectJ yet, but with the addition of AspectWerkz, we can 
>expect to see this in the near future.
>> 
>> cheers,
>> -adrian.
>> --
>> Adrian Powell
>> Centre for IBM e-Business Innovation :: Vancouver
>> apowell@xxxxxxxxxx / 604-297-3194
>> 
>> "Koduru, Rajendra Kumar Reddy" <rajendra.kumar.reddy.koduru@xxxxxxx>
>> Sent by: aspectj-users-admin@xxxxxxxxxxx
>> 02/16/2005 11:04 AM Please respond to
>> aspectj-users
>> 
>> To<aspectj-users@xxxxxxxxxxx>
>> cc
>> Subject[aspectj-users] Hi All ! Got a couple of questions 
>regarding AspectJ
>> 
>> HI AspectJ users,
>> 
>>               I am new to AOP, so just started to know info 
>about aspectJ. Got
>> a basic idea with FAQ'S and some paper online. However got few
>> queries..Hope that you can help me in this regard.. The list follows
>> 
>> ** Note:: Here my questions are related to development aspects.
>> Production aspects can be neglected. Of course few are general
>> questions.
>> 
>> 1.  I have compiled my application using javac. I develop few aspects
>> for this application. I only want to compile the aspects 
>nothing else.
>> Is it possible?
>> 
>> 2.  If the answer to the above question is YES, can i use 
>the new byte
>> code weaver with this aspect binaries and normal .class files [javac
>> output]??
>> 
>> 3.  If i want to instrument only few methods, which i dont know at
>> compile time of the aspect, what should i do? i.e is it possible to
>> provide pointcuts and advices for an aspect at run time??
>>               i.e. I want only few methods of a particular 
>class to be
>> instrumented, and i dont know these methods at compile time. 
>I want the
>> user to select the methods and packages/classes at runtime via UI.
>>               so that I can have a general aspect, which need not be
>> recompiled.
>> 
>> 4. I have compiled sources and aspects with ajc compiler, 
>and if want to
>> deliver to the customer, without the aspects that were 
>introduced with
>> the compilation..how can I remove those?? Is selective removal of
>> aspects possible?? If so could you please let me know the 
>option to be
>> used.
>> 
>> I hope that you will consider my queries and can help me in this
>> regard
>> 
>> Thank you
>> Reddy
>> 
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>> 
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>> 
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top