You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2012/08/17 16:10:26 UTC

svn commit: r1374274 - in /camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: blueprint/ spring/

Author: dkulp
Date: Fri Aug 17 14:10:25 2012
New Revision: 1374274

URL: http://svn.apache.org/viewvc?rev=1374274&view=rev
Log:
Merged revisions 1374266 via  git cherry-pick from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x

........
  r1374266 | dkulp | 2012-08-17 09:59:51 -0400 (Fri, 17 Aug 2012) | 10 lines

  Merged revisions 1374261 via  git cherry-pick from
  https://svn.apache.org/repos/asf/camel/trunk

  ........
    r1374261 | dkulp | 2012-08-17 09:55:25 -0400 (Fri, 17 Aug 2012) | 2 lines

    [CAMEL-5517] Only one LoggingFeature enabled

  ........

........

Modified:
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java?rev=1374274&r1=1374273&r2=1374274&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java Fri Aug 17 14:10:25 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.cxf.blueprint;
 
-import java.util.List;
-
-import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.osgi.framework.BundleContext;
@@ -27,8 +24,8 @@ import org.osgi.service.blueprint.contai
 public class RsClientBlueprintBean extends JAXRSClientFactoryBean implements BlueprintSupport, Cloneable {
     private BlueprintContainer blueprintContainer;
     private BundleContext bundleContext;
-    private boolean loggingFeatureEnabled;
     private int loggingSizeLimit;
+    private LoggingFeature loggingFeature;
     
     public BlueprintContainer getBlueprintContainer() {
         return blueprintContainer;
@@ -47,11 +44,23 @@ public class RsClientBlueprintBean exten
     }
     
     public boolean isLoggingFeatureEnabled() {
-        return loggingFeatureEnabled;
+        return loggingFeature != null;
     }
 
     public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
-        this.loggingFeatureEnabled = loggingFeatureEnabled;
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            loggingFeature = null;
+        }
+        if (loggingFeatureEnabled) {
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature = new LoggingFeature(getLoggingSizeLimit());
+            } else {
+                loggingFeature = new LoggingFeature();
+            }
+            getFeatures().add(loggingFeature);
+        }
+        
     }
 
     public int getLoggingSizeLimit() {
@@ -60,18 +69,15 @@ public class RsClientBlueprintBean exten
 
     public void setLoggingSizeLimit(int loggingSizeLimit) {
         this.loggingSizeLimit = loggingSizeLimit;
-    }
-    
-    public List<AbstractFeature> getFeatures() {
-        List<AbstractFeature> answer = super.getFeatures();
-        if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() > 0) {
-                answer.add(new LoggingFeature(getLoggingSizeLimit()));
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            if (loggingSizeLimit > 0) {
+                loggingFeature = new LoggingFeature(loggingSizeLimit);
             } else {
-                answer.add(new LoggingFeature());
+                loggingFeature = new LoggingFeature();
             }
+            getFeatures().add(loggingFeature);
         }
-        return answer;
     }
 
 }

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java?rev=1374274&r1=1374273&r2=1374274&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java Fri Aug 17 14:10:25 2012
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.component.cxf.blueprint;
 
-import java.util.List;
-
-import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.osgi.framework.BundleContext;
@@ -28,7 +25,7 @@ public class RsServerBlueprintBean exten
     
     private BlueprintContainer blueprintContainer;
     private BundleContext bundleContext;
-    private boolean loggingFeatureEnabled;
+    private LoggingFeature loggingFeature;
     private int loggingSizeLimit;
     
     public BlueprintContainer getBlueprintContainer() {
@@ -48,31 +45,40 @@ public class RsServerBlueprintBean exten
     }
     
     public boolean isLoggingFeatureEnabled() {
-        return loggingFeatureEnabled;
+        return loggingFeature != null;
     }
 
     public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
-        this.loggingFeatureEnabled = loggingFeatureEnabled;
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            loggingFeature = null;
+        }
+        if (loggingFeatureEnabled) {
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature = new LoggingFeature(getLoggingSizeLimit());
+            } else {
+                loggingFeature = new LoggingFeature();
+            }
+            getFeatures().add(loggingFeature);
+        }
+        
     }
-
+    
     public int getLoggingSizeLimit() {
         return loggingSizeLimit;
     }
 
     public void setLoggingSizeLimit(int loggingSizeLimit) {
         this.loggingSizeLimit = loggingSizeLimit;
-    }
-    
-    public List<AbstractFeature> getFeatures() {
-        List<AbstractFeature> answer = super.getFeatures();
-        if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() > 0) {
-                answer.add(new LoggingFeature(getLoggingSizeLimit()));
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            if (loggingSizeLimit > 0) {
+                loggingFeature = new LoggingFeature(loggingSizeLimit);
             } else {
-                answer.add(new LoggingFeature());
+                loggingFeature = new LoggingFeature();
             }
+            getFeatures().add(loggingFeature);
         }
-        return answer;
     }
     
 }

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java?rev=1374274&r1=1374273&r2=1374274&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java Fri Aug 17 14:10:25 2012
@@ -22,7 +22,6 @@ import org.apache.camel.component.cxf.ja
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.version.Version;
@@ -33,18 +32,30 @@ import org.springframework.context.Appli
 public class SpringJAXRSClientFactoryBean extends JAXRSClientFactoryBean
     implements ApplicationContextAware, BeanIdAware {
     private String beanId;
-    private boolean loggingFeatureEnabled;
     private int loggingSizeLimit;
+    private LoggingFeature loggingFeature;
 
     public SpringJAXRSClientFactoryBean() {
     }
     
     public boolean isLoggingFeatureEnabled() {
-        return loggingFeatureEnabled;
+        return loggingFeature != null;
     }
 
     public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
-        this.loggingFeatureEnabled = loggingFeatureEnabled;
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            loggingFeature = null;
+        }
+        if (loggingFeatureEnabled) {
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature = new LoggingFeature(getLoggingSizeLimit());
+            } else {
+                loggingFeature = new LoggingFeature();
+            }
+            getFeatures().add(loggingFeature);
+        }
+        
     }
 
     public int getLoggingSizeLimit() {
@@ -53,7 +64,18 @@ public class SpringJAXRSClientFactoryBea
 
     public void setLoggingSizeLimit(int loggingSizeLimit) {
         this.loggingSizeLimit = loggingSizeLimit;
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            if (loggingSizeLimit > 0) {
+                loggingFeature = new LoggingFeature(loggingSizeLimit);
+            } else {
+                loggingFeature = new LoggingFeature();
+            }
+            getFeatures().add(loggingFeature);
+        }
     }
+
+    
     
     @SuppressWarnings("deprecation")
     @Override
@@ -83,16 +105,4 @@ public class SpringJAXRSClientFactoryBea
     List<String> getSchemaLocations() {
         return schemaLocations;
     }
-    
-    public List<AbstractFeature> getFeatures() {
-        List<AbstractFeature> answer = super.getFeatures();
-        if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() > 0) {
-                answer.add(new LoggingFeature(getLoggingSizeLimit()));
-            } else {
-                answer.add(new LoggingFeature());
-            }
-        }
-        return answer;
-    }
 }
\ No newline at end of file

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java?rev=1374274&r1=1374273&r2=1374274&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java Fri Aug 17 14:10:25 2012
@@ -22,7 +22,6 @@ import org.apache.camel.component.cxf.ja
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
@@ -34,7 +33,7 @@ import org.springframework.context.Appli
 public class SpringJAXRSServerFactoryBean extends JAXRSServerFactoryBean implements
     ApplicationContextAware, BeanIdAware {
     private String beanId;
-    private boolean loggingFeatureEnabled;
+    private LoggingFeature loggingFeature;
     private int loggingSizeLimit;
     
     public SpringJAXRSServerFactoryBean() {
@@ -73,30 +72,39 @@ public class SpringJAXRSServerFactoryBea
     }
     
     public boolean isLoggingFeatureEnabled() {
-        return loggingFeatureEnabled;
+        return loggingFeature != null;
     }
 
     public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
-        this.loggingFeatureEnabled = loggingFeatureEnabled;
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            loggingFeature = null;
+        }
+        if (loggingFeatureEnabled) {
+            if (getLoggingSizeLimit() > 0) {
+                loggingFeature = new LoggingFeature(getLoggingSizeLimit());
+            } else {
+                loggingFeature = new LoggingFeature();
+            }
+            getFeatures().add(loggingFeature);
+        }
+        
     }
-
+    
     public int getLoggingSizeLimit() {
         return loggingSizeLimit;
     }
 
     public void setLoggingSizeLimit(int loggingSizeLimit) {
         this.loggingSizeLimit = loggingSizeLimit;
-    }
-    
-    public List<AbstractFeature> getFeatures() {
-        List<AbstractFeature> answer = super.getFeatures();
-        if (isLoggingFeatureEnabled()) {
-            if (getLoggingSizeLimit() > 0) {
-                answer.add(new LoggingFeature(getLoggingSizeLimit()));
+        if (loggingFeature != null) {
+            getFeatures().remove(loggingFeature);
+            if (loggingSizeLimit > 0) {
+                loggingFeature = new LoggingFeature(loggingSizeLimit);
             } else {
-                answer.add(new LoggingFeature());
+                loggingFeature = new LoggingFeature();
             }
+            getFeatures().add(loggingFeature);
         }
-        return answer;
-    }
+    }   
 }
\ No newline at end of file