Permalink
Browse files

[maven-scm] copy for tag camel-2.3.0

git-svn-id: https://svn.apache.org/repos/asf/camel/tags/camel-2.3.0@947328 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
2 parents 5c717fb + 10e7dbe commit 8a471f4432d3fdc5639c17eab2ad32fbcf38ed0e @hzbarcea hzbarcea committed May 22, 2010
Showing with 1,364 additions and 2,013 deletions.
  1. +1 −1 camel-core/src/main/java/org/apache/camel/Message.java
  2. +5 −4 camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
  3. +2 −1 camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
  4. +2 −2 ...ore/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
  5. +16 −0 camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
  6. +4 −5 camel-core/src/main/java/org/apache/camel/converter/IOConverter.java
  7. +2 −2 camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
  8. +3 −3 camel-core/src/main/java/org/apache/camel/impl/DefaultFactoryFinder.java
  9. +2 −2 camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
  10. +8 −4 camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
  11. +3 −3 camel-core/src/main/java/org/apache/camel/impl/ZipDataFormat.java
  12. +2 −1 camel-core/src/main/java/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.java
  13. +43 −0 camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
  14. +57 −0 camel-core/src/main/java/org/apache/camel/model/ValidateDefinition.java
  15. +3 −3 camel-core/src/main/java/org/apache/camel/model/language/ExpressionDefinition.java
  16. +5 −1 camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
  17. +3 −2 camel-core/src/main/java/org/apache/camel/processor/idempotent/FileIdempotentRepository.java
  18. +70 −0 camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidatingProcessor.java
  19. +49 −0 camel-core/src/main/java/org/apache/camel/processor/validation/PredicateValidationException.java
  20. +1 −1 camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java
  21. +51 −2 camel-core/src/main/java/org/apache/camel/util/IOHelper.java
  22. +6 −12 camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
  23. +1 −0 camel-core/src/main/resources/org/apache/camel/model/jaxb.index
  24. +76 −0 camel-core/src/test/java/org/apache/camel/component/mock/MockAsBeanTest.java
  25. +65 −0 camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatFileDeleteTest.java
  26. +68 −0 camel-core/src/test/java/org/apache/camel/impl/GzipDataFormatFileUnmarshalDeleteTest.java
  27. +65 −0 camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatFileDeleteTest.java
  28. +68 −0 camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatFileUnmarshalDeleteTest.java
  29. +77 −0 camel-core/src/test/java/org/apache/camel/processor/ValidateRegExpTest.java
  30. +76 −0 camel-core/src/test/java/org/apache/camel/processor/ValidateSimpleTest.java
  31. +61 −0 ...l-core/src/test/java/org/apache/camel/processor/aggregator/AggregateRepositoryReturnNullTest.java
  32. +1 −1 components/camel-bean-validator/pom.xml
  33. +1 −1 components/camel-castor/pom.xml
  34. +4 −4 components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
  35. +4 −4 components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
  36. +1 −1 components/camel-http4/pom.xml
  37. +5 −5 components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
  38. +1 −1 components/camel-jetty/pom.xml
  39. +67 −0 components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
  40. +3 −2 components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
  41. +4 −2 components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
  42. +3 −2 components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
  43. +34 −0 components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java
  44. +81 −0 ...nts/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingDifferentHeadersTest.java
  45. +0 −133 components/camel-jmxconnect/pom.xml
  46. +0 −342 components/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/CamelJmxConnector.java
  47. +0 −140 components/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/CamelJmxConnectorServer.java
  48. +0 −49 components/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/CamelJmxConnectorSupport.java
  49. +0 −107 components/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/ListenerInfo.java
  50. +0 −45 ...onents/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/MBeanCamelServerConnection.java
  51. +0 −114 .../camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/MBeanCamelServerConnectionClient.java
  52. +0 −73 ...ts/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/MBeanCamelServerConnectionImpl.java
  53. +0 −182 ...nts/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/MBeanServerConnectionDelegate.java
  54. +0 −86 components/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/ServerListenerInfo.java
  55. +0 −38 .../camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/provider/activemq/ActiveMQHelper.java
  56. +0 −45 .../camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/provider/activemq/ClientProvider.java
  57. +0 −46 .../camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/provider/activemq/ServerProvider.java
  58. +0 −38 ...nts/camel-jmxconnect/src/main/java/org/apache/camel/jmxconnect/provider/camel/ServerProvider.java
  59. +0 −170 components/camel-jmxconnect/src/test/java/org/apache/camel/jmxconnect/JmxRemoteTest.java
  60. +0 −84 components/camel-jmxconnect/src/test/java/org/apache/camel/jmxconnect/SimpleService.java
  61. +0 −47 components/camel-jmxconnect/src/test/java/org/apache/camel/jmxconnect/SimpleServiceMBean.java
  62. +0 −35 components/camel-jmxconnect/src/test/resources/log4j.properties
  63. +49 −30 components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
  64. +9 −12 ...ava → camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateRegExpTest.java}
  65. +8 −14 ...ava → camel-spring/src/test/java/org/apache/camel/spring/processor/SpringValidateSimpleTest.java}
  66. +37 −0 components/camel-spring/src/test/resources/org/apache/camel/spring/processor/ValidateSimpleTest.xml
  67. +37 −0 components/camel-spring/src/test/resources/org/apache/camel/spring/processor/validate.xml
  68. +3 −1 components/pom.xml
  69. +1 −1 examples/camel-example-axis/pom.xml
  70. +1 −1 examples/camel-example-loadbalancing-mina/pom.xml
  71. +72 −69 examples/camel-example-loadbalancing-mina/src/main/java/org/apache/camel/example/model/Report.java
  72. +14 −17 ...es/camel-example-loadbalancing-mina/src/main/java/org/apache/camel/example/service/Generator.java
  73. +9 −13 ...es/camel-example-loadbalancing-mina/src/main/java/org/apache/camel/example/service/Reporting.java
  74. 0 ...l-jmxconnect → examples/camel-example-loadbalancing-mina}/src/main/resources/META-INF/LICENSE.txt
  75. 0 ...el-jmxconnect → examples/camel-example-loadbalancing-mina}/src/main/resources/META-INF/NOTICE.txt
  76. +4 −4 examples/camel-example-reportincident/README.txt
  77. +1 −1 examples/camel-example-reportincident/pom.xml
  78. +1 −1 examples/camel-example-spring-javaconfig/pom.xml
  79. +1 −1 examples/camel-example-spring-security/pom.xml
  80. +3 −0 examples/pom.xml
  81. +1 −1 parent/pom.xml
  82. +9 −1 pom.xml
@@ -140,7 +140,7 @@
* See {@link org.apache.camel.impl.DefaultMessage DefaultMessage} for how headers
* is represented in Camel using a {@link org.apache.camel.util.CaseInsensitiveMap CaseInsensitiveMap}.
* <p/>
- * If you want to walk the returned Map and fetch all the keys and values, you should use
+ * <b>Important:</b> If you want to walk the returned {@link Map} and fetch all the keys and values, you should use
* the {@link java.util.Map#entrySet()} method, which ensure you get the keys in the original case.
*
* @return all the headers in a Map
@@ -31,6 +31,7 @@
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -255,8 +256,8 @@ private void writeFileByFile(File source, File target) throws IOException {
position += in.transferTo(position, endpoint.getBufferSize(), out);
}
} finally {
- ObjectHelper.close(in, source.getName(), LOG);
- ObjectHelper.close(out, source.getName(), LOG);
+ IOHelper.close(in, source.getName(), LOG);
+ IOHelper.close(out, source.getName(), LOG);
}
}
@@ -280,8 +281,8 @@ private void writeFileByStream(InputStream in, File target) throws IOException {
byteBuffer.clear();
}
} finally {
- ObjectHelper.close(in, target.getName(), LOG);
- ObjectHelper.close(out, target.getName(), LOG);
+ IOHelper.close(in, target.getName(), LOG);
+ IOHelper.close(out, target.getName(), LOG);
}
}
@@ -25,6 +25,7 @@
import org.apache.camel.spi.Language;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,7 +215,7 @@ protected void writeFile(Exchange exchange, String fileName) throws GenericFileO
}
} finally {
- ObjectHelper.close(payload, "Closing payload", log);
+ IOHelper.close(payload, "Closing payload", log);
}
}
@@ -29,7 +29,7 @@
import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
import org.apache.camel.component.file.GenericFileOperations;
import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.IOHelper;
import org.apache.camel.util.StopWatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -126,7 +126,7 @@ public void releaseExclusiveReadLock(GenericFileOperations<File> operations,
lock.release();
} finally {
// must close channel first
- ObjectHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
+ IOHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
}
}
@@ -35,6 +35,7 @@
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
+import org.apache.camel.Handler;
import org.apache.camel.Message;
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
@@ -221,6 +222,21 @@ public void reset() {
// -------------------------------------------------------------------------
/**
+ * Handles the incoming exchange.
+ * <p/>
+ * This method turns this mock endpoint into a bean which you can use
+ * in the Camel routes, which allows you to inject MockEndpoint as beans
+ * in your routes and use the features of the mock to control the bean.
+ *
+ * @param exchange the exchange
+ * @throws Exception can be thrown
+ */
+ @Handler
+ public void handle(Exchange exchange) throws Exception {
+ onExchange(exchange);
+ }
+
+ /**
* Set the processor that will be invoked when the index
* message is received.
*/
@@ -40,7 +40,6 @@
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.URL;
-import java.nio.charset.Charset;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
@@ -177,7 +176,7 @@ public static String toString(File file, Exchange exchange) throws IOException {
try {
return toBytes(is);
} finally {
- ObjectHelper.close(is, "file", LOG);
+ IOHelper.close(is, "file", LOG);
}
}
@@ -206,7 +205,7 @@ public static String toString(URL url, Exchange exchange) throws IOException {
try {
return toString(is, exchange);
} finally {
- ObjectHelper.close(is, "url", LOG);
+ IOHelper.close(is, "url", LOG);
}
}
@@ -237,7 +236,7 @@ public static String toString(BufferedReader reader) throws IOException {
}
}
} finally {
- ObjectHelper.close(reader, "reader", LOG);
+ IOHelper.close(reader, "reader", LOG);
}
return sb.toString();
@@ -303,7 +302,7 @@ public static ObjectInput toObjectInput(InputStream stream) throws IOException {
IOHelper.copy(stream, bos);
return bos.toByteArray();
} finally {
- ObjectHelper.close(bos, "stream", LOG);
+ IOHelper.close(bos, "stream", LOG);
}
}
@@ -26,7 +26,7 @@
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.IOHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -76,7 +76,7 @@ public static ByteBuffer toByteBuffer(File file) throws IOException {
}
return ByteBuffer.wrap(buf);
} finally {
- ObjectHelper.close(in, "Failed to close file stream: " + file.getPath(), LOG);
+ IOHelper.close(in, "Failed to close file stream: " + file.getPath(), LOG);
}
}
@@ -30,7 +30,7 @@
import org.apache.camel.spi.FactoryFinder;
import org.apache.camel.spi.Injector;
import org.apache.camel.util.CastUtils;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.IOHelper;
/**
* Default factory finder.
@@ -143,8 +143,8 @@ private Properties doFindFactoryProperties(String key) throws IOException {
properties.load(reader);
return properties;
} finally {
- ObjectHelper.close(reader, key, null);
- ObjectHelper.close(in, key, null);
+ IOHelper.close(reader, key, null);
+ IOHelper.close(in, key, null);
}
}
}
@@ -41,7 +41,7 @@
import org.apache.camel.impl.scan.CompositePackageScanFilter;
import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.spi.PackageScanFilter;
-import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.IOHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -386,7 +386,7 @@ private void loadImplementationsInJar(PackageScanFilter test, String parent, Inp
log.warn("Cannot search jar file '" + urlPath + "' for classes matching criteria: " + test
+ " due to an IOException: " + ioe.getMessage(), ioe);
} finally {
- ObjectHelper.close(jarStream, urlPath, log);
+ IOHelper.close(jarStream, urlPath, log);
}
}
@@ -36,9 +36,9 @@ public void marshal(Exchange exchange, Object graph, OutputStream stream) throws
try {
IOHelper.copy(is, zipOutput);
} finally {
- zipOutput.close();
+ IOHelper.close(is);
+ IOHelper.close(zipOutput);
}
-
}
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
@@ -47,8 +47,12 @@ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception
// Create an expandable byte array to hold the inflated data
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- IOHelper.copy(unzipInput, bos);
- return bos.toByteArray();
+ try {
+ IOHelper.copy(unzipInput, bos);
+ return bos.toByteArray();
+ } finally {
+ IOHelper.close(unzipInput);
+ }
}
}
@@ -47,7 +47,8 @@ public void marshal(Exchange exchange, Object graph, OutputStream stream) throws
try {
IOHelper.copy(is, zipOutput);
} finally {
- zipOutput.close();
+ IOHelper.close(is);
+ IOHelper.close(zipOutput);
}
}
@@ -61,8 +62,7 @@ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception
IOHelper.copy(unzipInput, bos);
return bos.toByteArray();
} finally {
- unzipInput.close();
- bos.close();
+ IOHelper.close(unzipInput);
}
}
@@ -37,6 +37,7 @@
import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.util.CastUtils;
+import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -117,7 +118,7 @@ protected void findPackages(Set<String> packages, ClassLoader classLoader) throw
tokenize(packages, line);
}
} finally {
- ObjectHelper.close(reader, null, LOG);
+ IOHelper.close(reader, null, LOG);
}
}
}
@@ -45,6 +45,7 @@
import org.apache.camel.builder.ExpressionBuilder;
import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.builder.ProcessorBuilder;
+import org.apache.camel.builder.ValueBuilder;
import org.apache.camel.model.language.ConstantExpression;
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.model.language.LanguageExpression;
@@ -1108,8 +1109,50 @@ public FilterDefinition filter(ExpressionDefinition expression) {
public FilterDefinition filter(String language, String expression) {
return filter(new LanguageExpression(language, expression));
}
+
+ /**
+ * Creates a validation expression which only if it is <tt>true</tt> then the
+ * exchange is forwarded to the destination.
+ * Otherwise a {@link org.apache.camel.processor.validation.PredicateValidationException} is thrown.
+ *
+ * @param expression the expression
+ * @return the builder
+ */
+ public ValidateDefinition validate(Expression expression) {
+ ValidateDefinition answer = new ValidateDefinition();
+ answer.setExpression(new ExpressionDefinition(expression));
+ addOutput(answer);
+ return answer;
+ }
/**
+ * Creates a validation expression which only if it is <tt>true</tt> then the
+ * exchange is forwarded to the destination.
+ * Otherwise a {@link org.apache.camel.processor.validation.PredicateValidationException} is thrown.
+ *
+ * @param predicate the predicate
+ * @return the builder
+ */
+ public ValidateDefinition validate(Predicate predicate) {
+ ValidateDefinition answer = new ValidateDefinition();
+ answer.setExpression(new ExpressionDefinition(predicate));
+ addOutput(answer);
+ return answer;
+ }
+
+ /**
+ * Creates a validation expression which only if it is <tt>true</tt> then the
+ * exchange is forwarded to the destination.
+ * Otherwise a {@link org.apache.camel.processor.validation.PredicateValidationException} is thrown.
+ *
+ * @return the builder
+ */
+ public ExpressionClause<ValidateDefinition> validate() {
+ ValidateDefinition answer = new ValidateDefinition();
+ addOutput(answer);
+ return ExpressionClause.createAndSetExpression(answer);
+ }
+ /**
* <a href="http://camel.apache.org/load-balancer.html">Load Balancer EIP:</a>
* Creates a loadbalance
*
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.camel.Processor;
+import org.apache.camel.processor.validation.PredicateValidatingProcessor;
+import org.apache.camel.spi.RouteContext;
+
+/**
+ * Represents an XML &lt;validate/&gt; element
+ *
+ * @version $Revision$
+ */
+@XmlRootElement(name = "validate")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ValidateDefinition extends ExpressionNode {
+
+ public ValidateDefinition() {
+ super();
+ }
+
+ @Override
+ public String toString() {
+ return "Validate[" + getExpression() + " -> " + getOutputs() + "]";
+ }
+
+ @Override
+ public String getShortName() {
+ return "validate";
+ }
+
+
+ @Override
+ public PredicateValidatingProcessor createProcessor(RouteContext routeContext) throws Exception {
+ Processor childProcessor = routeContext.createProcessor(this);
+ return new PredicateValidatingProcessor(getExpression().createPredicate(routeContext), childProcessor);
+ }
+
+}
Oops, something went wrong.

0 comments on commit 8a471f4

Please sign in to comment.