2 Replies Latest reply on Feb 18, 2005 8:21 AM by Kabir Khan

    JBoss Server AOP Deployer doesn't work with field

    Chan Ki Newbie

      Hi All,

      I have tried to test the "field advise" with JBoss Server. But it didn't work.

      My testing sample is quite simple that when a Order Class's member field orderDate is accessed, an access Method will be called.

      public class Order
      {
      
       public int orderId = -1 ;
       public double amt = -1f;
       public Date orderDate;
      
       public void shipOut() throws OrderException
       {
       System.out.println("Order with Id : " + orderId + " is shipping out now!!");
      
      
       }
      
      }


      Advise Method :
      public Object access(FieldWriteInvocation invocation) throws Throwable
       {
       System.out.println("Write the Field");
       return invocation.invokeNext();
       }
      
       public Object access(FieldReadInvocation invocation) throws Throwable
       {
       System.out.println("Read the field");
       return invocation.invokeNext();
       }



      jboss-aop.xml:
      <bind pointcut="field(public java.util.Date Order->orderDate)">
       <advice aspect="TestingOrderAspect" name="access"/>
       </bind>



      Then, I deploy to server with *.aop. When I access the field orderDate by jsp, the access(..) method is not called.

      Is it any Wrong??

      Alfred