[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] New to Aspect J!!!

Hi All,

I'm quite new to Aspect J. I wrote a logger that can
print the log message at the beginning and end of any
method and i tested it using a test class. It works
fine.  Now i want this to be added to my project for
all the classes whenever required.

Let's say for the test purposes i use the package
a.b.c.d

I've the following  files in that package

a.b.c.d.Trace.java
a.b.c.d.TraceAspect.java
a.b.c.d.TestBean.java

I also have a files called files.lst which has the
following entries

TestBean.java
Trace.java
TraceAspect.java

In this case, it works fine with me.


If i want to add this aspect to all the classes in my
project, should i have to provide a files.lst in each
of the package folders and one main files.lst with
references to all these sub folders????  Do i need to
add each and every file that needs to be intercepted
in this files.lst in each and every package?

The problem is that i've source code in multiple
folders (shared folder which has source code shared by
multiple projects etc).  If i add the following lines:

  <src path="${src.dir}"/>
                    <src path="${sharedsrc.dir}"/>
                    <src path="${gensrc.dir}"/>       
in the "iajc" task as follows, i get that Trace
"already defined error" as it's found in the src.dir
and also in files.lst.  Should i keep the aspects in a
difference package hierarchy??? What's the best way to
enable AOP using my Trace aspect for all my classes.

<target name="Ajx" depends="init">
                <mkdir
dir="${build.dir}/classes/aspects"/>
                <echo message="list of files are:
${list}"/>
                <iajc destdir="${build.dir}/classes"
fork="true" forkclasspath="${aspectjtools.jar}"
argfiles="${list}">       
                    <src path="${src.dir}"/>
                    <src path="${sharedsrc.dir}"/>
                    <src path="${gensrc.dir}"/>       
 
                        <classpath>
                                <path
refid="aspectj.lib"/>
                                <path
refid="classpath"/>
                        </classpath>
                </iajc>
                 <antcall target="Ajx-run" >
                         <param name="class"
value="${class}"/>
               </antcall>
</target>


Thanks in advance,

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com