Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7A478DB50 for ; Fri, 17 Aug 2012 13:56:11 +0000 (UTC) Received: (qmail 78935 invoked by uid 500); 17 Aug 2012 13:56:11 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 78867 invoked by uid 500); 17 Aug 2012 13:56:11 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 78856 invoked by uid 99); 17 Aug 2012 13:56:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2012 13:56:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2012 13:56:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9E9712388994; Fri, 17 Aug 2012 13:55:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1374261 - in /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: blueprint/ spring/ Date: Fri, 17 Aug 2012 13:55:26 -0000 To: commits@camel.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120817135526.9E9712388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Aug 17 13:55:25 2012 New Revision: 1374261 URL: http://svn.apache.org/viewvc?rev=1374261&view=rev Log: [CAMEL-5517] Only one LoggingFeature enabled Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java?rev=1374261&r1=1374260&r2=1374261&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsClientBlueprintBean.java Fri Aug 17 13:55: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 getFeatures() { - List 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/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java?rev=1374261&r1=1374260&r2=1374261&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/blueprint/RsServerBlueprintBean.java Fri Aug 17 13:55: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 getFeatures() { - List 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/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java?rev=1374261&r1=1374260&r2=1374261&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSClientFactoryBean.java Fri Aug 17 13:55: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 getSchemaLocations() { return schemaLocations; } - - public List getFeatures() { - List 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/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java?rev=1374261&r1=1374260&r2=1374261&view=diff ============================================================================== --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/SpringJAXRSServerFactoryBean.java Fri Aug 17 13:55: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 getFeatures() { - List 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