[seam-commits] Seam SVN: r10411 - in tags/JBoss_Seam_2_1_2_CR1: src/wicket/org/jboss/seam/wicket and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 14 14:59:42 EDT 2009


Author: norman.richards at jboss.com
Date: 2009-04-14 14:59:42 -0400 (Tue, 14 Apr 2009)
New Revision: 10411

Modified:
   tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Book.java
   tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Confirm.java
   tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Hotel.java
   tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Main.java
   tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java
   tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
   tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/WicketHandler.java
Log:
JBSEAM-4111 JBSEAM-4112

Modified: tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Book.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Book.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Book.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -122,7 +122,7 @@
          hotelBooking.setBookingDetails();
          if (hotelBooking.isBookingValid())
          {
-            setResponsePage(Confirm.class);
+            setResponsePage(new Confirm(new PageParameters()));
          }
       }
 

Modified: tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Confirm.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Confirm.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Confirm.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -41,7 +41,7 @@
          @Override
          public void onClick()
          {
-            setResponsePage(Book.class);
+            setResponsePage(new Book(new PageParameters()));
          }
       });
       body.add(new Link("confirm")

Modified: tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Hotel.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Hotel.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Hotel.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -31,7 +31,7 @@
 	      public void onClick()
 	      {
 	         hotelBooking.bookHotel();
-	         setResponsePage(Book.class);
+	         setResponsePage(new Book(new PageParameters()));
 	      }
 	   });
 	   body.add(new Link("cancel")

Modified: tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Main.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Main.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/examples/wicket/src/web/org/jboss/seam/example/wicket/Main.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -37,9 +37,12 @@
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.markup.repeater.data.DataView;
 import org.apache.wicket.model.PropertyModel;
-import org.jboss.seam.annotations.Begin;
+import org.apache.wicket.PageParameters;
+import org.jboss.seam.wicket.annotations.Begin;
 import org.jboss.seam.annotations.In;
 import org.jboss.seam.annotations.security.Restrict;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.Manager;
 import org.jboss.seam.example.wicket.action.Booking;
 import org.jboss.seam.example.wicket.action.BookingList;
 import org.jboss.seam.example.wicket.action.Hotel;
@@ -127,12 +130,12 @@
             item.add(new Link("viewHotel")
             {
 
+							 @Begin
                @Override
-               @Begin
                public void onClick()
                {
                   hotelBooking.selectHotel(hotel);
-                  setResponsePage(org.jboss.seam.example.wicket.Hotel.class);
+                  setResponsePage(new org.jboss.seam.example.wicket.Hotel(new PageParameters()));
                }
             
             });

Modified: tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/SeamWebApplication.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -194,6 +194,14 @@
                   manager.restoreConversation();
                }
             }
+            else 
+            {
+               Manager manager = Manager.instance();
+               if (manager.isLongRunningConversation()) 
+               {
+                  page.setMetaData(CID, Manager.instance().getCurrentConversationId());
+               }
+            }
          }
       }
       

Modified: tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/JavassistInstrumentor.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -130,15 +130,6 @@
    {
       this.classPool = classPool;
       this.scanAnnotations = scanAnnotations;
-      
-      try
-      {
-         instrumentedComponent = classPool.get(InstrumentedComponent.class.getName());
-      }
-      catch (NotFoundException e)
-      {
-         throw new RuntimeException(e);
-      }
    }
 
    public JavassistInstrumentor(ClassPool classPool, Set<String> packagesToInstrument, boolean scanAnnotations)
@@ -197,7 +188,7 @@
 
       CtClass exception = classPool.get(Exception.class.getName());
 
-      implementation.addInterface(instrumentedComponent);
+      implementation.addInterface(getInstrumentedComponentInterface());
       CtMethod getHandlerMethod = CtNewMethod.getter("getHandler", handlerField);
       CtMethod getEnclosingInstance = CtNewMethod.make("public " + InstrumentedComponent.class.getName() + " getEnclosingInstance() { return handler == null ? null : handler.getEnclosingInstance(this); }", implementation);
       implementation.addMethod(getEnclosingInstance);
@@ -427,7 +418,7 @@
          // can't use 'isSubtype' because the superclass may be instrumented
          // while we are not
          for (String inf : clazz.getClassFile2().getInterfaces())
-            if (inf.equals(instrumentedComponent.getName()))
+            if (inf.equals(getInstrumentedComponentInterface().getName()))
                return false;
       }
       catch (Exception e)
@@ -439,6 +430,26 @@
    }
 
    /**
+    * We have to look this up lazily because when our constructor is called we may not have the appropriate paths added to our ClassPool,
+    * particularly if we are doing runtime instrumentation using WEB-INF/wicket
+    */
+   private CtClass getInstrumentedComponentInterface() 
+   {
+      if (instrumentedComponent == null)
+      {
+         try
+         {
+            instrumentedComponent = classPool.get(InstrumentedComponent.class.getName());
+         }
+         catch (NotFoundException e)
+         {
+            throw new RuntimeException(e);
+         }
+      }
+      return instrumentedComponent;
+   }
+   
+   /**
     * This is the implementation of the ClassFileTransformer interface.  
     * @see java.lang.instrument.ClassFileTransformer
     */
@@ -448,22 +459,35 @@
       if (index < 1)
          return null;
       String packageName = className.substring(0, index);
-      if (!packagesToInstrument.contains(packageName) || className.contains("_javassist_"))
-      {
-         return null;
-      }
-      try
-      {
-         CtClass result = instrumentClass(classfileBuffer);
-         if (result == null)
-            return null;
-         else
-            return result.toBytecode();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
+      do 
+      { 
+         if (packagesToInstrument.contains(packageName) && !className.contains("_javassist_"))
+         {
+            try
+            {
+               CtClass result = instrumentClass(classfileBuffer);
+               if (result == null)
+                  return null;
+               else
+                  return result.toBytecode();
+            }
+            catch (Exception e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+         index = packageName.lastIndexOf('/');
+         if (index < 1)
+         {
+            packageName = "";
+         }
+         else 
+         {
+            packageName = packageName.substring(0,index);
+         }
+      } while (packageName.length() > 0);
+      
+      return null;
    }
 
    /**

Modified: tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/WicketHandler.java
===================================================================
--- tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/WicketHandler.java	2009-04-14 18:01:50 UTC (rev 10410)
+++ tags/JBoss_Seam_2_1_2_CR1/src/wicket/org/jboss/seam/wicket/ioc/WicketHandler.java	2009-04-14 18:59:42 UTC (rev 10411)
@@ -68,7 +68,7 @@
       }
       reentrant++;
       InstrumentedComponent enclosing = getEnclosingInstance(invocationContext.getBean());
-      if (enclosing != null)
+      if (enclosing != null && enclosing.getHandler() != null)
       {
          enclosing.getHandler().injectEnclosingInstance(enclosing);
       }
@@ -124,7 +124,7 @@
          }
       }
       InstrumentedComponent enclosing = getEnclosingInstance(invocationContext.getBean());
-      if (enclosing != null)
+      if (enclosing != null && enclosing.getHandler() != null)
       {
          enclosing.getHandler().disinjectEnclosingInstance(enclosing);
       }




More information about the seam-commits mailing list