This content has been marked as final.
Show 2 replies
-
1. Re: Running DR2 troubles
bill.burke Mar 5, 2004 9:01 PM (in response to gesha)code please? How are you running?
FYI, if you can wait, DR3 is in two weeks. Unfortunately though, it is a complete revamp in the XML department.
Bill -
2. Re: Running DR2 troubles
gesha Mar 6, 2004 7:15 AM (in response to gesha)The problem is solved - i run it under eclipce, and after switching to the DR2 i need to reassign run-parms for this task. BTW...
In DR1 I can't define method-pointcut instead pre-defined interceptor-pointcut. Whis same syntax it's working same. But....
..after definition <method-pointcut> (see code) my Interceptor don't get control anymore? What is wrong?
jbossaop.xml:<?xml version="1.0" encoding="UTF-8"?> <aop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jbossaop.xsd"> <advisable class="test.hello.HelloWorld" fieldFilter="ALL" methodFilter="say.*" /> <method-pointcut group="localization" class="test.hello.HelloWorld" methodName="say.*"> <interceptors> <interceptor class="test.hello.jbossaop.Localization"/> </interceptors> </method-pointcut> <!-- <interceptor-pointcut class="test.hello.HelloWorld"> <interceptors> <interceptor class="test.hello.jbossaop.Localization"/> </interceptors> </interceptor-pointcut> --> </aop>
HelloWorld.javapackage test.hello; public class HelloWorld { public static void main(String[] args) { HelloWorld helloworldTmp = new HelloWorld(); helloworldTmp .say("Hello", args[0]); } public void say(String message){ System.out.println(message); } public void say(String message, String name){ say (message + " " + name); } }
Localization.javapackage test.hello.jbossaop; import org.jboss.aop.Interceptor; import org.jboss.aop.Invocation; import org.jboss.aop.InvocationResponse; import org.jboss.aop.InvocationType; import org.jboss.aop.MethodInvocation; public class Localization implements Interceptor { public String getName() { // TODO Auto-generated method stub return "sdfsdfadsfsd"; } public InvocationResponse invoke(Invocation invocation) throws Throwable { System.out.println("intercept started!"); if (invocation.getType() == InvocationType.METHOD){ MethodInvocation mi = (MethodInvocation )invocation; if (mi.arguments.length==2){ mi.arguments[1]="translated:"+mi.arguments[1]; } } // TODO Auto-generated method stub InvocationResponse ir = invocation.invokeNext(); return ir; } }