[seam-commits] Seam SVN: r8381 - in trunk/src/main/org/jboss/seam: core and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jun 17 17:48:34 EDT 2008


Author: norman.richards at jboss.com
Date: 2008-06-17 17:48:33 -0400 (Tue, 17 Jun 2008)
New Revision: 8381

Modified:
   trunk/src/main/org/jboss/seam/Component.java
   trunk/src/main/org/jboss/seam/core/Init.java
Log:
JBSEAM-3096

Modified: trunk/src/main/org/jboss/seam/Component.java
===================================================================
--- trunk/src/main/org/jboss/seam/Component.java	2008-06-13 17:54:41 UTC (rev 8380)
+++ trunk/src/main/org/jboss/seam/Component.java	2008-06-17 21:48:33 UTC (rev 8381)
@@ -48,6 +48,8 @@
 
 import javassist.util.proxy.MethodFilter;
 import javassist.util.proxy.MethodHandler;
+
+import org.apache.tools.ant.types.Assertions.EnabledAssertion;
 import org.jboss.seam.util.ProxyFactory;
 import javassist.util.proxy.ProxyObject;
 
@@ -948,16 +950,28 @@
 
    public void addInterceptor(Interceptor interceptor)
    {
-      if ( interceptor.getType()==InterceptorType.SERVER)
-      {
-         interceptors.add(interceptor);
-      }
-      else
-      {
-         clientSideInterceptors.add(interceptor);
-      }
+       if (isInterceptorEnabled(interceptor)) {
+           if (interceptor.getType()==InterceptorType.SERVER) {
+               interceptors.add(interceptor);
+           } else {
+               clientSideInterceptors.add(interceptor);
+           }
+       }
    }
 
+   private boolean isInterceptorEnabled(Interceptor interceptor) {
+       Class interceptorClass = interceptor.getUserInterceptorClass();
+       if (interceptorClass != null) {
+           if (Init.instance().getDisabledInterceptors().contains(interceptorClass.getName())) {
+               System.out.println("**** DISABLED INTERCEPTOR[" + name + "] " + interceptorClass);
+               return false;
+           }
+       }
+       
+       System.out.println("**** INTERCEPTOR[" + name + "] " + interceptorClass);
+       return true;
+   }
+
    private List<Interceptor> newSort(List<Interceptor> list)
    {
       List<SortItem<Interceptor>> siList = new ArrayList<SortItem<Interceptor>>();

Modified: trunk/src/main/org/jboss/seam/core/Init.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Init.java	2008-06-13 17:54:41 UTC (rev 8380)
+++ trunk/src/main/org/jboss/seam/core/Init.java	2008-06-17 21:48:33 UTC (rev 8381)
@@ -50,6 +50,8 @@
    private boolean myFacesLifecycleBug;
    private boolean transactionManagementEnabled = true;
    
+   private List<String> disabledInterceptors = new ArrayList<String>();
+   
    private Map<String, List<ObserverMethod>> observerMethods = new HashMap<String, List<ObserverMethod>>();
    private Map<String, List<ObserverMethodExpression>> observerMethodBindings = new HashMap<String, List<ObserverMethodExpression>>();
    private Map<String, FactoryMethod> factories = new HashMap<String, FactoryMethod>();
@@ -532,4 +534,14 @@
    {
       return globalImports;
    }
+
+    public List<String> getDisabledInterceptors() {
+        return disabledInterceptors;
+    }
+    
+    public void setDisabledInterceptors(List<String> disabledInterceptors) {
+        this.disabledInterceptors = disabledInterceptors;
+    }
+   
+   
 }




More information about the seam-commits mailing list