14 Replies Latest reply on Oct 25, 2004 8:56 AM by bill.burke

    Online weaving Ant task

      I am not crazy ?!



      * @ejb.value-object
       * name="Customer"
       * match="*"
       *
       * @ejb.value-object
       * name="CustomerLight"
       * match="light"
       */
      public abstract class CustomerEJB implements EntityBean {
      
      ...
      
      /**
       * @ejb.interface-method
       */
       public abstract CustomerValue getCustomerValue();
      
       /**
       * @ejb.interface-method
       */
       public abstract CustomerLightValue getCustomerLightValue();
      
       /**
       * @ejb.interface-method
       */
       public abstract void setCustomerValue(CustomerValue value);


      This code snippet from xdoclet example doesn't imply any CMP(ejb.persistence ?) or CMR(ejb.relation ?) fields. And this example reflects exactly what I want : get the value object of the entity bean itself.

      When I look at the code snippet given as example in SourceForge for the Value Object tag, I can see that each getter and setter pairs are defined as CMP or CMR fields.


      Yes, for the persistent fields but not for the three last methods given before.

      The error says that the getLanguageValue method do not correspond to a CMP or a CMR field, which is the case in your code.


      I know the signification of the exception but regarding the xdoclet example I have just to define this abstract methods.

      I never use the value object pattern, and of course the Xdoclet tag.


      If you don't use value object, how do you get the values of your entity beans in your views(JSP, etc...) ?

      Thanks.



        • 1. Re: Online weaving Ant task

          Sorry... not aspectwerks.bat

          I'm looking for a Ant task to make Loadtime instrumentation. Precompiled instrumentation is shown in:

          http://docs.jboss.org/aop/aspect-framework/reference/en/html/compiling.html

          But there is no information about Loadtime...

          Thanks,

          André

          • 2. Re: Online weaving Ant task
            kabirkhan

            Hi,

            depending on which loadtime method you want to use

            http://docs.jboss.org/aop/aspect-framework/reference/en/html/running.html

            you basically just pass in a system property/jvm argument. The examples shown are for running off the command line, but you do exactly the same for the ant task.

            • 3. Re: Online weaving Ant task

              Hi,

              I'm trying the reference guide example, and create a Ant project to do loadtime weaving (I don't want to precompile). It's not working... the result is "AOP!" (not "Hello, AOP!")

              Any ideas?

              Thanks,

              André
























              • 4. Re: Online weaving Ant task
                kabirkhan

                Post some more info

                • 5. Re: Online weaving Ant task

                  Class:

                  package teste;
                  public class HelloAOP {
                  public void callMe() {
                  System.out.println("AOP!");
                  }

                  public static void main(String args[]) {
                  new HelloAOP().callMe();
                  }
                  }


                  Aspect:
                  package teste;
                  import org.jboss.aop.advice.Interceptor;
                  import org.jboss.aop.joinpoint.Invocation;

                  public class HelloAOPInterceptor implements Interceptor {
                  public String getName() {
                  return "HelloAOPInterceptor";
                  }

                  public Object invoke(Invocation invocation) throws Throwable {
                  System.out.print("Hello, ");
                  return invocation.invokeNext();
                  }
                  }


                  AOP xml:
                  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>







                  Ant:





















                  • 6. Re: Online weaving Ant task

                    AOP xml:

                    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                    <aop>
                     <bind pointcut="execution(public void HelloAOP->callMe())">
                     <interceptor class="HelloAOPInterceptor"/>
                     </bind>
                    </aop>



                    Ant:
                    <project default="weave">
                     <target name="weave">
                     <property name="jboss.dir" value="D:/jboss-aop_1.0.0-FINAL"/>
                     <property name="libs.dir" value="${jboss.dir}/lib"/>
                    
                     <path id="jboss.path">
                     <pathelement location="."/>
                     <pathelement location="${libs.dir}/concurrent.jar"/>
                     <pathelement location="${libs.dir}/javassist.jar"/>
                     <pathelement location="${libs.dir}/jboss-aop.jar"/>
                     <pathelement location="${libs.dir}/jboss-aspect-library.jar"/>
                     <pathelement location="${libs.dir}/jboss-common.jar"/>
                     <pathelement location="${libs.dir}/qdox.jar"/>
                     <pathelement location="${libs.dir}/trove.jar"/>
                     </path>
                    
                     <java classname="teste.HelloAOP" classpathref="jboss.path">
                     <arg line="-Djboss.aop.path=teste.xml"/>
                     <arg line="-Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoader"/>
                     </java>
                     </target>
                    </project>


                    • 7. Re: Online weaving Ant task
                      kabirkhan

                      Try:

                      <java classname="teste.HelloAOP" classpathref="jboss.path">
                       <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader"/>
                       <sysproperty key="jboss.aop.path" value="teste.xml"/>
                      
                      </java>
                      


                      If that doesn't work, try renaming the teste.xml to teste-aop.xml

                      • 8. Re: Online weaving Ant task

                        Thanks, but still not working...

                        • 9. Re: Online weaving Ant task
                          kabirkhan

                          Note the pakage names:

                          <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                          <aop>
                           <bind pointcut="execution(public void teste.HelloAOP->callMe())">
                           <interceptor class="teste.HelloAOPInterceptor"/>
                           </bind>
                          </aop>
                          


                          • 10. Re: Online weaving Ant task

                            Still not working (again)...

                            Is there a verbose mode?
                            Is there a way to send to you the files?

                            Thanks,

                            André

                            • 11. Re: Online weaving Ant task
                              kabirkhan

                              For verbose mode set the system property jboss.aop.verbose to true, i.e




                              You can send them to me at kabir.khan a jboss.org

                              • 12. Re: Online weaving Ant task
                                kabirkhan

                                Got the files, and you need to set fork=true in the javac task:

                                <java classname="teste.HelloAOP" classpathref="jboss.path" fork="true">
                                 <sysproperty key="java.system.class.loader" value="org.jboss.aop.standalone.SystemClassLoader"/>
                                 <sysproperty key="jboss.aop.path" value="teste.xml"/>
                                
                                </java>
                                
                                


                                Otherwise, it executes as part of the java process executing ant, effetively ignoring the java.system.class.loader property, since that is only checked on the first call to java.lang.ClassLoader.getSystemClassLoader().

                                It works for me now, sorry I overlooked this :-)

                                • 13. Re: Online weaving Ant task

                                  It's working now. Thank you!!!!

                                  André

                                  • 14. Re: Online weaving Ant task
                                    bill.burke

                                    Andre, thanks for your patience!!!! If you have any further bug fixes or enhancement ideas, please don't hesitate to post on the forum!

                                    Thanks again,

                                    Bill