Skip to main content

AspectJ with JSF1.2

2 replies [Last post]
kosna
Offline
Joined: 2011-10-14
Points: 0

HI All,

I want to profile war module controllers. so i want to make use of AspectJ. my application server is glassfish v2.x, IDE is netbeans 6.9.1 and Framework is JSF1.2. i didnot integrate my application with spring. could anyone provide some sample code with configuration details. I have written some smaple for tracing the method calls nbut i dont know how to configure in my aplication. My application file is EAR (EJB + WAR). Here my requirement is need to get the WAR module managed-beans execution time. For EJB's I am using the default Interceptor. so This is the sample code to get the execution time of WAR module managed-beans. So if anybody give some information it could be much helpful to me. so please kindly provide some information on it.

@Aspect
public class LogInterceptor {
private static final long serialVersionUID = 1L;

public LogInterceptor() {
}

@Pointcut("execution (* *.*(..))")
public void profile() {
}

@SuppressWarnings("unchecked")
@Around("profile()")

public Object invoke(ProceedingJoinPoint thisJoinPoint) throws Throwable {
System.out.println("test start");
Object obj = thisJoinPoint.proceed();
System.out.println("test end");
return obj;
}
}

Thanks & regards,

Sridhar Kosna.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
teleporter
Offline
Joined: 2012-05-14
Points: 0

what is this for? am i in the wrong forum? :confused: seems all of the questions here are for professionals :sad:

kosna
Offline
Joined: 2011-10-14
Points: 0

I configured this by creating a target in my buil.xml file so now each and every method has been waeving out with aspectJ

<taskdef classpath="C:/Users/s.kosna/Downloads/aspectj-1.6.11/lib/aspectjtools.jar"
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/>

<target name="aspectj">
<echo level="info">--- aspectj (start) ---</echo>
<condition property="targetos" value="windows" else="unix">
<os family="windows"/>
</condition>
<pathconvert targetos="${targetos}" property="javac.convertedClasspath" >
<path path="${javac.classpath}" />
</pathconvert>
<iajc source="1.6" target="1.6" showweaveinfo="true" verbose="true" destdir="${build.classes.dir}" >
<inpath>
<pathelement location="${build.classes.dir}"/>
</inpath>
<classpath>
<pathelement location="${javac.convertedClasspath}" />
</classpath>
</iajc>
<echo level="info">Converis BRUTAL TEST ---</echo>
</target>

<target name="-post-compile" depends="aspectj"></target>