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 [5/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/processor/ErrorHandlerSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.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.processor;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.ServiceSupport;
-import org.apache.camel.model.ExceptionType;
-
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.ServiceSupport;
+import org.apache.camel.model.ExceptionType;
/**
* @version $Revision$
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Interceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Interceptor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Interceptor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Interceptor.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,7 +18,6 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.processor.DelegateProcessor;
import org.apache.camel.util.ServiceHelper;
/**
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MarshalProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MarshalProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MarshalProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MarshalProcessor.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,
@@ -20,8 +19,8 @@
import java.io.ByteArrayOutputStream;
import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
import org.apache.camel.Message;
+import org.apache.camel.Processor;
import org.apache.camel.spi.DataFormat;
/**
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Mon Mar 24 08:08:24 2008
@@ -16,7 +16,7 @@
*/
package org.apache.camel.processor;
-import static org.apache.camel.util.ObjectHelper.notNull;
+
import java.util.ArrayList;
import java.util.Collection;
@@ -36,6 +36,7 @@
import org.apache.camel.processor.aggregate.AggregationStrategy;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ServiceHelper;
+import static org.apache.camel.util.ObjectHelper.notNull;
/**
* Implements the Multicast pattern to send a message exchange to a number of
@@ -67,7 +68,7 @@
if (isParallelProcessing) {
if (executor != null) {
this.executor = executor;
- } else {// setup default Executor
+ } else { // setup default Executor
this.executor = new ThreadPoolExecutor(1, processors.size(), 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(processors.size()));
}
@@ -104,7 +105,7 @@
}
public void run() {
- if( shutdown.get() ) {
+ if (shutdown.get()) {
exchange.setException(new RejectedExecutionException());
callback.done(false);
} else {
@@ -127,7 +128,7 @@
int i = 0;
for (Processor producer : processors) {
exchanges[i] = copyExchangeStrategy(producer, exchange);
- ProcessCall call = new ProcessCall(exchanges[i], producer, new AsyncCallback(){
+ ProcessCall call = new ProcessCall(exchanges[i], producer, new AsyncCallback() {
public void done(boolean doneSynchronously) {
completedExchanges.countDown();
}
@@ -138,7 +139,7 @@
}
completedExchanges.await();
if (aggregationStrategy != null) {
- for (Exchange resultExchange: exchanges) {
+ for (Exchange resultExchange : exchanges) {
if (result == null) {
result = resultExchange;
} else {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Mon Mar 24 08:08:24 2008
@@ -47,8 +47,7 @@
public static Processor newInstance(List<Processor> processors) {
if (processors.isEmpty()) {
return null;
- }
- else if (processors.size() == 1) {
+ } else if (processors.size() == 1) {
return processors.get(0);
}
return new Pipeline(processors);
@@ -65,7 +64,9 @@
while (true) {
if (nextExchange.isFailed()) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Mesage exchange has failed so breaking out of pipeline: " + nextExchange + " exception: " + nextExchange.getException() + " fault: " + nextExchange.getFault(false));
+ LOG.debug("Mesage exchange has failed so breaking out of pipeline: " + nextExchange
+ + " exception: " + nextExchange.getException() + " fault: "
+ + nextExchange.getFault(false));
}
break;
}
@@ -77,8 +78,7 @@
if (first) {
first = false;
- }
- else {
+ } else {
nextExchange = createNextExchange(processor, nextExchange);
}
@@ -151,8 +151,7 @@
Message in = answer.getIn();
if (previousOut != null) {
in.copyFrom(previousOut);
- }
- else {
+ } else {
in.copyFrom(previousExchange.getIn());
}
return answer;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ProceedProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ProceedProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ProceedProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ProceedProcessor.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,9 +16,8 @@
*/
package org.apache.camel.processor;
-import org.apache.camel.Processor;
import org.apache.camel.Exchange;
-import org.apache.camel.processor.Interceptor;
+import org.apache.camel.Processor;
/**
* A {@link Processor} which proceeds on an {@link Interceptor}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RecipientList.java Mon Mar 24 08:08:24 2008
@@ -16,29 +16,30 @@
*/
package org.apache.camel.processor;
+
+
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
-import org.apache.camel.AsyncCallback;
import org.apache.camel.converter.ObjectConverter;
import org.apache.camel.impl.ServiceSupport;
import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
import org.apache.camel.util.ExchangeHelper;
-import static org.apache.camel.util.ObjectHelper.notNull;
import org.apache.camel.util.ProducerCache;
+import static org.apache.camel.util.ObjectHelper.notNull;
/**
* Implements a dynamic <a
* href="http://activemq.apache.org/camel/recipient-list.html">Recipient List</a>
* pattern where the list of actual endpoints to send a message exchange to are
* dependent on some dynamic expression.
- *
+ *
* @version $Revision$
*/
public class RecipientList extends ServiceSupport implements Processor {
@@ -65,8 +66,7 @@
Producer<Exchange> producer = producerCache.getProducer(endpoint);
processors.add(producer);
}
- MulticastProcessor mp = new MulticastProcessor(processors,
- new UseLatestAggregationStrategy());
+ MulticastProcessor mp = new MulticastProcessor(processors, new UseLatestAggregationStrategy());
mp.process(exchange);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java Mon Mar 24 08:08:24 2008
@@ -16,7 +16,6 @@
*/
package org.apache.camel.processor;
-import static org.apache.camel.util.ObjectHelper.notNull;
import java.util.Iterator;
@@ -30,13 +29,14 @@
import org.apache.camel.util.CollectionHelper;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ServiceHelper;
+import static org.apache.camel.util.ObjectHelper.notNull;
/**
* Implements a dynamic <a
* href="http://activemq.apache.org/camel/splitter.html">Splitter</a> pattern
* where an expression is evaluated to iterate through each of the parts of a
* message and then each part is then send to some endpoint.
- *
+ *
* @version $Revision$
*/
public class Splitter extends ServiceSupport implements Processor {
@@ -46,7 +46,7 @@
private final Processor processor;
private final Expression expression;
private final AggregationStrategy aggregationStrategy;
-
+
public Splitter(Expression expression, Processor destination, AggregationStrategy aggregationStrategy) {
this.processor = destination;
this.expression = expression;
@@ -55,7 +55,7 @@
notNull(expression, "expression");
notNull(aggregationStrategy, "aggregationStrategy");
}
-
+
@Override
public String toString() {
return "Splitter[on: " + expression + " to: " + processor + " aggregate: " + aggregationStrategy + "]";
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadProcessor.java Mon Mar 24 08:08:24 2008
@@ -61,7 +61,7 @@
}
public void run() {
- if( shutdown.get() ) {
+ if (shutdown.get()) {
exchange.setException(new RejectedExecutionException());
callback.done(false);
} else {
@@ -75,7 +75,7 @@
}
public boolean process(final Exchange exchange, final AsyncCallback callback) {
- if( shutdown.get() ) {
+ if (shutdown.get()) {
throw new IllegalStateException("ThreadProcessor is not running.");
}
ProcessCall call = new ProcessCall(exchange, callback);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThrowFaultProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThrowFaultProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThrowFaultProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThrowFaultProcessor.java Mon Mar 24 08:08:24 2008
@@ -6,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/processor/UnmarshalProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnmarshalProcessor.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnmarshalProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnmarshalProcessor.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,
@@ -20,8 +19,8 @@
import java.io.InputStream;
import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
import org.apache.camel.Message;
+import org.apache.camel.Processor;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.util.ExchangeHelper;
@@ -46,11 +45,10 @@
// so that it can mutate it if necessary
Message out = exchange.getOut(true);
out.copyFrom(exchange.getIn());
-
+
Object result = dataFormat.unmarshal(exchange, stream);
out.setBody(result);
- }
- finally {
+ } finally {
if (null != stream) {
stream.close();
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationCollection.java Mon Mar 24 08:08:24 2008
@@ -31,7 +31,7 @@
* A {@link Collection} which aggregates exchanges together using a correlation
* expression so that there is only a single message exchange sent for a single
* correlation key.
- *
+ *
* @version $Revision$
*/
public class AggregationCollection extends AbstractCollection<Exchange> {
@@ -40,14 +40,14 @@
private final AggregationStrategy aggregationStrategy;
private Map<Object, Exchange> map = new LinkedHashMap<Object, Exchange>();
- protected Map<Object, Exchange> getMap() {
- return map;
- }
-
public AggregationCollection(Expression<Exchange> correlationExpression,
AggregationStrategy aggregationStrategy) {
this.correlationExpression = correlationExpression;
this.aggregationStrategy = aggregationStrategy;
+ }
+
+ protected Map<Object, Exchange> getMap() {
+ return map;
}
@Override
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/PredicateAggregationCollection.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/PredicateAggregationCollection.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/PredicateAggregationCollection.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/PredicateAggregationCollection.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,9 +16,9 @@
*/
package org.apache.camel.processor.aggregate;
-import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/LoadBalancerConsumer.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/processor/loadbalancer/StickyLoadBalancer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.java Mon Mar 24 08:08:24 2008
@@ -41,21 +41,21 @@
public StickyLoadBalancer() {
this.loadBalancer = new RoundRobinLoadBalancer();
}
-
- public void setCorrelationExpression(Expression<Exchange> correlationExpression) {
- this.correlationExpression = correlationExpression;
- }
-
- public void setLoadBalancer(QueueLoadBalancer loadBalancer) {
- this.loadBalancer = loadBalancer;
- }
-
+
public StickyLoadBalancer(Expression<Exchange> correlationExpression) {
this(correlationExpression, new RoundRobinLoadBalancer());
}
public StickyLoadBalancer(Expression<Exchange> correlationExpression, QueueLoadBalancer loadBalancer) {
this.correlationExpression = correlationExpression;
+ this.loadBalancer = loadBalancer;
+ }
+
+ public void setCorrelationExpression(Expression<Exchange> correlationExpression) {
+ this.correlationExpression = correlationExpression;
+ }
+
+ public void setLoadBalancer(QueueLoadBalancer loadBalancer) {
this.loadBalancer = loadBalancer;
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/DefaultValidationErrorHandler.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/DefaultValidationErrorHandler.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/DefaultValidationErrorHandler.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/validation/DefaultValidationErrorHandler.java Mon Mar 24 08:08:24 2008
@@ -21,13 +21,14 @@
import javax.xml.transform.dom.DOMResult;
import javax.xml.validation.Schema;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
import org.apache.camel.Exchange;
import org.apache.camel.ValidationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
/**
* A default error handler which just stores all the errors so they can be reported or transformed.
@@ -35,28 +36,28 @@
* @version $Revision$
*/
public class DefaultValidationErrorHandler implements ValidatorErrorHandler {
- private static final transient Log log = LogFactory.getLog(DefaultValidationErrorHandler.class);
+ private static final transient Log LOG = LogFactory.getLog(DefaultValidationErrorHandler.class);
private List<SAXParseException> warnings = new ArrayList<SAXParseException>();
private List<SAXParseException> errors = new ArrayList<SAXParseException>();
private List<SAXParseException> fatalErrors = new ArrayList<SAXParseException>();
public void warning(SAXParseException e) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("warning: " + e, e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("warning: " + e, e);
}
warnings.add(e);
}
public void error(SAXParseException e) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("error: " + e, e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("error: " + e, e);
}
errors.add(e);
}
public void fatalError(SAXParseException e) throws SAXException {
- if (log.isDebugEnabled()) {
- log.debug("fatalError: " + e, e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("fatalError: " + e, e);
}
fatalErrors.add(e);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/BrowsableEndpoint.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/spi/DataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/DataFormat.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/DataFormat.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/DataFormat.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,9 +16,8 @@
*/
package org.apache.camel.spi;
-import java.io.OutputStream;
-import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import org.apache.camel.Exchange;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java Mon Mar 24 08:08:24 2008
@@ -26,30 +26,30 @@
import org.apache.camel.impl.RouteContext;
public interface LifecycleStrategy {
-
- /**
+ /**
* Notification on adding a {@see CamelContext}.
*/
- void onContextCreate(CamelContext context);
-
- /**
+ void onContextCreate(CamelContext context);
+
+ /**
* Notification on adding an {@see Endpoint}.
*/
- void onEndpointAdd(Endpoint<? extends Exchange> endpoint);
+ void onEndpointAdd(Endpoint<? extends Exchange> endpoint);
- /**
+ /**
* Notification on adding a {@see Service}.
*/
- void onServiceAdd(CamelContext context, Service service);
-
- /**
+ void onServiceAdd(CamelContext context, Service service);
+
+ /**
* Notification on adding {@see Route}(s).
*/
- void onRoutesAdd(Collection<Route> routes);
-
- /**
+ void onRoutesAdd(Collection<Route> routes);
+
+ /**
* Notification on adding {@see RouteContext}(s).
- * @param routeContext
+ *
+ * @param routeContext
*/
- void onRouteContextCreate(RouteContext routeContext);
+ void onRouteContextCreate(RouteContext routeContext);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/NamespaceAware.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/NamespaceAware.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/NamespaceAware.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/NamespaceAware.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,
@@ -26,11 +25,11 @@
* @version $Revision$
*/
public interface NamespaceAware {
-
+
/**
* Injects the XML Namespaces of prefix -> uri mappings
*
* @param namespaces the XML namespaces with the key of prefixes and the value the URIs
*/
- void setNamespaces(Map<String,String> namespaces);
+ void setNamespaces(Map<String, String> namespaces);
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Synchronization.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Synchronization.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Synchronization.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Synchronization.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,
@@ -38,7 +37,7 @@
void onComplete(Exchange exchange);
/**
- * Called when the processing of the message exchange has failed for some reason.
+ * Called when the processing of the message exchange has failed for some reason.
* The exception which caused the problem is in {@link Exchange#getException()} and
* there could be a fault message via {@link Exchange#getFault()}
*
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/UnitOfWork.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/UnitOfWork.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/UnitOfWork.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/UnitOfWork.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/util/CamelContextHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java Mon Mar 24 08:08:24 2008
@@ -16,9 +16,10 @@
*/
package org.apache.camel.util;
-import java.util.List;
-import java.util.Collection;
+
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
@@ -35,7 +36,7 @@
*
* @version $Revision$
*/
-public class CamelContextHelper {
+public final class CamelContextHelper {
/**
* Utility classes should not have a public constructor.
*/
@@ -51,12 +52,11 @@
* @return
*/
public static Endpoint getMandatoryEndpoint(CamelContext camelContext, String uri)
- throws NoSuchEndpointException {
+ throws NoSuchEndpointException {
Endpoint endpoint = camelContext.getEndpoint(uri);
if (endpoint == null) {
throw new NoSuchEndpointException(uri);
- }
- else {
+ } else {
return endpoint;
}
}
@@ -66,7 +66,8 @@
*
* @param camelContext
* @param type the type of the endpoints requested
- * @return a list which may be empty of all the endpoint instances of the given type
+ * @return a list which may be empty of all the endpoint instances of the
+ * given type
*/
public static <T> List<T> getSingletonEndpoints(CamelContext camelContext, Class<T> type) {
List<T> answer = new ArrayList<T>();
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java Mon Mar 24 08:08:24 2008
@@ -26,15 +26,15 @@
/**
* A number of helper methods for working with collections
- *
+ *
* @version $Revision$
*/
-public class CollectionHelper {
-
+public final class CollectionHelper {
+
/**
* Utility classes should not have a public constructor.
*/
- private CollectionHelper() {
+ private CollectionHelper() {
}
/**
@@ -43,22 +43,18 @@
public static Integer size(Object value) {
if (value != null) {
if (value instanceof Collection) {
- Collection collection = (Collection) value;
+ Collection collection = (Collection)value;
return collection.size();
- }
- else if (value instanceof Map) {
- Map map = (Map) value;
+ } else if (value instanceof Map) {
+ Map map = (Map)value;
return map.size();
- }
- else if (value instanceof Object[]) {
- Object[] array = (Object[]) value;
+ } else if (value instanceof Object[]) {
+ Object[] array = (Object[])value;
return array.length;
- }
- else if (value.getClass().isArray()) {
+ } else if (value.getClass().isArray()) {
return Array.getLength(value);
- }
- else if (value instanceof NodeList) {
- NodeList nodeList = (NodeList) value;
+ } else if (value instanceof NodeList) {
+ NodeList nodeList = (NodeList)value;
return nodeList.getLength();
}
}
@@ -69,7 +65,7 @@
* Sets the value of the entry in the map for the given key, though if the
* map already contains a value for the given key then the value is appended
* to a list of values.
- *
+ *
* @param map the map to add the entry to
* @param key the key in the map
* @param value the value to put in the map
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionStringBuffer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionStringBuffer.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionStringBuffer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CollectionStringBuffer.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,
@@ -43,8 +42,7 @@
public void append(Object value) {
if (first) {
first = false;
- }
- else {
+ } else {
buffer.append(separator);
}
buffer.append(value);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/DefaultTimeoutMap.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/DefaultTimeoutMap.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/DefaultTimeoutMap.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/DefaultTimeoutMap.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,
@@ -30,12 +29,12 @@
import org.apache.commons.logging.LogFactory;
/**
- *
+ *
* @version $Revision$
*/
public class DefaultTimeoutMap implements TimeoutMap, Runnable {
- private static final Log log = LogFactory.getLog(DefaultTimeoutMap.class);
+ private static final Log LOG = LogFactory.getLog(DefaultTimeoutMap.class);
private Map map = new HashMap();
private SortedSet index = new TreeSet();
@@ -121,15 +120,14 @@
}
if (entry.getExpireTime() < now) {
if (isValidForEviction(entry)) {
- if (log.isDebugEnabled()) {
- log.debug("Evicting inactive request for correlationID: " + entry);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Evicting inactive request for correlationID: " + entry);
}
System.out.println("Evicting inactive request for correlationID: " + entry);
map.remove(entry.getKey());
iter.remove();
}
- }
- else {
+ } else {
break;
}
}
@@ -174,7 +172,7 @@
/**
* A hook to allow derivations to avoid evicting the current entry
- *
+ *
* @param entry
* @return
*/
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.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,
@@ -29,9 +28,12 @@
*
* @version $Revision$
*/
-public class EndpointHelper {
+public final class EndpointHelper {
private static final transient Log LOG = LogFactory.getLog(EndpointHelper.class);
+ private EndpointHelper() {
+ //Utility Class
+ }
/**
* Creates a {@link PollingConsumer} and polls all pending messages on the endpoint
* and invokes the given {@link Processor} to process each {@link Exchange} and then closes
@@ -49,26 +51,24 @@
Exchange exchange = consumer.receive(timeout);
if (exchange == null) {
break;
- }
- else {
+ } else {
processor.process(exchange);
}
}
- }
- finally {
+ } finally {
try {
consumer.stop();
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.warn("Failed to stop PollingConsumer: " + e, e);
}
}
}
/**
- * Creates a {@link PollingConsumer} and polls all pending messages on the endpoint
- * and invokes the given {@link Processor} to process each {@link Exchange} and then closes
- * down the consumer and throws any exceptions thrown.
+ * Creates a {@link PollingConsumer} and polls all pending messages on the
+ * endpoint and invokes the given {@link Processor} to process each
+ * {@link Exchange} and then closes down the consumer and throws any
+ * exceptions thrown.
*
* @param endpoint
* @param processor
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java Mon Mar 24 08:08:24 2008
@@ -19,19 +19,28 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.*;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.InvalidTypeException;
+import org.apache.camel.Message;
+import org.apache.camel.NoSuchBeanException;
+import org.apache.camel.NoSuchEndpointException;
+import org.apache.camel.NoSuchHeaderException;
+import org.apache.camel.NoSuchPropertyException;
/**
* Some helper methods for working with {@link Exchange} objects
- *
+ *
* @version $Revision$
*/
-public class ExchangeHelper {
+public final class ExchangeHelper {
/**
* Utility classes should not have a public constructor.
*/
- private ExchangeHelper() {
+ private ExchangeHelper() {
}
/**
@@ -56,12 +65,12 @@
/**
* Attempts to resolve the endpoint for the given value
- *
+ *
* @param exchange the message exchange being processed
* @param value the value which can be an {@link Endpoint} or an object
* which provides a String representation of an endpoint via
* {@link #toString()}
- *
+ *
* @return the endpoint
* @throws NoSuchEndpointException if the endpoint cannot be resolved
*/
@@ -88,7 +97,7 @@
}
public static <T> T getMandatoryHeader(Exchange exchange, String propertyName, Class<T> type)
- throws NoSuchHeaderException {
+ throws NoSuchHeaderException {
T answer = exchange.getIn().getHeader(propertyName, type);
if (answer == null) {
throw new NoSuchHeaderException(exchange, propertyName, type);
@@ -184,8 +193,7 @@
Message out = source.getOut(false);
if (out != null) {
result.getOut(true).copyFrom(out);
- }
- else {
+ } else {
// no results so lets copy the last input
// as the final processor on a pipeline might not
// have created any OUT; such as a mock:endpoint
@@ -253,8 +261,7 @@
map.put("in", in);
map.put("request", in);
map.put("headers", in.getHeaders());
- map.put("body", in.getBody())
- ;
+ map.put("body", in.getBody());
if (isOutCapable(exchange)) {
Message out = exchange.getOut(true);
map.put("out", out);
@@ -267,7 +274,7 @@
* Returns the MIME content type on the input message or null if one is not defined
*/
public static String getContentType(Exchange exchange) {
- return exchange.getIn().getHeader("Content-Type", String.class);
+ return exchange.getIn().getHeader("Content-Type", String.class);
}
/**
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExpressionHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExpressionHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExpressionHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExpressionHelper.java Mon Mar 24 08:08:24 2008
@@ -21,20 +21,20 @@
/**
* A collection of helper methods for working with expressions.
- *
+ *
* @version $Revision$
*/
-public class ExpressionHelper {
+public final class ExpressionHelper {
/**
* Utility classes should not have a public constructor.
*/
- private ExpressionHelper() {
+ private ExpressionHelper() {
}
/**
* Evaluates the given expression on the exchange as a String value
- *
+ *
* @param expression the expression to evaluate
* @param exchange the exchange to use to evaluate the expression
* @return the result of the evaluation as a string.
@@ -46,7 +46,7 @@
/**
* Evaluates the given expression on the exchange, converting the result to
* the given type
- *
+ *
* @param expression the expression to evaluate
* @param exchange the exchange to use to evaluate the expression
* @param resultType the type of the result that is required
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IOHelper.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,10 @@
/**
* @version $Revision$
*/
-public class IOHelper {
+public final class IOHelper {
+ private IOHelper() {
+ //Utility Class
+ }
/**
* A factory method which creates an {@link IOException} from the given
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java Mon Mar 24 08:08:24 2008
@@ -16,8 +16,6 @@
*/
package org.apache.camel.util;
-import org.apache.camel.TypeConverter;
-
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.lang.reflect.Field;
@@ -34,12 +32,15 @@
import java.util.Map.Entry;
import java.util.Set;
-public class IntrospectionSupport {
+
+import org.apache.camel.TypeConverter;
+
+public final class IntrospectionSupport {
/**
* Utility classes should not have a public constructor.
*/
- private IntrospectionSupport() {
+ private IntrospectionSupport() {
}
public static boolean getProperties(Object target, Map props, String optionPrefix) {
@@ -162,7 +163,7 @@
}
for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Entry)iter.next();
+ Entry entry = (Entry)iter.next();
if (setProperty(typeConverter, target, (String)entry.getKey(), entry.getValue())) {
iter.remove();
rc = true;
@@ -194,15 +195,13 @@
setter.invoke(target, new Object[] {convertedValue});
}
return true;
- }
- catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
Throwable throwable = e.getTargetException();
if (throwable instanceof Exception) {
- Exception exception = (Exception) throwable;
+ Exception exception = (Exception)throwable;
throw exception;
- }
- else {
- Error error = (Error) throwable;
+ } else {
+ Error error = (Error)throwable;
throw error;
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Mon Mar 24 08:08:24 2008
@@ -16,11 +16,8 @@
*/
package org.apache.camel.util;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.converter.ObjectConverter;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import java.io.Closeable;
+import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -29,23 +26,26 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.io.Closeable;
-import java.io.IOException;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.converter.ObjectConverter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* A number of useful helper methods for working with Objects
- *
+ *
* @version $Revision$
*/
-public class ObjectHelper {
+public final class ObjectHelper {
private static final transient Log LOG = LogFactory.getLog(ObjectHelper.class);
/**
* Utility classes should not have a public constructor.
*/
- private ObjectHelper() {
+ private ObjectHelper() {
}
-
+
/**
* @deprecated use the equal method instead
*
@@ -154,7 +154,7 @@
/**
* Removes any starting characters on the given text which match the given
* character
- *
+ *
* @param text the string
* @param ch the initial characters to remove
* @return either the original string or the new substring
@@ -204,7 +204,7 @@
* Returns the predicate matching boolean on a {@link List} result set where
* if the first element is a boolean its value is used otherwise this method
* returns true if the collection is not empty
- *
+ *
* @returns true if the first element is a boolean and its value is true or
* if the list is non empty
*/
@@ -233,7 +233,7 @@
/**
* A helper method to access a system property, catching any security
* exceptions
- *
+ *
* @param name the name of the system property required
* @param defaultValue the default value to use if the property is not
* available or a security exception prevents access
@@ -270,7 +270,7 @@
/**
* Attempts to load the given class name using the thread context class
* loader or the class loader used to load this class
- *
+ *
* @param name the name of the class to load
* @return the class or null if it could not be loaded
*/
@@ -281,7 +281,7 @@
/**
* Attempts to load the given class name using the thread context class
* loader or the given class loader
- *
+ *
* @param name the name of the class to load
* @param loader the class loader to use after the thread context class
* loader
@@ -306,7 +306,7 @@
/**
* A helper method to invoke a method via reflection and wrap any exceptions
* as {@link RuntimeCamelException} instances
- *
+ *
* @param method the method to invoke
* @param instance the object instance (or null for static methods)
* @param parameters the parameters to the method
@@ -324,7 +324,7 @@
/**
* Returns a list of methods which are annotated with the given annotation
- *
+ *
* @param type the type to reflect on
* @param annotationType the annotation type
* @return a list of the methods found
@@ -346,7 +346,7 @@
/**
* Turns the given object arrays into a meaningful string
- *
+ *
* @param objects an array of objects or null
* @return a meaningful string
*/
@@ -449,9 +449,8 @@
if (closeable != null) {
try {
closeable.close();
- }
- catch (IOException e) {
- log.warn("Could not close " + name + ". Reason: "+ e, e);
+ } catch (IOException e) {
+ log.warn("Could not close " + name + ". Reason: " + e, e);
}
}
}
@@ -461,19 +460,18 @@
*/
public static <T> T cast(Class<T> toType, Object value) {
if (toType == boolean.class) {
- return (T) cast(Boolean.class, value);
- }
- else if (toType.isPrimitive()) {
+ return (T)cast(Boolean.class, value);
+ } else if (toType.isPrimitive()) {
Class newType = convertPrimitiveTypeToWrapperType(toType);
if (newType != toType) {
- return (T) cast(newType, value);
+ return (T)cast(newType, value);
}
}
try {
return toType.cast(value);
- }
- catch (ClassCastException e) {
- throw new IllegalArgumentException("Failed to convert: " + value + " to type: " + toType.getName() + " due to: " + e, e);
+ } catch (ClassCastException e) {
+ throw new IllegalArgumentException("Failed to convert: " + value + " to type: "
+ + toType.getName() + " due to: " + e, e);
}
}
@@ -517,7 +515,7 @@
}
if (Character.isJavaIdentifierStart(name.charAt(0))) {
for (int i = 1; i < size; i++) {
- if (! Character.isJavaIdentifierPart(name.charAt(i))) {
+ if (!Character.isJavaIdentifierPart(name.charAt(i))) {
return false;
}
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/PackageHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/PackageHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/PackageHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/PackageHelper.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,
@@ -25,8 +24,11 @@
*
* @version $Revision$
*/
-public class PackageHelper {
+public final class PackageHelper {
public static final transient Log LOG = LogFactory.getLog(PackageHelper.class);
+ private PackageHelper() {
+ // Utility Class
+ }
/**
* Returns true if the version number of the given package name can be found and is greater than or equal to the minimum version.
@@ -47,7 +49,8 @@
int idx = value.indexOf('.');
if (idx >= 0) {
StringBuffer buffer = new StringBuffer(value.substring(0, ++idx));
- for (int i = idx, size = value.length(); i < size; i++) {
+ int i = idx;
+ for (int size = value.length(); i < size; i++) {
char ch = value.charAt(i);
if (Character.isDigit(ch)) {
buffer.append(ch);
@@ -58,8 +61,7 @@
Double number = Double.parseDouble(value);
return number >= minimumVersion;
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
LOG.debug("Failed to find out " + packageName + " version: " + e, e);
}
return true;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProducerCache.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProducerCache.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProducerCache.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ProducerCache.java Mon Mar 24 08:08:24 2008
@@ -22,11 +22,11 @@
import org.apache.camel.AsyncCallback;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.ExchangePattern;
import org.apache.camel.impl.ServiceSupport;
import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
import org.apache.commons.logging.Log;
@@ -57,7 +57,7 @@
/**
* Sends the exchange to the given endpoint
- *
+ *
* @param endpoint the endpoint to send the exchange to
* @param exchange the exchange to send
*/
@@ -73,7 +73,7 @@
/**
* Sends an exchange to an endpoint using a supplied
* @{link Processor} to populate the exchange
- *
+ *
* @param endpoint the endpoint to send the exchange to
* @param processor the transformer used to populate the new exchange
*/
@@ -89,9 +89,9 @@
/**
* Sends an exchange to an endpoint using a supplied
- * @{link Processor} to populate the exchange. The callback
+ * @{link Processor} to populate the exchange. The callback
* will be called when the exchange is completed.
- *
+ *
* @param endpoint the endpoint to send the exchange to
* @param processor the transformer used to populate the new exchange
*/
@@ -106,14 +106,14 @@
throw new RuntimeCamelException(e);
}
}
-
+
public static boolean isProcessedSync(Exchange exchange) {
Boolean rc = exchange.getProperty(ProducerCache.class.getName() + ".SYNC", Boolean.class);
return rc == null ? false : rc;
}
public static void setProcessedSync(Exchange exchange, boolean b) {
- exchange.setProperty(ProducerCache.class.getName() + ".SYNC", b ? Boolean.TRUE : Boolean.FALSE );
+ exchange.setProperty(ProducerCache.class.getName() + ".SYNC", b ? Boolean.TRUE : Boolean.FALSE);
}
/**
@@ -126,7 +126,7 @@
* @param processor the transformer used to populate the new exchange
*/
public E send(Endpoint<E> endpoint, ExchangePattern pattern, Processor processor) {
- try {
+ try {
Producer<E> producer = getProducer(endpoint);
E exchange = producer.createExchange(pattern);
return sendExchange(endpoint, producer, processor, exchange);
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterLoader.java Mon Mar 24 08:08:24 2008
@@ -16,6 +16,8 @@
*/
package org.apache.camel.util;
+
+
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
@@ -23,52 +25,51 @@
import java.util.List;
import org.apache.camel.TypeConverter;
-import static org.apache.camel.util.ObjectHelper.equal;
import org.apache.camel.impl.converter.AnnotationTypeConverterLoader;
import org.apache.camel.impl.converter.TypeConverterRegistry;
+import static org.apache.camel.util.ObjectHelper.equal;
public class ReportingTypeConverterLoader extends AnnotationTypeConverterLoader {
-
+
+ private static final Comparator<TypeMapping> COMPARE_LAST_LOADED_FIRST = new Comparator<TypeMapping>() {
+ public int compare(TypeMapping t1, TypeMapping t2) {
+ if (equal(t1.fromType, t2.fromType)) {
+ return equal(t1.toType, t2.toType) ? t1.index - t2.index : ObjectHelper
+ .compare(getTypeName(t1.toType), getTypeName(t2.toType));
+ }
+ return ObjectHelper.compare(getTypeName(t1.fromType), getTypeName(t2.fromType));
+ }
+
+ };
private List<TypeMapping> typeMappings = new ArrayList<TypeMapping>();
- private static final Comparator<TypeMapping> COMPARE_LAST_LOADED_FIRST =
- new Comparator<TypeMapping>() {
- public int compare(TypeMapping t1, TypeMapping t2) {
- if (equal(t1.fromType, t2.fromType)) {
- return equal(t1.toType, t2.toType) ? t1.index - t2.index :
- ObjectHelper.compare(getTypeName(t1.toType), getTypeName(t2.toType));
- }
- return ObjectHelper.compare(getTypeName(t1.fromType), getTypeName(t2.fromType));
- }
-
- };
-
+
public TypeMapping[] getTypeConversions() {
- Collections.sort(typeMappings, COMPARE_LAST_LOADED_FIRST);
- return typeMappings.toArray(new TypeMapping[typeMappings.size()]);
+ Collections.sort(typeMappings, COMPARE_LAST_LOADED_FIRST);
+ return typeMappings.toArray(new TypeMapping[typeMappings.size()]);
}
-
- protected void registerTypeConverter(TypeConverterRegistry registry, Method method,
- Class toType, Class fromType, TypeConverter typeConverter) {
-
+
+ protected void registerTypeConverter(TypeConverterRegistry registry, Method method, Class toType,
+ Class fromType, TypeConverter typeConverter) {
+
TypeMapping mapping = new TypeMapping(toType, fromType, typeConverter.getClass(), method);
typeMappings.add(mapping);
}
-
- static private String getTypeName(Class type) {
- return type != null ? type.getName() : null;
- }
-
+
+ private static String getTypeName(Class type) {
+ return type != null ? type.getName() : null;
+ }
+
/**
* Represents a mapping from one type (which can be null) to another
*/
public static class TypeMapping {
- private static int counter = 0;
+ private static int counter;
Class toType;
Class fromType;
Class converterType;
Method method;
- int index = 0;
-
+ int index;
+
public TypeMapping(Class toType, Class fromType, Class converterType, Method method) {
this.toType = toType;
this.fromType = fromType;
@@ -76,7 +77,7 @@
this.method = method;
this.index = counter++;
}
-
+
public Class getFromType() {
return fromType;
}
@@ -90,13 +91,13 @@
}
public Method getMethod() {
- return method;
+ return method;
}
-
+
public int getIndex() {
- return index;
+ return index;
}
-
+
@Override
public boolean equals(Object object) {
if (object instanceof TypeMapping) {
@@ -119,5 +120,5 @@
public String toString() {
return "[" + fromType.getSimpleName() + "=>" + toType.getSimpleName() + "]";
}
- }
+ }
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterRegistry.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterRegistry.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterRegistry.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ReportingTypeConverterRegistry.java Mon Mar 24 08:08:24 2008
@@ -26,20 +26,19 @@
public class ReportingTypeConverterRegistry implements TypeConverterRegistry {
private List<String> errors = new ArrayList<String>();
- public String[] getErrors() {
- return errors.toArray(new String[errors.size()]);
- }
-
- public void addTypeConverter(Class toType, Class fromType,
- TypeConverter typeConverter) {
+ public String[] getErrors() {
+ return errors.toArray(new String[errors.size()]);
+ }
- if (errors.size() == 0) {
- errors.add("Method should not be invoked.");
- }
- }
+ public void addTypeConverter(Class toType, Class fromType, TypeConverter typeConverter) {
- public Injector getInjector() {
- return null;
- }
+ if (errors.size() == 0) {
+ errors.add("Method should not be invoked.");
+ }
+ }
+
+ public Injector getInjector() {
+ return null;
+ }
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ResolverUtil.java Mon Mar 24 08:08:24 2008
@@ -16,9 +16,6 @@
*/
package org.apache.camel.util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -32,6 +29,9 @@
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* <p>
* ResolverUtil is used to locate classes that are available in the/a class path
@@ -40,7 +40,7 @@
* specific annotation. However, through the use of the {@link Test} class it is
* possible to search using arbitrary conditions.
* </p>
- *
+ *
* <p>
* A ClassLoader is used to locate all locations (directories and jar files) in
* the class path that contain classes within certain packages, and then to load
@@ -49,7 +49,7 @@
* be overridden by calling {@link #setClassLoaders(Set)} prior to
* invoking any of the {@code find()} methods.
* </p>
- *
+ *
* <p>
* General searches are initiated by calling the
* {@link #find(ResolverUtil.Test, String)} ()} method and supplying a package
@@ -59,11 +59,11 @@
* for extensions of particular classes, or classes annotated with a specific
* annotation.
* </p>
- *
+ *
* <p>
* The standard usage pattern for the ResolverUtil class is as follows:
* </p>
- *
+ *
* <pre>
* esolverUtil<ActionBean> resolver = new ResolverUtil<ActionBean>();
* esolver.findImplementation(ActionBean.class, pkg1, pkg2);
@@ -71,7 +71,7 @@
* esolver.find(new CustomTest(), pkg2);
* ollection<ActionBean> beans = resolver.getClasses();
* </pre>
- *
+ *
* @author Tim Fennell
*/
public class ResolverUtil<T> {
@@ -158,7 +158,7 @@
/**
* Provides access to the classes discovered so far. If no calls have been
* made to any of the {@code find()} methods, this set will be empty.
- *
+ *
* @return the set of classes that have been discovered.
*/
public Set<Class<? extends T>> getClasses() {
@@ -197,7 +197,7 @@
* implementations. In the case of a non-interface class, subclasses will be
* collected. Accumulated classes can be accessed by calling
* {@link #getClasses()}.
- *
+ *
* @param parent the class of interface to find subclasses or
* implementations of
* @param packageNames one or more package names to scan (including
@@ -221,7 +221,7 @@
/**
* Attempts to discover classes that are annotated with to the annotation.
* Accumulated classes can be accessed by calling {@link #getClasses()}.
- *
+ *
* @param annotation the annotation that should be present on matching
* classes
* @param packageNames one or more package names to scan (including
@@ -243,7 +243,7 @@
* subpackages. Each class is offered up to the Test as it is discovered,
* and if the Test returns true the class is retained. Accumulated classes
* can be fetched by calling {@link #getClasses()}.
- *
+ *
* @param test an instance of {@link Test} that will be used to filter
* classes
* @param packageName the name of the package from which to start scanning
@@ -306,7 +306,7 @@
* <i>.class</i> the file is loaded and tested to see if it is acceptable
* according to the Test. Operates recursively to find classes within a
* folder structure matching the package structure.
- *
+ *
* @param test a Test used to filter the classes that are discovered
* @param parent the package name up to this directory in the package
* hierarchy. E.g. if /classes is in the classpath and we
@@ -339,7 +339,7 @@
* Finds matching classes within a jar files that contains a folder
* structure matching the package structure. If the File is not a JarFile or
* does not exist a warning will be logged, but no error will be raised.
- *
+ *
* @param test a Test used to filter the classes that are discovered
* @param parent the parent package under which classes must be in order to
* be considered
@@ -370,7 +370,7 @@
* Add the class designated by the fully qualified class name provided to
* the set of resolved classes if and only if it is approved by the Test
* supplied.
- *
+ *
* @param test the test used to determine if the class matches
* @param fqn the fully qualified name of a class
*/
@@ -389,9 +389,9 @@
}
found = true;
break;
- }
- catch (ClassNotFoundException e) {
- LOG.debug("Could not find class '" + fqn + "' in class loader: " + classLoader + ". Reason: " + e, e);
+ } catch (ClassNotFoundException e) {
+ LOG.debug("Could not find class '" + fqn + "' in class loader: " + classLoader
+ + ". Reason: " + e, e);
}
}
if (!found) {
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java Mon Mar 24 08:08:24 2008
@@ -24,18 +24,18 @@
/**
* A collection of helper methods for working with {@link Service} objects
- *
+ *
* @version $Revision$
*/
-public class ServiceHelper {
+public final class ServiceHelper {
private static final transient Log LOG = LogFactory.getLog(ServiceHelper.class);
-
+
/**
* Utility classes should not have a public constructor.
*/
- private ServiceHelper() {
+ private ServiceHelper() {
}
-
+
public static void startService(Object value) throws Exception {
if (value instanceof Service) {
Service service = (Service)value;
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMap.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMap.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMap.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMap.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,
@@ -20,14 +19,14 @@
/**
* Represents a thread safe map of values which timeout after a period of
* inactivity.
- *
+ *
* @version $Revision$
*/
public interface TimeoutMap extends Runnable {
/**
* Looks up the value in the map by the given key.
- *
+ *
* @param key
* the key of the value to search for
* @return the value for the given key or null if it is not present (or has
@@ -51,5 +50,5 @@
/**
* Purges any old entries from the map
*/
- public void purge();
+ void purge();
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMapEntry.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMapEntry.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMapEntry.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/TimeoutMapEntry.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,
@@ -21,7 +20,7 @@
/**
* Represents an entry in a {@link TimeoutMap}
- *
+ *
* @version $Revision$
*/
public class TimeoutMapEntry implements Comparable, Map.Entry {
@@ -80,8 +79,7 @@
long diff = this.expireTime - that.expireTime;
if (diff > 0) {
return 1;
- }
- else if (diff < 0) {
+ } else if (diff < 0) {
return -1;
}
return this.key.hashCode() - that.key.hashCode();
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/UnsafeUriCharactersEncoder.java Mon Mar 24 08:08:24 2008
@@ -26,9 +26,12 @@
import org.apache.commons.logging.LogFactory;
-public class UnsafeUriCharactersEncoder {
- private static final transient Log LOG = LogFactory.getLog(UnsafeUriCharactersEncoder.class);
+public final class UnsafeUriCharactersEncoder {
static BitSet unsafeCharacters;
+ private static final transient Log LOG = LogFactory.getLog(UnsafeUriCharactersEncoder.class);
+ private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
+ 'D', 'E', 'F'};
+
static {
unsafeCharacters = new BitSet(256);
unsafeCharacters.set(' ');
@@ -42,59 +45,58 @@
unsafeCharacters.set('|');
unsafeCharacters.set('\\');
unsafeCharacters.set('^');
- unsafeCharacters.set('~');
+ unsafeCharacters.set('~');
unsafeCharacters.set('[');
unsafeCharacters.set(']');
- unsafeCharacters.set('`');
+ unsafeCharacters.set('`');
}
-
-
+
+
private UnsafeUriCharactersEncoder() {
- // util class
+ // util class
}
-
+
public static String encode(String s) {
int n = s.length();
- if (n == 0)
+ if (n == 0) {
return s;
-
+ }
+
// First check whether we actually need to encode
-
+
try {
- byte[] bytes = s.getBytes("UTF8");
+ byte[] bytes = s.getBytes("UTF8");
for (int i = 0;;) {
- if (unsafeCharacters.get(bytes[i]))
+ if (unsafeCharacters.get(bytes[i])) {
break;
- if (++i >= bytes.length)
+ }
+ if (++i >= bytes.length) {
return s;
+ }
}
-
+
StringBuffer sb = new StringBuffer();
- for (byte b : bytes) {
+ for (byte b : bytes) {
if (unsafeCharacters.get(b)) {
appendEscape(sb, (byte)b);
- }
- else
+ } else {
sb.append((char)b);
+ }
}
return sb.toString();
} catch (UnsupportedEncodingException e) {
- LOG.error("Can't encoding the uri: ", e);
+ LOG.error("Can't encoding the uri: ", e);
return null;
- }
+ }
}
-
+
private static void appendEscape(StringBuffer sb, byte b) {
sb.append('%');
- sb.append(hexDigits[(b >> 4) & 0x0f]);
- sb.append(hexDigits[(b >> 0) & 0x0f]);
+ sb.append(HEX_DIGITS[(b >> 4) & 0x0f]);
+ sb.append(HEX_DIGITS[(b >> 0) & 0x0f]);
}
-
- private final static char[] hexDigits = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
- };
-
-
+
+
+
}
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jndi/CamelInitialContextFactory.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jndi/CamelInitialContextFactory.java?rev=640438&r1=640437&r2=640438&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jndi/CamelInitialContextFactory.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jndi/CamelInitialContextFactory.java Mon Mar 24 08:08:24 2008
@@ -34,11 +34,9 @@
public Context getInitialContext(Hashtable environment) throws NamingException {
try {
return new JndiContext(environment);
- }
- catch (NamingException e) {
+ } catch (NamingException e) {
throw e;
- }
- catch (Exception e) {
+ } catch (Exception e) {
NamingException exception = new NamingException(e.getMessage());
exception.initCause(e);
throw exception;