XDoclet, JBOSS-AOP Example3

Discussion in 'Java' started by X_AWemner_X, Aug 7, 2003.

  1. X_AWemner_X

    X_AWemner_X Guest

    http://www.onjava.com/pub/a/onjava/2003/05/28/aop_jboss.html?page=2
    http://www.jboss.org/index.html?module=html&op=userdisplay&id=developers/pro
    jects/jboss/aop
    http://xdoclet.sourceforge.net/

    Ive just read first about XDoclet and jboss-AspectOrientedProgramming
    articles. Below is a small example from jboss-aop standalone tutorial from
    onjava site.

    I did not download anything yet, but wanted to ask how it can work at first
    place. See example code below and especially "Tracing tracing =
    (Tracing)pojo;" cast. It should not work as POJO class does not implement
    such tracing. Ok, aop does the magic and it does work. Then see example how
    to compile and run it.

    This is where Im lost in space: running "javac *.java" should give us
    castexception at compile time. Clearly it does not do so.

    What is that magic bullet to fool java compiler run successfully. Is it
    that, they do not actually run a regular com.sun.compiler?

    >>>>>>>>>

    [compile and running instructions]
    To compile and run this example:
    $ cd oreilly-aop/example3
    $ export CLASSPATH=.;jboss-common.jar;jboss-aop.jar;javassist.jar
    $ javac *.java
    $ java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader
    POJO

    [example 3 code]
    public class POJO {
    public POJO() {}

    public void helloWorld() { System.out.println("Hello World!"); }

    /**
    * @jboss-aop.metadata group="tracing"
    * filter="true"
    */
    public static void main(String[] args) {
    POJO pojo = new POJO();
    Tracing tracing = (Tracing)pojo;
    pojo.helloWorld();
    System.out.println("Turn off tracing");
    tracing.disableTracing();
    pojo.helloWorld();
    System.out.println("Turn on tracing");
    tracing.enableTracing();
    pojo.helloWorld();
    }
    }
     
    X_AWemner_X, Aug 7, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Corfield
    Replies:
    2
    Views:
    2,032
    Richard Corfield
    Apr 22, 2004
  2. tmaus
    Replies:
    0
    Views:
    370
    tmaus
    Oct 8, 2004
  3. Alex Molochnikov
    Replies:
    1
    Views:
    643
    jjanssen
    Aug 14, 2006
  4. koslows

    XDoclet tags with JBoss

    koslows, Apr 18, 2005, in forum: Java
    Replies:
    0
    Views:
    348
    koslows
    Apr 18, 2005
  5. Greg
    Replies:
    0
    Views:
    632
Loading...

Share This Page