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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jun 23 11:30:30 EDT 2008


Author: norman.richards at jboss.com
Date: 2008-06-23 11:30:30 -0400 (Mon, 23 Jun 2008)
New Revision: 8403

Modified:
   branches/Seam_2_0/src/main/org/jboss/seam/Component.java
   branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd
   branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java
Log:
JBSEAM-3096

Modified: branches/Seam_2_0/src/main/org/jboss/seam/Component.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/Component.java	2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/Component.java	2008-06-23 15:30:30 UTC (rev 8403)
@@ -933,16 +933,26 @@
 
    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())) {
+                return false;
+            }
+        }
+        
+        return true;
+    }
+    
    private List<Interceptor> newSort(List<Interceptor> list)
    {
       List<SortItem<Interceptor>> siList = new ArrayList<SortItem<Interceptor>>();

Modified: branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java	2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/core/Init.java	2008-06-23 15:30:30 UTC (rev 8403)
@@ -49,7 +49,9 @@
    private boolean debug;
    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>();
@@ -521,4 +523,12 @@
    {
       return globalImports;
    }
+
+    public List<String> getDisabledInterceptors() {
+        return disabledInterceptors;
+    }
+    
+    public void setDisabledInterceptors(List<String> disabledInterceptors) {
+        this.disabledInterceptors = disabledInterceptors;
+    }
 }

Modified: branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd	2008-06-23 04:18:07 UTC (rev 8402)
+++ branches/Seam_2_0/src/main/org/jboss/seam/core-2.0.xsd	2008-06-23 15:30:30 UTC (rev 8403)
@@ -6,6 +6,10 @@
 
     <xs:element name="init">
         <xs:complexType mixed="true">
+            <xs:choice minOccurs="0" maxOccurs="unbounded">
+                <xs:element name="disabled-interceptors" type="components:multiValuedProperty" />
+            </xs:choice>
+
             <xs:attributeGroup ref="components:attlist.component"/>
             <xs:attributeGroup ref="core:attlist.init"/>
         </xs:complexType>
@@ -29,6 +33,7 @@
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="user-transaction-name"/>
+        <xs:attribute name="disabled-interceptors" type="components:string" />
     </xs:attributeGroup>
 
     <xs:element name="manager">




More information about the seam-commits mailing list