You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/03/24 16:08:42 UTC
svn commit: r640438 [2/8] - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/builder/
camel-core/src/main/java/org/apache/camel/builder/xml/
camel-core/src/main/java/org/apache/camel/compone...
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/DefaultAnnotationExpressionFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/DefaultAnnotationExpressionFactory.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/DefaultAnnotationExpressionFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/DefaultAnnotationExpressionFactory.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,15 +16,15 @@
*/
package org.apache.camel.component.bean;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Expression;
import org.apache.camel.language.LanguageAnnotation;
import org.apache.camel.spi.Language;
import org.apache.camel.util.ObjectHelper;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
/**
* @version $Revision$
*/
@@ -52,8 +51,7 @@
throw new IllegalArgumentException("Cannot determine the expression from the annotation: " + annotation);
}
return value.toString();
- }
- catch (NoSuchMethodException e) {
+ } catch (NoSuchMethodException e) {
throw new IllegalArgumentException("Cannot determine the expression of the annotation: " + annotation + " as it does not have an value() method");
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodBean.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodBean.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodBean.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -22,7 +21,7 @@
/**
* Represents a {@link Serializable} version of a {@link Method}
- *
+ *
* @version $Revision$
*/
public class MethodBean implements Serializable {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java Mon Mar 24 08:08:24 2008
@@ -24,8 +24,8 @@
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
-import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.ObjectHelper;
/**
* @version $Revision$
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java Mon Mar 24 08:08:24 2008
@@ -23,20 +23,20 @@
/**
* A helper class for creating proxies which delegate to Camel
- *
+ *
* @version $Revision$
*/
-public class ProxyHelper {
+public final class ProxyHelper {
/**
* Utility classes should not have a public constructor.
*/
- private ProxyHelper() {
+ private ProxyHelper() {
}
/**
* Creates a Proxy which sends PojoExchange to the endpoint.
- *
+ *
* @throws Exception
*/
public static Object createProxy(final Endpoint endpoint, ClassLoader cl, Class interfaces[])
@@ -47,7 +47,7 @@
/**
* Creates a Proxy which sends PojoExchange to the endpoint.
- *
+ *
* @throws Exception
*/
public static Object createProxy(Endpoint endpoint, Class interfaces[]) throws Exception {
@@ -59,7 +59,7 @@
/**
* Creates a Proxy which sends PojoExchange to the endpoint.
- *
+ *
* @throws Exception
*/
@SuppressWarnings("unchecked")
@@ -70,7 +70,7 @@
/**
* Creates a Proxy which sends PojoExchange to the endpoint.
- *
+ *
* @throws Exception
*/
@SuppressWarnings("unchecked")
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/RegistryBean.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/XPathAnnotationExpressionFactory.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,14 +16,14 @@
*/
package org.apache.camel.component.bean;
+import java.lang.annotation.Annotation;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Expression;
import org.apache.camel.builder.xml.XPathBuilder;
import org.apache.camel.language.LanguageAnnotation;
import org.apache.camel.language.NamespacePrefix;
import org.apache.camel.language.XPath;
-
-import java.lang.annotation.Annotation;
/**
* @version $Revision$
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSet.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSet.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSet.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSet.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetComponent.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -18,7 +17,6 @@
package org.apache.camel.component.dataset;
import org.apache.camel.Exchange;
-import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.impl.DefaultConsumer;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetEndpoint.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,20 +16,17 @@
*/
package org.apache.camel.component.dataset;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.Component;
-import org.apache.camel.Exchange;
-import org.apache.camel.InvalidPayloadException;
-import org.apache.camel.NoSuchHeaderException;
-import org.apache.camel.Service;
import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.PollingConsumer;
+import org.apache.camel.Exchange;
import org.apache.camel.Message;
-import org.apache.camel.impl.EventDrivenPollingConsumer;
+import org.apache.camel.PollingConsumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Service;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.EventDrivenPollingConsumer;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
@@ -47,17 +43,17 @@
private long consumeDelay = -1;
private long startTime;
+ public DataSetEndpoint(String endpointUri, Component component, DataSet dataSet) {
+ super(endpointUri, component);
+ this.dataSet = dataSet;
+ }
+
public static void assertEquals(String description, Object expected, Object actual, Exchange exchange) {
if (!ObjectHelper.equal(expected, actual)) {
throw new AssertionError(description + " does not match. Expected: " + expected + " but was: " + actual + " on " + exchange);
}
}
- public DataSetEndpoint(String endpointUri, Component component, DataSet dataSet) {
- super(endpointUri, component);
- this.dataSet = dataSet;
- }
-
@Override
public PollingConsumer<Exchange> createPollingConsumer() throws Exception {
return new EventDrivenPollingConsumer<Exchange>(this);
@@ -75,7 +71,7 @@
}
@Override
- public int getReceivedCounter() {
+ public int getReceivedCounter() {
return receivedCounter.get();
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetSupport.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetSupport.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/SimpleDataSet.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/SimpleDataSet.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/SimpleDataSet.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/SimpleDataSet.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java Mon Mar 24 08:08:24 2008
@@ -16,11 +16,11 @@
*/
package org.apache.camel.component.direct;
+import java.util.Map;
+
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultComponent;
-
-import java.util.Map;
/**
* Represents the component that manages {@link DirectEndpoint}. It holds the
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java Mon Mar 24 08:08:24 2008
@@ -31,14 +31,14 @@
/**
* Represents a direct endpoint that synchronously invokes the consumers of the
* endpoint when a producer sends a message to it.
- *
+ *
* @version $Revision$
*/
public class DirectEndpoint<E extends Exchange> extends DefaultEndpoint<E> {
private static final Log LOG = LogFactory.getLog(DirectEndpoint.class);
-
- private final CopyOnWriteArrayList<DefaultConsumer<E>> consumers = new CopyOnWriteArrayList<DefaultConsumer<E>>();
boolean allowMultipleConsumers = true;
+ private final CopyOnWriteArrayList<DefaultConsumer<E>> consumers = new CopyOnWriteArrayList<DefaultConsumer<E>>();
+
public DirectEndpoint(String uri, DirectComponent<E> component) {
super(uri, component);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectProducer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -41,8 +40,7 @@
public void process(Exchange exchange) throws Exception {
if (endpoint.getConsumers().isEmpty()) {
LOG.warn("No getConsumers() available on " + this + " for " + exchange);
- }
- else {
+ } else {
for (DefaultConsumer<E> consumer : endpoint.getConsumers()) {
consumer.getProcessor().process(exchange);
}
@@ -53,20 +51,17 @@
int size = endpoint.getConsumers().size();
if (size == 0) {
LOG.warn("No getConsumers() available on " + this + " for " + exchange);
- }
- else {
+ } else {
if (size > 1) {
// Too hard to do multiple async.. do it sync
try {
for (DefaultConsumer<E> consumer : endpoint.getConsumers()) {
consumer.getProcessor().process(exchange);
}
- }
- catch (Throwable error) {
+ } catch (Throwable error) {
exchange.setException(error);
}
- }
- else {
+ } else {
for (DefaultConsumer<E> consumer : endpoint.getConsumers()) {
AsyncProcessor processor = AsyncProcessorTypeConverter.convert(consumer.getProcessor());
return processor.process(exchange, callback);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileComponent.java Mon Mar 24 08:08:24 2008
@@ -16,17 +16,17 @@
*/
package org.apache.camel.component.file;
+import java.io.File;
+import java.util.Map;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
-import java.io.File;
-import java.util.Map;
-
/**
* The <a href="http://activemq.apache.org/camel/file.html">File Component</a>
* for working with file systems
- *
+ *
* @version $Revision$
*/
public class FileComponent extends DefaultComponent<FileExchange> {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java Mon Mar 24 08:08:24 2008
@@ -16,30 +16,30 @@
*/
package org.apache.camel.component.file;
+import java.io.File;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.camel.AsyncCallback;
-import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.impl.ScheduledPollConsumer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.io.File;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
/**
* @version $Revision$
*/
public class FileConsumer extends ScheduledPollConsumer<FileExchange> {
private static final transient Log LOG = LogFactory.getLog(FileConsumer.class);
+ ConcurrentHashMap<File, File> filesBeingProcessed = new ConcurrentHashMap<File, File>();
+ boolean generateEmptyExchangeWhenIdle;
private final FileEndpoint endpoint;
private boolean recursive = true;
private String regexPattern = "";
private long lastPollTime;
- boolean generateEmptyExchangeWhenIdle;
- private int unchangedDelay = 0;
- private boolean unchangedSize = false;
+
+ private int unchangedDelay;
+ private boolean unchangedSize;
+ private ConcurrentHashMap<File, Long> fileSizes = new ConcurrentHashMap<File, Long>();
public FileConsumer(final FileEndpoint endpoint, Processor processor) {
super(endpoint, processor);
@@ -48,7 +48,7 @@
protected synchronized void poll() throws Exception {
int rc = pollFileOrDirectory(endpoint.getFile(), isRecursive());
- if( rc == 0 && generateEmptyExchangeWhenIdle ) {
+ if (rc == 0 && generateEmptyExchangeWhenIdle) {
final FileExchange exchange = endpoint.createExchange((File)null);
getAsyncProcessor().process(exchange, new AsyncCallback() {
public void done(boolean sync) {
@@ -59,7 +59,6 @@
}
/**
- *
* @param fileOrDirectory
* @param processDir
* @return the number of files processed or being processed async.
@@ -67,8 +66,7 @@
protected int pollFileOrDirectory(File fileOrDirectory, boolean processDir) {
if (!fileOrDirectory.isDirectory()) {
return pollFile(fileOrDirectory); // process the file
- }
- else if (processDir) {
+ } else if (processDir) {
int rc = 0;
if (isValidFile(fileOrDirectory)) {
LOG.debug("Polling directory " + fileOrDirectory);
@@ -77,35 +75,33 @@
rc += pollFileOrDirectory(files[i], isRecursive()); // self-recursion
}
}
- return rc;
- }
- else {
+ return rc;
+ } else {
LOG.debug("Skipping directory " + fileOrDirectory);
return 0;
}
}
-
- ConcurrentHashMap<File, File> filesBeingProcessed = new ConcurrentHashMap<File, File>();
/**
* @param file
* @return the number of files processed or being processed async.
*/
protected int pollFile(final File file) {
-
if (!file.exists()) {
return 0;
}
- if( !isValidFile(file) ) {
+ if (!isValidFile(file)) {
return 0;
}
- // we only care about file modified times if we are not deleting/moving files
+ // we only care about file modified times if we are not deleting/moving
+ // files
if (endpoint.isNoop()) {
long fileModified = file.lastModified();
if (fileModified <= lastPollTime) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Ignoring file: " + file + " as modified time: " + fileModified + " less than last poll time: " + lastPollTime);
+ LOG.debug("Ignoring file: " + file + " as modified time: " + fileModified
+ + " less than last poll time: " + lastPollTime);
}
return 0;
}
@@ -125,7 +121,7 @@
LOG.debug("About to process file: " + file + " using exchange: " + exchange);
}
if (processStrategy.begin(endpoint, exchange, file)) {
-
+
// Use the async processor interface so that processing of
// the
// exchange can happen asynchronously
@@ -143,15 +139,13 @@
filesBeingProcessed.remove(file);
}
});
-
- }
- else {
+
+ } else {
if (LOG.isDebugEnabled()) {
LOG.debug(endpoint + " cannot process file: " + file);
}
}
- }
- catch (Throwable e) {
+ } catch (Throwable e) {
handleException(e);
}
return 1;
@@ -160,7 +154,7 @@
protected boolean isValidFile(File file) {
boolean result = false;
if (file != null && file.exists()) {
- // TODO: maybe use a configurable strategy instead of the
+ // TODO: maybe use a configurable strategy instead of the
// hardcoded one based on last file change
if (isMatched(file) && isUnchanged(file)) {
result = true;
@@ -169,13 +163,12 @@
return result;
}
- private ConcurrentHashMap<File, Long> fileSizes = new ConcurrentHashMap<File, Long>();
-
+
protected boolean isUnchanged(File file) {
if (file == null) {
// Sanity check
return false;
- } else if (file.isDirectory()) {
+ } else if (file.isDirectory()) {
// Allow recursive polling to descend into this directory
return true;
} else {
@@ -183,25 +176,25 @@
long modifiedDuration = 0;
if (getUnchangedDelay() > 0) {
modifiedDuration = System.currentTimeMillis() - file.lastModified();
- lastModifiedCheck = (modifiedDuration >= getUnchangedDelay());
+ lastModifiedCheck = modifiedDuration >= getUnchangedDelay();
}
-
+
boolean sizeCheck = true;
long sizeDifference = 0;
if (isUnchangedSize()) {
- long prevFileSize = (fileSizes.get(file)==null) ? 0 : fileSizes.get(file).longValue();
+ long prevFileSize = (fileSizes.get(file) == null) ? 0 : fileSizes.get(file).longValue();
sizeDifference = file.length() - prevFileSize;
- sizeCheck = (0 == sizeDifference);
+ sizeCheck = 0 == sizeDifference;
}
-
+
boolean answer = lastModifiedCheck && sizeCheck;
-
+
if (LOG.isDebugEnabled()) {
- LOG.debug("file:" + file + " isUnchanged:" + answer + " " +
- "sizeCheck:" + sizeCheck + "(" + sizeDifference + ") " +
- "lastModifiedCheck:" + lastModifiedCheck + "(" +modifiedDuration + ")");
+ LOG.debug("file:" + file + " isUnchanged:" + answer + " " + "sizeCheck:" + sizeCheck + "("
+ + sizeDifference + ") " + "lastModifiedCheck:" + lastModifiedCheck + "("
+ + modifiedDuration + ")");
}
-
+
if (isUnchangedSize()) {
if (answer) {
fileSizes.remove(file);
@@ -209,7 +202,7 @@
fileSizes.put(file, file.length());
}
}
-
+
return answer;
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java Mon Mar 24 08:08:24 2008
@@ -34,7 +34,7 @@
/**
* A <a href="http://activemq.apache.org/camel/file.html">File Endpoint</a> for
* working with file systems
- *
+ *
* @version $Revision$
*/
public class FileEndpoint extends ScheduledPollEndpoint<FileExchange> {
@@ -49,7 +49,7 @@
private String moveNamePrefix;
private String moveNamePostfix;
private String[] excludedNamePrefixes = {"."};
- private String[] excludedNamePostfixes = { FileProcessStrategySupport.DEFAULT_LOCK_FILE_POSTFIX };
+ private String[] excludedNamePostfixes = {FileProcessStrategySupport.DEFAULT_LOCK_FILE_POSTFIX};
private int bufferSize = 128 * 1024;
private boolean ignoreFileNameHeader;
@@ -150,7 +150,7 @@
/**
* Sets the strategy to be used when the file has been processed such as
* deleting or renaming it etc.
- *
+ *
* @param fileProcessStrategy the new stategy to use
*/
public void setFileStrategy(FileProcessStrategy fileProcessStrategy) {
@@ -180,7 +180,7 @@
/**
* Sets the name postfix appended to moved files. For example to rename all
* the files from * to *.done set this value to ".done"
- *
+ *
* @param moveNamePostfix
* @see DefaultFileRenamer#setNamePostfix(String)
*/
@@ -196,7 +196,7 @@
* Sets the name prefix appended to moved files. For example to move
* processed files into a hidden directory called ".camel" set this value to
* ".camel/"
- *
+ *
* @see DefaultFileRenamer#setNamePrefix(String)
*/
public void setMoveNamePrefix(String moveNamePrefix) {
@@ -234,7 +234,7 @@
/**
* If set to true then the default {@link FileProcessStrategy} will be to use the
* {@link NoOpFileProcessStrategy} to not move or copy processed files
- *
+ *
* @param noop
*/
public void setNoop(boolean noop) {
@@ -283,6 +283,6 @@
* A strategy method to lazily create the file strategy
*/
protected FileProcessStrategy createFileStrategy() {
- return FileProcessStrategyFactory.createFileProcessStrategy(isNoop(), isDelete(), isLock(), moveNamePrefix, moveNamePostfix);
+ return FileProcessStrategyFactory.createFileProcessStrategy(isNoop(), isDelete(), isLock(), moveNamePrefix, moveNamePostfix);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileExchange.java Mon Mar 24 08:08:24 2008
@@ -16,12 +16,12 @@
*/
package org.apache.camel.component.file;
+import java.io.File;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.impl.DefaultExchange;
-
-import java.io.File;
/**
* A {@link Exchange} for File
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileMessage.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileMessage.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileMessage.java Mon Mar 24 08:08:24 2008
@@ -16,14 +16,14 @@
*/
package org.apache.camel.component.file;
+import java.io.File;
+
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultMessage;
-import java.io.File;
-
/**
* A {@link Exchange} for File
- *
+ *
* @version $Revision$
*/
public class FileMessage extends DefaultMessage {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileProducer.java Mon Mar 24 08:08:24 2008
@@ -16,14 +16,6 @@
*/
package org.apache.camel.component.file;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.ExchangeHelper;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -32,6 +24,14 @@
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* A {@link Producer} implementation for File
*
@@ -79,8 +79,7 @@
if (getEndpoint().isAppend()) {
fc = new RandomAccessFile(file, "rw").getChannel();
fc.position(fc.size());
- }
- else {
+ } else {
fc = new FileOutputStream(file).getChannel();
}
int size = getEndpoint().getBufferSize();
@@ -90,32 +89,27 @@
int count = in.read(buffer);
if (count <= 0) {
break;
- }
- else if (count < size) {
+ } else if (count < size) {
byteBuffer = ByteBuffer.wrap(buffer, 0, count);
fc.write(byteBuffer);
break;
- }
- else {
+ } else {
fc.write(byteBuffer);
byteBuffer.clear();
}
}
- }
- finally {
+ } finally {
if (in != null) {
try {
in.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
LOG.warn("Failed to close input: " + e, e);
}
}
if (fc != null) {
try {
fc.close();
- }
- catch (IOException e) {
+ } catch (IOException e) {
LOG.warn("Failed to close output: " + e, e);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/DefaultFileRenamer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/DefaultFileRenamer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/DefaultFileRenamer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/DefaultFileRenamer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -23,9 +22,9 @@
* @version $Revision$
*/
public class DefaultFileRenamer implements FileRenamer {
-
- private static final boolean ON_WINDOWS = System.getProperty("os.name").startsWith("Windows");
-
+
+ private static final boolean ON_WINDOWS = System.getProperty("os.name").startsWith("Windows");
+
private String namePrefix;
private String namePostfix;
@@ -40,10 +39,10 @@
public File renameFile(File file) {
File parent = file.getParentFile();
String name = renameFileName(file);
-
- if( ON_WINDOWS && ( name.indexOf(":")>=0 || name.startsWith("//") )) {
+
+ if (ON_WINDOWS && (name.indexOf(":") >= 0 || name.startsWith("//"))) {
return new File(name);
- }
+ }
return new File(parent, name);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java Mon Mar 24 08:08:24 2008
@@ -18,8 +18,11 @@
import org.apache.camel.component.file.FileProcessStrategy;
-public class FileProcessStrategyFactory {
- /**
+public final class FileProcessStrategyFactory {
+ private FileProcessStrategyFactory() {
+ // Utility class
+ }
+ /**
* A strategy method to lazily create the file strategy
*/
public static FileProcessStrategy createFileProcessStrategy(boolean isNoop, boolean isDelete, boolean isLock, String moveNamePrefix, String moveNamePostfix) {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileRenamer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileRenamer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileRenamer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileRenamer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java Mon Mar 24 08:08:24 2008
@@ -16,17 +16,18 @@
*/
package org.apache.camel.component.jmx;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
-import javax.management.MBeanServer;
-import java.util.Map;
-
/**
* The <a href="http://activemq.apache.org/camel/jmx.html">JMX Component</a>
* for monitoring jmx attributes
- *
+ *
* @version $Revision$
*/
public class JMXComponent extends DefaultComponent<JMXExchange> {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java Mon Mar 24 08:08:24 2008
@@ -20,17 +20,18 @@
import javax.management.Notification;
import javax.management.ObjectName;
import javax.management.monitor.CounterMonitor;
+
import org.apache.camel.Consumer;
+import org.apache.camel.ExchangePattern;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
-import org.apache.camel.ExchangePattern;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Creates a CounterMonitor for jmx attributes
- *
+ *
* @version $Revision$
*/
public class JMXEndpoint extends DefaultEndpoint<JMXExchange> {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java Mon Mar 24 08:08:24 2008
@@ -16,23 +16,23 @@
*/
package org.apache.camel.component.jmx;
+import javax.management.Notification;
+
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.impl.DefaultExchange;
-import javax.management.Notification;
-
/**
* A {@link Exchange} for a jmx notification
- *
+ *
* @version $Revision$
*/
public class JMXExchange extends DefaultExchange {
/**
* Constructor
- *
+ *
* @param camelContext
* @param pattern
*/
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListComponent.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -19,8 +18,8 @@
import java.util.Map;
-import org.apache.camel.impl.DefaultComponent;
import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
/**
* @version $Revision$
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/list/ListEndpoint.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -17,24 +16,22 @@
*/
package org.apache.camel.component.list;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.concurrent.CopyOnWriteArrayList;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.camel.Exchange;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
import org.apache.camel.Consumer;
+import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Component;
-import org.apache.camel.spi.BrowsableEndpoint;
-import org.apache.camel.processor.loadbalancer.LoadBalancerConsumer;
-import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
-import org.apache.camel.component.seda.CollectionProducer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.processor.loadbalancer.LoadBalancerConsumer;
+import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
+import org.apache.camel.spi.BrowsableEndpoint;
/**
* An endpoint which maintains a {@link List} of {@link Exchange} instances
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/AssertionClause.java Mon Mar 24 08:08:24 2008
@@ -16,21 +16,21 @@
*/
package org.apache.camel.component.mock;
+
import java.util.ArrayList;
import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Predicate;
-import static org.apache.camel.builder.ExpressionBuilder.bodyExpression;
-import static org.apache.camel.builder.ExpressionBuilder.headerExpression;
-import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.builder.ValueBuilder;
+import static org.apache.camel.builder.ExpressionBuilder.bodyExpression;
+import static org.apache.camel.builder.ExpressionBuilder.headerExpression;
/**
* A builder of assertions on message exchanges
- *
+ *
* @version $Revision$
*/
public abstract class AssertionClause implements Runnable {
@@ -115,7 +115,7 @@
predicates.add(predicate);
}
-
+
public class PredicateValueBuilder extends ValueBuilder<Exchange> {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java Mon Mar 24 08:08:24 2008
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.mock;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -24,8 +26,6 @@
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import java.beans.PropertyChangeSupport;
-import java.beans.PropertyChangeListener;
import org.apache.camel.CamelContext;
import org.apache.camel.Component;
@@ -36,9 +36,9 @@
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
-import org.apache.camel.spi.BrowsableEndpoint;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.spi.BrowsableEndpoint;
import org.apache.camel.util.ExpressionComparator;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
@@ -47,7 +47,7 @@
/**
* A Mock endpoint which provides a literate, fluent API for testing routes
* using a <a href="http://jmock.org/">JMock style</a> API.
- *
+ *
* @version $Revision$
*/
public class MockEndpoint extends DefaultEndpoint<Exchange> implements BrowsableEndpoint<Exchange> {
@@ -166,16 +166,16 @@
/**
* Set the processor that will be invoked when the some message
* is received.
- *
+ *
* This processor could be overwritten by
* {@link #whenExchangeReceived(int, Processor)} method.
- *
+ *
* @param processor
*/
public void whenAnyExchangeReceived(Processor processor) {
this.defaultProcessor = processor;
- }
-
+ }
+
/**
* Validates that all the available expectations on this endpoint are
* satisfied; or throw an exception
@@ -187,7 +187,7 @@
/**
* Validates that all the available expectations on this endpoint are
* satisfied; or throw an exception
- *
+ *
* @param timeoutForEmptyEndpoints the timeout in milliseconds that we
* should wait for the test to be true
*/
@@ -242,7 +242,7 @@
/**
* Specifies the expected number of message exchanges that should be
* received by this endpoint
- *
+ *
* @param expectedCount the number of message exchanges that should be
* expected by this endpoint
*/
@@ -258,7 +258,7 @@
/**
* Specifies the minimum number of expected message exchanges that should be
* received by this endpoint
- *
+ *
* @param expectedCount the number of message exchanges that should be
* expected by this endpoint
*/
@@ -310,7 +310,7 @@
/**
* Adds an expectation that messages received should have ascending values
* of the given expression such as a user generated counter value
- *
+ *
* @param expression
*/
public void expectsAscending(final Expression<Exchange> expression) {
@@ -324,7 +324,7 @@
/**
* Adds an expectation that messages received should have descending values
* of the given expression such as a user generated counter value
- *
+ *
* @param expression
*/
public void expectsDescending(final Expression<Exchange> expression) {
@@ -338,7 +338,7 @@
/**
* Adds an expectation that no duplicate messages should be received using
* the expression to determine the message ID
- *
+ *
* @param expression the expression used to create a unique message ID for
* message comparison (which could just be the message
* payload if the payload can be tested for uniqueness using
@@ -416,7 +416,7 @@
/**
* Adds an assertion to the given message index
- *
+ *
* @param messageIndex the number of the message
* @return the assertion clause
*/
@@ -432,7 +432,7 @@
/**
* Adds an assertion to all the received messages
- *
+ *
* @return the assertion clause
*/
public AssertionClause allMessages() {
@@ -483,7 +483,7 @@
/**
* Allows a sleep to be specified to wait to check that this endpoint really
* is empty when {@link #expectedMessageCount(int)} is called with zero
- *
+ *
* @param sleepForEmptyTest the milliseconds to sleep for to determine that
* this endpoint really is empty
*/
@@ -555,8 +555,8 @@
receivedExchanges.add(exchange);
- Processor processor = processors.get(getReceivedCounter()) != null ?
- processors.get(getReceivedCounter()) : defaultProcessor;
+ Processor processor = processors.get(getReceivedCounter()) != null
+ ? processors.get(getReceivedCounter()) : defaultProcessor;
if (processor != null) {
processor.process(exchange);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/ref/RefComponent.java Mon Mar 24 08:08:24 2008
@@ -16,11 +16,11 @@
*/
package org.apache.camel.component.ref;
-import org.apache.camel.Exchange;
+import java.util.Map;
+
import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultComponent;
-
-import java.util.Map;
/**
*
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/CollectionProducer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/ListPollingConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/ListPollingConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/ListPollingConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/ListPollingConsumer.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -41,8 +40,7 @@
public Exchange receiveNoWait() {
if (exchanges.isEmpty()) {
return null;
- }
- else {
+ } else {
return exchanges.remove(0);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/QueueComponent.java Mon Mar 24 08:08:24 2008
@@ -16,11 +16,10 @@
*/
package org.apache.camel.component.seda;
-import org.apache.camel.Exchange;
+import java.util.concurrent.BlockingQueue;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import java.util.concurrent.BlockingQueue;
/**
* An implementation of the <a href="http://activemq.apache.org/camel/queue.html">Queue components</a>
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java Mon Mar 24 08:08:24 2008
@@ -65,8 +65,7 @@
public void done(boolean sync) {
}
});
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.error("Seda queue caught: " + e, e);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerComponent.java Mon Mar 24 08:08:24 2008
@@ -16,15 +16,15 @@
*/
package org.apache.camel.component.timer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultComponent;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultComponent;
+
/**
* Represents the component that manages {@link TimerEndpoint}. It holds the
* list of {@link TimerConsumer} objects that are started.
@@ -36,8 +36,8 @@
public Timer getTimer(TimerEndpoint endpoint) {
String key = endpoint.getTimerName();
- if (! endpoint.isDaemon()) {
- key = "nonDaemon:" + key;
+ if (!endpoint.isDaemon()) {
+ key = "nonDaemon:" + key;
}
Timer answer = timers.get(key);
@@ -47,7 +47,7 @@
}
return answer;
}
-
+
@Override
protected Endpoint<Exchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
TimerEndpoint answer = new TimerEndpoint(uri, this, remaining);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java Mon Mar 24 08:08:24 2008
@@ -16,21 +16,15 @@
*/
package org.apache.camel.component.timer;
+import java.util.Timer;
+import java.util.TimerTask;
+
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.component.bean.BeanExchange;
-import org.apache.camel.component.bean.BeanInvocation;
import org.apache.camel.impl.DefaultConsumer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Timer;
-import java.util.TimerTask;
-
/**
* @version $Revision$
*/
@@ -66,25 +60,20 @@
if (endpoint.isFixedRate()) {
if (endpoint.getTime() != null) {
timer.scheduleAtFixedRate(task, endpoint.getTime(), endpoint.getPeriod());
- }
- else {
+ } else {
timer.scheduleAtFixedRate(task, endpoint.getDelay(), endpoint.getPeriod());
}
- }
- else {
+ } else {
if (endpoint.getTime() != null) {
if (endpoint.getPeriod() >= 0) {
timer.schedule(task, endpoint.getTime(), endpoint.getPeriod());
- }
- else {
+ } else {
timer.schedule(task, endpoint.getTime());
}
- }
- else {
+ } else {
if (endpoint.getPeriod() >= 0) {
timer.schedule(task, endpoint.getDelay(), endpoint.getPeriod());
- }
- else {
+ } else {
timer.schedule(task, endpoint.getDelay());
}
}
@@ -98,8 +87,7 @@
exchange.setProperty("org.apache.camel.timer.period", endpoint.getPeriod());
try {
getProcessor().process(exchange);
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.error("Caught: " + e, e);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java Mon Mar 24 08:08:24 2008
@@ -16,18 +16,15 @@
*/
package org.apache.camel.component.timer;
+import java.util.Date;
+import java.util.Timer;
+
import org.apache.camel.Consumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.component.bean.BeanExchange;
import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
-
-import java.util.Date;
-import java.util.Timer;
/**
* Represents a timer endpoint that can generate periodic inbound PojoExchanges.
@@ -40,7 +37,7 @@
private final String timerName;
private Date time;
private long period = 1000;
- private long delay = 0;
+ private long delay;
private boolean fixedRate;
private boolean daemon = true;
private Timer timer;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java Mon Mar 24 08:08:24 2008
@@ -35,9 +35,9 @@
* @version $Revision$
*/
public class VmComponent extends SedaComponent {
-
- private static final AtomicInteger START_COUNTER = new AtomicInteger();
protected static Map<String, BlockingQueue> queues = new HashMap<String, BlockingQueue>();
+ private static final AtomicInteger START_COUNTER = new AtomicInteger();
+
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
@@ -61,7 +61,7 @@
super.doStart();
START_COUNTER.incrementAndGet();
}
-
+
@Override
protected void doStop() throws Exception {
super.doStop();
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java Mon Mar 24 08:08:24 2008
@@ -16,9 +16,18 @@
*/
package org.apache.camel.converter;
-import org.apache.camel.Converter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
-import java.util.*;
+import org.apache.camel.Converter;
/**
* Some core java.util Collection based
@@ -27,7 +36,7 @@
* @version $Revision$
*/
@Converter
-public class CollectionConverter {
+public final class CollectionConverter {
/**
* Utility classes should not have a public constructor.
*/
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/IOConverter.java Mon Mar 24 08:08:24 2008
@@ -16,12 +16,30 @@
*/
package org.apache.camel.converter;
-import org.apache.camel.Converter;
-import org.apache.camel.util.CollectionStringBuffer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
import java.net.URL;
import java.util.Properties;
@@ -33,6 +51,11 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.apache.camel.Converter;
+import org.apache.camel.util.CollectionStringBuffer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* Some core java.io based <a
* href="http://activemq.apache.org/camel/type-converter.html">Type Converters</a>
@@ -40,7 +63,7 @@
* @version $Revision$
*/
@Converter
-public class IOConverter {
+public final class IOConverter {
private static final transient Log LOG = LogFactory.getLog(IOConverter.class);
/**
@@ -170,7 +193,7 @@
public static String toString(Source source, Properties props) throws TransformerException, IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult sr = new StreamResult(bos);
- Transformer trans = TransformerFactory.newInstance().newTransformer();;
+ Transformer trans = TransformerFactory.newInstance().newTransformer();
if (props == null) {
props = new Properties();
props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
@@ -190,8 +213,7 @@
public static ObjectOutput toObjectOutput(OutputStream stream) throws IOException {
if (stream instanceof ObjectOutput) {
return (ObjectOutput) stream;
- }
- else {
+ } else {
return new ObjectOutputStream(stream);
}
}
@@ -200,8 +222,7 @@
public static ObjectInput toObjectInput(InputStream stream) throws IOException {
if (stream instanceof ObjectInput) {
return (ObjectInput) stream;
- }
- else {
+ } else {
return new ObjectInputStream(stream);
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java Mon Mar 24 08:08:24 2008
@@ -16,8 +16,6 @@
*/
package org.apache.camel.converter;
-import org.apache.camel.Converter;
-
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -25,19 +23,21 @@
import java.io.InputStream;
import java.nio.ByteBuffer;
+import org.apache.camel.Converter;
+
/**
- * Some core java.nio based
+ * Some core java.nio based
* <a href="http://activemq.apache.org/camel/type-converter.html">Type Converters</a>
*
* @version $Revision$
*/
@Converter
-public class NIOConverter {
+public final class NIOConverter {
/**
* Utility classes should not have a public constructor.
*/
- private NIOConverter() {
+ private NIOConverter() {
}
@Converter
@@ -54,13 +54,13 @@
public static ByteBuffer toByteBuffer(byte[] data) {
return ByteBuffer.wrap(data);
}
-
+
@Converter
public static ByteBuffer toByteBuffer(File file) throws IOException {
- byte[] buf = new byte[(int) file.length()];
- InputStream in = new BufferedInputStream(new FileInputStream(file));
- in.read(buf);
- return ByteBuffer.wrap(buf);
+ byte[] buf = new byte[(int)file.length()];
+ InputStream in = new BufferedInputStream(new FileInputStream(file));
+ in.read(buf);
+ return ByteBuffer.wrap(buf);
}
@Converter
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java Mon Mar 24 08:08:24 2008
@@ -16,31 +16,33 @@
*/
package org.apache.camel.converter;
-import org.apache.camel.Converter;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.camel.Converter;
+
+
/**
* Some core java.lang based <a
* href="http://activemq.apache.org/camel/type-converter.html">Type Converters</a>
- *
+ *
* @version $Revision$
*/
@Converter
-public class ObjectConverter {
-
+public final class ObjectConverter {
+
/**
* Utility classes should not have a public constructor.
*/
- private ObjectConverter() {
+ private ObjectConverter() {
}
-
+
public static boolean isCollection(Object value) {
// TODO we should handle primitive array types?
return value instanceof Collection || (value != null && value.getClass().isArray());
@@ -134,15 +136,12 @@
public static Byte toByte(Object value) {
if (value instanceof Byte) {
return (Byte) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.byteValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Byte.parseByte((String) value);
- }
- else {
+ } else {
return null;
}
}
@@ -169,15 +168,12 @@
public static Short toShort(Object value) {
if (value instanceof Short) {
return (Short) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.shortValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Short.parseShort((String) value);
- }
- else {
+ } else {
return null;
}
}
@@ -189,15 +185,12 @@
public static Integer toInteger(Object value) {
if (value instanceof Integer) {
return (Integer) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.intValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Integer.parseInt((String) value);
- }
- else {
+ } else {
return null;
}
}
@@ -209,15 +202,12 @@
public static Long toLong(Object value) {
if (value instanceof Long) {
return (Long) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.longValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Long.parseLong((String) value);
- }
- else {
+ } else {
return null;
}
}
@@ -229,15 +219,12 @@
public static Float toFloat(Object value) {
if (value instanceof Float) {
return (Float) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.floatValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Float.parseFloat((String) value);
- }
- else {
+ } else {
return null;
}
}
@@ -249,15 +236,12 @@
public static Double toDouble(Object value) {
if (value instanceof Double) {
return (Double) value;
- }
- else if (value instanceof Number) {
+ } else if (value instanceof Number) {
Number number = (Number) value;
return number.doubleValue();
- }
- else if (value instanceof String) {
+ } else if (value instanceof String) {
return Double.parseDouble((String) value);
- }
- else {
+ } else {
return null;
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,
@@ -16,13 +15,14 @@
* limitations under the License.
*/
package org.apache.camel.converter.jaxp;
-
-import org.apache.camel.Converter;
+import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.*;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
+import org.apache.camel.Converter;
+
/**
* Converts from some DOM types to Java types
@@ -30,7 +30,10 @@
* @version $Revision$
*/
@Converter
-public class DomConverter {
+public final class DomConverter {
+ private DomConverter() {
+ // Utility Class
+ }
@Converter
public static String toString(NodeList nodeList) {
StringBuffer buffer = new StringBuffer();
@@ -58,17 +61,14 @@
if (node instanceof Text) {
Text text = (Text) node;
buffer.append(text.getTextContent());
- }
- else if (node instanceof Attr) {
+ } else if (node instanceof Attr) {
Attr attribute = (Attr) node;
buffer.append(attribute.getTextContent());
- }
- else if (node instanceof Element) {
+ } else if (node instanceof Element) {
Element element = (Element) node;
append(buffer, element.getChildNodes());
- }
- else if (node instanceof Document) {
+ } else if (node instanceof Document) {
Document doc = (Document) node;
append(buffer, doc.getChildNodes());
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java Mon Mar 24 08:08:24 2008
@@ -1,5 +1,4 @@
/**
- *
* 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.
@@ -7,7 +6,7 @@
* (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
+ * 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,