Author: ningjiang
Date: Thu Jul 31 19:26:05 2008
New Revision: 681589
URL: http://svn.apache.org/viewvc?rev=681589&view=rev
Log:
Fixed the CS errors of components
Modified:
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java
Modified:
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
(original)
+++
activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
Thu Jul 31 19:26:05 2008
@@ -32,7 +32,7 @@
* @version $Revision$
*/
public final class CxfHeaderHelper {
-
+
/**
* Utility class does not have public constructor
*/
@@ -42,26 +42,26 @@
/**
* Progagates Camel headers to CXF message.
- *
+ *
* @param strategy header filter strategy
* @param headers Camel header
* @param message CXF meassage
*/
public static void propagateCamelToCxf(HeaderFilterStrategy strategy,
Map<String, Object> headers, Message message) {
-
+
Map<String, List<String>> cxfHeaders =
CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
-
+
if (cxfHeaders == null) {
cxfHeaders = new HashMap<String, List<String>>();
message.put(Message.PROTOCOL_HEADERS, cxfHeaders);
}
-
+
for (Map.Entry<String, Object> entry : headers.entrySet()) {
- if (strategy != null &&
- !strategy.applyFilterToCamelHeaders(entry.getKey(),
entry.getValue())) {
-
+ if (strategy != null
+ && !strategy.applyFilterToCamelHeaders(entry.getKey(),
entry.getValue())) {
+
if
(CamelTransportConstants.CONTENT_TYPE.equals(entry.getKey())) {
message.put(Message.CONTENT_TYPE, entry.getValue());
} else {
@@ -71,30 +71,30 @@
}
}
}
-
+
}
public static void propagateCxfToCamel(HeaderFilterStrategy strategy,
Message message, Map<String, Object> headers) {
-
+
Map<String, List<String>> cxfHeaders =
CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
-
+
if (cxfHeaders != null) {
for (Map.Entry<String, List<String>> entry :
cxfHeaders.entrySet()) {
- if (strategy != null &&
- !strategy.applyFilterToExternalHeaders(entry.getKey(),
entry.getValue())) {
+ if (strategy != null
+ &&
!strategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) {
headers.put(entry.getKey(), entry.getValue().get(0));
}
}
}
-
+
String contentType = (String) message.get(Message.CONTENT_TYPE);
- if (contentType != null && strategy != null &&
- !strategy.applyFilterToExternalHeaders(Message.CONTENT_TYPE,
contentType)) {
+ if (contentType != null && strategy != null
+ &&
!strategy.applyFilterToExternalHeaders(Message.CONTENT_TYPE, contentType)) {
headers.put(CamelTransportConstants.CONTENT_TYPE, contentType);
}
-
+
}
}
Modified:
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
Thu Jul 31 19:26:05 2008
@@ -24,7 +24,7 @@
import org.apache.commons.logging.LogFactory;
public abstract class RemoteFileConsumer<T extends RemoteFileExchange> extends
ScheduledPollConsumer<T> {
- protected final transient Log LOG = LogFactory.getLog(getClass());
+ protected final transient Log log = LogFactory.getLog(getClass());
protected RemoteFileEndpoint<T> endpoint;
protected long lastPollTime;
Modified:
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
Thu Jul 31 19:26:05 2008
@@ -23,7 +23,7 @@
import org.apache.commons.logging.LogFactory;
public abstract class RemoteFileProducer<T extends RemoteFileExchange> extends
DefaultProducer<T> {
- protected final transient Log LOG = LogFactory.getLog(getClass());
+ protected final transient Log log = LogFactory.getLog(getClass());
protected RemoteFileEndpoint<T> endpoint;
protected RemoteFileProducer(RemoteFileEndpoint<T> endpoint) {
@@ -55,7 +55,7 @@
@Override
protected void doStart() throws Exception {
- LOG.info("Starting");
+ log.info("Starting");
// do not connect when componet starts, just wait until we process as
we will
// connect at that time if needed
super.doStart();
@@ -63,13 +63,13 @@
@Override
protected void doStop() throws Exception {
- LOG.info("Stopping");
+ log.info("Stopping");
// disconnect when stopping
try {
disconnect();
} catch (Exception e) {
// ignore just log a warning
- LOG.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ log.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
}
super.doStop();
Modified:
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerExcludeNameTest.java
Thu Jul 31 19:26:05 2008
@@ -1,11 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.camel.component.file.remote;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.file.FileComponent;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.FileComponent;
+import org.apache.camel.component.mock.MockEndpoint;
/**
- * Unit test that ftp consumer will exclude pre and postfixes
+ * Unit test that ftp consumer will exclude pre and postfixes
*/
public class FtpConsumerExcludeNameTest extends FtpServerTestSupport {
Modified:
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerSkipDotFilesTest.java
Thu Jul 31 19:26:05 2008
@@ -1,8 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.camel.component.file.remote;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.file.FileComponent;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.FileComponent;
+import org.apache.camel.component.mock.MockEndpoint;
/**
* Unit test that ftp consumer will skip any files starting with a dot
@@ -47,5 +63,5 @@
}
};
}
-
+
}
Modified:
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
(original)
+++
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
Thu Jul 31 19:26:05 2008
@@ -68,8 +68,8 @@
// Write out the headers...
for (String key : out.getHeaders().keySet()) {
String value = out.getHeader(key, String.class);
- if (headerFilterStrategy != null &&
- !headerFilterStrategy.applyFilterToCamelHeaders(key,
value)) {
+ if (headerFilterStrategy != null
+ &&
!headerFilterStrategy.applyFilterToCamelHeaders(key, value)) {
response.setHeader(key, value);
}
}
@@ -112,27 +112,27 @@
/*
* Exclude a set of headers from responses and new requests as all headers
* get propagated between exchanges by default
- *
+ *
* @deprecated please use [EMAIL PROTECTED] HeaderPropagationStrategy}
instead
- *
+ *
*/
@Deprecated
public boolean shouldHeaderBePropagated(String headerName, String
headerValue) {
if (headerValue == null) {
return false;
}
-
- return headerFilterStrategy != null &&
- !headerFilterStrategy.applyFilterToCamelHeaders(headerName,
headerValue);
-
+
+ return headerFilterStrategy != null
+ && !headerFilterStrategy.applyFilterToCamelHeaders(headerName,
headerValue);
+
}
/*
* override the set of headers to ignore for responses and new requests
* @param headersToIgnore should be a set of lower-case strings
- *
+ *
* @deprecated please use [EMAIL PROTECTED] HeaderPropagationStrategy}
instead
- *
+ *
*/
@Deprecated
public void setIgnoredHeaders(Set<String> headersToIgnore) {
@@ -153,11 +153,11 @@
} else {
return null;
}
-
+
}
public boolean isUseReaderForPayload() {
-
+
return useReaderForPayload;
}
Modified:
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
Thu Jul 31 19:26:05 2008
@@ -60,7 +60,7 @@
private JmsEndpoint endpoint;
private XmlConverter xmlConverter = new XmlConverter();
private HeaderFilterStrategy headerFilterStrategy;
-
+
public JmsBinding() {
headerFilterStrategy = new JmsHeaderFilterStrategy();
}
@@ -134,7 +134,7 @@
String name = names.nextElement().toString();
try {
Object value = jmsMessage.getObjectProperty(name);
- if (headerFilterStrategy != null
+ if (headerFilterStrategy != null
&&
headerFilterStrategy.applyFilterToExternalHeaders(name, value)) {
continue;
}
@@ -148,7 +148,7 @@
}
}
}
-
+
return map;
}
@@ -380,7 +380,7 @@
} else {
// Shouldn't get here unless a strategy that isn't an extension of
// DefaultHeaderPropagationStrategy has been injected.
- }
+ }
}
/**
@@ -390,11 +390,11 @@
*/
protected boolean shouldOutputHeader(org.apache.camel.Message
camelMessage, String headerName,
Object headerValue) {
-
- return headerFilterStrategy == null ||
- !headerFilterStrategy.applyFilterToCamelHeaders(headerName,
headerValue);
+
+ return headerFilterStrategy == null
+ || !headerFilterStrategy.applyFilterToCamelHeaders(headerName,
headerValue);
}
-
+
/**
* Encoder to encode JMS header keys that is that can be sent over the JMS
transport.
* <p/>
Modified:
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
Thu Jul 31 19:26:05 2008
@@ -26,7 +26,7 @@
public class JmsHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
public JmsHeaderFilterStrategy() {
- initialize();
+ initialize();
}
protected void initialize() {
@@ -41,10 +41,10 @@
getOutFilter().add("JMSXRecvTimestamp");
getOutFilter().add("JMSXState");
}
-
+
@Override
protected boolean extendedFilter(Direction direction, String key, Object
value) {
- return Direction.OUT == direction &&
-
!ObjectHelper.isJavaIdentifier(JmsBinding.encodeToSafeJmsHeaderName(key));
- }
+ return Direction.OUT == direction
+ &&
!ObjectHelper.isJavaIdentifier(JmsBinding.encodeToSafeJmsHeaderName(key));
+ }
}
Modified:
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java?rev=681589&r1=681588&r2=681589&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java
(original)
+++
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringTest.java
Thu Jul 31 19:26:05 2008
@@ -16,8 +16,6 @@
*/
package org.apache.camel.component.jms;
-import static
org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
-
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -37,25 +35,27 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultHeaderFilterStrategy;
+import static
org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
+
/**
*
* @version $Revision$
*/
public class JmsHeaderFilteringTest extends ContextTestSupport {
-
+
private static final String IN_FILTER_PATTERN =
"(org_apache_camel)[_|a-z|A-Z|0-9]*(test)[_|a-z|A-Z|0-9]*";
-
- private static final String componentName = "jms";
- private static final String testQueueEndpointA = componentName +
":queue:test.a";
- private static final String testQueueEndpointB = componentName +
":queue:test.b";
- private static final String assertionReceiver = "mock:errors";
+
+ private final String componentName = "jms";
+ private final String testQueueEndpointA = componentName + ":queue:test.a";
+ private final String testQueueEndpointB = componentName + ":queue:test.b";
+ private final String assertionReceiver = "mock:errors";
private CountDownLatch latch = new CountDownLatch(2);
public void testHeaderFilters() throws Exception {
MockEndpoint errors = this.resolveMandatoryEndpoint(assertionReceiver,
MockEndpoint.class);
errors.expectedMessageCount(0);
-
- Exchange exchange = template.send(testQueueEndpointA,
ExchangePattern.InOnly, new Processor() {
+
+ Exchange exchange = template.send(testQueueEndpointA,
ExchangePattern.InOnly, new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("org.apache.camel.jms", 10000);
exchange.getIn().setHeader("org.apache.camel.test.jms", 20000);
@@ -64,28 +64,28 @@
}
});
-
+
latch.await(2, TimeUnit.SECONDS);
errors.assertIsSatisfied();
}
@Override
- protected CamelContext createCamelContext() throws Exception {
+ protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
camelContext.addComponent(componentName,
jmsComponentClientAcknowledge(connectionFactory));
-
+
// add "testheader" to in filter set
((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
.getHeaderFilterStrategy()).getInFilter().add("testheader");
// add "anotherheader" to out filter set
((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
.getHeaderFilterStrategy()).getOutFilter().add("anotherheader");
- // add a regular expression pattern filter
+ // add a regular expression pattern filter
// notice that dots are encoded to underscores in jms headers
((DefaultHeaderFilterStrategy)camelContext.getComponent(componentName)
.getHeaderFilterStrategy()).setInFilterPattern(IN_FILTER_PATTERN);
-
+
return camelContext;
}
@@ -101,48 +101,48 @@
}
};
}
-
+
class OutHeaderChecker implements Processor {
public void process(Exchange exchange) throws Exception {
JmsMessage message = (JmsMessage) exchange.getIn();
-
+
// testheader not filtered out until it is copied back to camel
assertEquals(1020,
message.getJmsMessage().getObjectProperty("testheader"));
-
+
// anotherheader has been filtered out
assertNull(message.getJmsMessage().getObjectProperty("anotherheader"));
-
+
// notice dots are replaced by underscores when it is copied to
jms message properties
assertEquals(10000,
message.getJmsMessage().getObjectProperty("org_apache_camel_jms"));
// like testheader, org.apache.camel.test.jms will be filtered
"in" filter
assertEquals(20000,
message.getJmsMessage().getObjectProperty("org_apache_camel_test_jms"));
-
+
latch.countDown();
}
-
+
}
-
+
class InHeaderChecker implements Processor {
public void process(Exchange exchange) throws Exception {
-
+
// filtered out by "in" filter
assertNull(exchange.getIn().getHeader("testheader"));
-
+
// it has been filtered out by "out" filter
assertNull(exchange.getIn().getHeader("anotherheader"));
-
+
// it should not been filtered out
assertEquals(10000,
exchange.getIn().getHeader("org.apache.camel.jms"));
-
+
// filtered out by "in" filter
assertNull(exchange.getIn().getHeader("org.apache.camel.test.jms"));
-
+
latch.countDown();
}
-
+
}
}