You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2015/07/14 22:19:13 UTC
[1/2] camel git commit: Update camel-core and apt to be "clean" in
eclipse with the latest eclipse checkstyle plugins
Repository: camel
Updated Branches:
refs/heads/master 344db6660 -> fdcf9182f
Update camel-core and apt to be "clean" in eclipse with the latest eclipse checkstyle plugins
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/17d39d90
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/17d39d90
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/17d39d90
Branch: refs/heads/master
Commit: 17d39d907d9d07e4d17032fdb6b09c697d82fd18
Parents: 344db66
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Jul 14 12:53:24 2015 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue Jul 14 14:01:54 2015 -0400
----------------------------------------------------------------------
.gitignore | 5 +-
.../org/apache/camel/impl/DefaultExchange.java | 2 +-
.../event/ExchangeFailureHandledEvent.java | 4 +-
.../mbean/ManagedPerformanceCounter.java | 4 +-
.../camel/model/LoadBalanceDefinition.java | 2 +-
.../apache/camel/model/MarshalDefinition.java | 70 ++++++++++----------
.../camel/model/ResequenceDefinition.java | 6 +-
.../apache/camel/model/UnmarshalDefinition.java | 70 ++++++++++----------
.../apache/camel/model/rest/VerbDefinition.java | 2 +-
.../processor/aggregate/AggregateProcessor.java | 32 ++++++---
.../aggregate/MemoryAggregationRepository.java | 8 ++-
.../apache/camel/util/CamelContextStatDump.java | 2 +-
.../apache/camel/util/CamelVersionHelper.java | 3 +
.../java/org/apache/camel/util/MessageDump.java | 4 +-
.../org/apache/camel/util/RouteStatDump.java | 2 +-
.../camel/component/bean/CamelCustomer.java | 4 ++
.../util/component/ApiMethodHelperTest.java | 20 ++++--
.../camel/tools/apt/DocumentationHelper.java | 3 +
18 files changed, 145 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 43d4e81..956cf21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,7 @@ test-salesforce-login.properties
dependency-reduced-pom.xml
id_file
components/camel-solr/data
-*.epoch
\ No newline at end of file
+*.epoch
+.factorypath
+.pmd
+
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
index 9707d00..05ffd76 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
@@ -80,7 +80,7 @@ public final class DefaultExchange implements Exchange {
@Override
public String toString() {
- return String.format("Exchange[%s][%s]", exchangeId, (out == null ? in : out));
+ return String.format("Exchange[%s][%s]", exchangeId, out == null ? in : out);
}
public Exchange copy() {
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/management/event/ExchangeFailureHandledEvent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/event/ExchangeFailureHandledEvent.java b/camel-core/src/main/java/org/apache/camel/management/event/ExchangeFailureHandledEvent.java
index 4aeae2c..862fb3a 100644
--- a/camel-core/src/main/java/org/apache/camel/management/event/ExchangeFailureHandledEvent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/event/ExchangeFailureHandledEvent.java
@@ -55,7 +55,9 @@ public class ExchangeFailureHandledEvent extends AbstractExchangeEvent {
return handled;
}
- public boolean isContinued() { return !handled; }
+ public boolean isContinued() {
+ return !handled;
+ }
@Override
public String toString() {
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
index fe1320c..f5124a8 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
@@ -109,7 +109,9 @@ public abstract class ManagedPerformanceCounter extends ManagedCounter implement
return exchangesFailed.getValue();
}
- public long getExchangesInflight() { return exchangesInflight.getValue(); }
+ public long getExchangesInflight() {
+ return exchangesInflight.getValue();
+ }
public long getFailuresHandled() throws Exception {
return failuresHandled.getValue();
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
index 97db364..e41e2c5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
@@ -57,7 +57,7 @@ public class LoadBalanceDefinition extends ProcessorDefinition<LoadBalanceDefini
@XmlElement(required = false, name = "topic", type = TopicLoadBalancerDefinition.class),
@XmlElement(required = false, name = "weighted", type = WeightedLoadBalancerDefinition.class),
@XmlElement(required = false, name = "circuitBreaker", type = CircuitBreakerLoadBalancerDefinition.class)}
- )
+ )
private LoadBalancerDefinition loadBalancerType;
@XmlElementRef
private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
index ddd53a4..4453ef5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
@@ -77,41 +77,41 @@ public class MarshalDefinition extends NoOutputDefinition<MarshalDefinition> {
// cannot use @XmlElementRef as it doesn't allow optional properties
@XmlElements({
- @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
- @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
- @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
- @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
- @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
- @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
- @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
- @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
- @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
- @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
- @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
- @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
- @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
- @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
- @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
- @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
- @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
- @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
- @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
- @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),
- @XmlElement(required = false, name = "soapjaxb", type = SoapJaxbDataFormat.class),
- @XmlElement(required = false, name = "string", type = StringDataFormat.class),
- @XmlElement(required = false, name = "syslog", type = SyslogDataFormat.class),
- @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
- @XmlElement(required = false, name = "univocity-csv", type = UniVocityCsvDataFormat.class),
- @XmlElement(required = false, name = "univocity-fixed", type = UniVocityFixedWidthDataFormat.class),
- @XmlElement(required = false, name = "univocity-tsv", type = UniVocityTsvDataFormat.class),
- @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
- @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
- @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
- @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
- @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
- @XmlElement(required = false, name = "zip", type = ZipDataFormat.class),
- @XmlElement(required = false, name = "zipFile", type = ZipFileDataFormat.class)}
- )
+ @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
+ @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
+ @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
+ @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+ @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
+ @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
+ @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
+ @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
+ @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
+ @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
+ @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
+ @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
+ @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
+ @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
+ @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
+ @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
+ @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
+ @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
+ @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
+ @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),
+ @XmlElement(required = false, name = "soapjaxb", type = SoapJaxbDataFormat.class),
+ @XmlElement(required = false, name = "string", type = StringDataFormat.class),
+ @XmlElement(required = false, name = "syslog", type = SyslogDataFormat.class),
+ @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
+ @XmlElement(required = false, name = "univocity-csv", type = UniVocityCsvDataFormat.class),
+ @XmlElement(required = false, name = "univocity-fixed", type = UniVocityFixedWidthDataFormat.class),
+ @XmlElement(required = false, name = "univocity-tsv", type = UniVocityTsvDataFormat.class),
+ @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
+ @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
+ @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
+ @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
+ @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
+ @XmlElement(required = false, name = "zip", type = ZipDataFormat.class),
+ @XmlElement(required = false, name = "zipFile", type = ZipFileDataFormat.class)}
+ )
private DataFormatDefinition dataFormatType;
@XmlAttribute
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
index c6b6ed5..f74abee 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
@@ -53,9 +53,9 @@ import org.apache.camel.util.ObjectHelper;
public class ResequenceDefinition extends ProcessorDefinition<ResequenceDefinition> {
@Metadata(required = "false")
@XmlElements({
- @XmlElement(name = "batch-config", type = BatchResequencerConfig.class),
- @XmlElement(name = "stream-config", type = StreamResequencerConfig.class)}
- )
+ @XmlElement(name = "batch-config", type = BatchResequencerConfig.class),
+ @XmlElement(name = "stream-config", type = StreamResequencerConfig.class)}
+ )
private ResequencerConfig resequencerConfig;
@XmlTransient
private BatchResequencerConfig batchConfig;
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
index de2684f..1914a49 100644
--- a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
@@ -77,41 +77,41 @@ public class UnmarshalDefinition extends NoOutputDefinition<UnmarshalDefinition>
// cannot use @XmlElementRef as it doesn't allow optional properties
@XmlElements({
- @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
- @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
- @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
- @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
- @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
- @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
- @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
- @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
- @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
- @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
- @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
- @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
- @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
- @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
- @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
- @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
- @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
- @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
- @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
- @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),
- @XmlElement(required = false, name = "soapjaxb", type = SoapJaxbDataFormat.class),
- @XmlElement(required = false, name = "string", type = StringDataFormat.class),
- @XmlElement(required = false, name = "syslog", type = SyslogDataFormat.class),
- @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
- @XmlElement(required = false, name = "univocity-csv", type = UniVocityCsvDataFormat.class),
- @XmlElement(required = false, name = "univocity-fixed", type = UniVocityFixedWidthDataFormat.class),
- @XmlElement(required = false, name = "univocity-tsv", type = UniVocityTsvDataFormat.class),
- @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
- @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
- @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
- @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
- @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
- @XmlElement(required = false, name = "zip", type = ZipDataFormat.class),
- @XmlElement(required = false, name = "zipFile", type = ZipFileDataFormat.class)}
- )
+ @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
+ @XmlElement(required = false, name = "base64", type = Base64DataFormat.class),
+ @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
+ @XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
+ @XmlElement(required = false, name = "boon", type = BoonDataFormat.class),
+ @XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
+ @XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
+ @XmlElement(required = false, name = "csv", type = CsvDataFormat.class),
+ @XmlElement(required = false, name = "custom", type = CustomDataFormat.class),
+ @XmlElement(required = false, name = "flatpack", type = FlatpackDataFormat.class),
+ @XmlElement(required = false, name = "gzip", type = GzipDataFormat.class),
+ @XmlElement(required = false, name = "hl7", type = HL7DataFormat.class),
+ @XmlElement(required = false, name = "ical", type = IcalDataFormat.class),
+ @XmlElement(required = false, name = "jaxb", type = JaxbDataFormat.class),
+ @XmlElement(required = false, name = "jibx", type = JibxDataFormat.class),
+ @XmlElement(required = false, name = "json", type = JsonDataFormat.class),
+ @XmlElement(required = false, name = "protobuf", type = ProtobufDataFormat.class),
+ @XmlElement(required = false, name = "rss", type = RssDataFormat.class),
+ @XmlElement(required = false, name = "secureXML", type = XMLSecurityDataFormat.class),
+ @XmlElement(required = false, name = "serialization", type = SerializationDataFormat.class),
+ @XmlElement(required = false, name = "soapjaxb", type = SoapJaxbDataFormat.class),
+ @XmlElement(required = false, name = "string", type = StringDataFormat.class),
+ @XmlElement(required = false, name = "syslog", type = SyslogDataFormat.class),
+ @XmlElement(required = false, name = "tidyMarkup", type = TidyMarkupDataFormat.class),
+ @XmlElement(required = false, name = "univocity-csv", type = UniVocityCsvDataFormat.class),
+ @XmlElement(required = false, name = "univocity-fixed", type = UniVocityFixedWidthDataFormat.class),
+ @XmlElement(required = false, name = "univocity-tsv", type = UniVocityTsvDataFormat.class),
+ @XmlElement(required = false, name = "xmlBeans", type = XMLBeansDataFormat.class),
+ @XmlElement(required = false, name = "xmljson", type = XmlJsonDataFormat.class),
+ @XmlElement(required = false, name = "xmlrpc", type = XmlRpcDataFormat.class),
+ @XmlElement(required = false, name = "xstream", type = XStreamDataFormat.class),
+ @XmlElement(required = false, name = "pgp", type = PGPDataFormat.class),
+ @XmlElement(required = false, name = "zip", type = ZipDataFormat.class),
+ @XmlElement(required = false, name = "zipFile", type = ZipFileDataFormat.class)}
+ )
private DataFormatDefinition dataFormatType;
@XmlAttribute
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 7438680..9c1fef8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -81,7 +81,7 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
@XmlElements({
@XmlElement(required = false, name = "to", type = ToDefinition.class),
@XmlElement(required = false, name = "route", type = RouteDefinition.class)}
- )
+ )
private OptionalIdentifiedDefinition<?> toOrRoute;
// the Java DSL uses the to or route definition directory
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
index fbec104..d08cfd9 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
@@ -1015,11 +1015,15 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
@Override
public void purge() {
// must acquire the shared aggregation lock to be able to purge
- if (!optimisticLocking) { lock.lock(); }
+ if (!optimisticLocking) {
+ lock.lock();
+ }
try {
super.purge();
} finally {
- if (!optimisticLocking) { lock.unlock(); }
+ if (!optimisticLocking) {
+ lock.unlock();
+ }
}
}
@@ -1078,7 +1082,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
if (keys != null && !keys.isEmpty()) {
// must acquire the shared aggregation lock to be able to trigger interval completion
- if (!optimisticLocking) { lock.lock(); }
+ if (!optimisticLocking) {
+ lock.lock();
+ }
try {
for (String key : keys) {
boolean stolenInterval = false;
@@ -1103,7 +1109,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
}
}
} finally {
- if (!optimisticLocking) { lock.unlock(); }
+ if (!optimisticLocking) {
+ lock.unlock();
+ }
}
}
@@ -1395,7 +1403,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
// must acquire the shared aggregation lock to be able to trigger force completion
int total = 0;
- if (!optimisticLocking) { lock.lock(); }
+ if (!optimisticLocking) {
+ lock.lock();
+ }
try {
Exchange exchange = aggregationRepository.get(camelContext, key);
if (exchange != null) {
@@ -1409,7 +1419,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
}
}
} finally {
- if (!optimisticLocking) { lock.unlock(); }
+ if (!optimisticLocking) {
+ lock.unlock();
+ }
}
LOG.trace("Completed force completion of group {}", key);
@@ -1436,7 +1448,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
int total = 0;
if (keys != null && !keys.isEmpty()) {
// must acquire the shared aggregation lock to be able to trigger force completion
- if (!optimisticLocking) { lock.lock(); }
+ if (!optimisticLocking) {
+ lock.lock();
+ }
total = keys.size();
try {
for (String key : keys) {
@@ -1452,7 +1466,9 @@ public class AggregateProcessor extends ServiceSupport implements AsyncProcessor
}
}
} finally {
- if (!optimisticLocking) { lock.unlock(); }
+ if (!optimisticLocking) {
+ lock.unlock();
+ }
}
}
LOG.trace("Completed force completion of all groups task");
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
index 78c17bb..430055d 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/MemoryAggregationRepository.java
@@ -46,7 +46,9 @@ public class MemoryAggregationRepository extends ServiceSupport implements Optim
}
public Exchange add(CamelContext camelContext, String key, Exchange oldExchange, Exchange newExchange) {
- if (!optimisticLocking) { throw new UnsupportedOperationException(); }
+ if (!optimisticLocking) {
+ throw new UnsupportedOperationException();
+ }
if (oldExchange == null) {
if (cache.putIfAbsent(key, newExchange) != null) {
throw new OptimisticLockingException();
@@ -60,7 +62,9 @@ public class MemoryAggregationRepository extends ServiceSupport implements Optim
}
public Exchange add(CamelContext camelContext, String key, Exchange exchange) {
- if (optimisticLocking) { throw new UnsupportedOperationException(); }
+ if (optimisticLocking) {
+ throw new UnsupportedOperationException();
+ }
return cache.put(key, exchange);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/util/CamelContextStatDump.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/CamelContextStatDump.java b/camel-core/src/main/java/org/apache/camel/util/CamelContextStatDump.java
index ebe539a..b25b71c 100644
--- a/camel-core/src/main/java/org/apache/camel/util/CamelContextStatDump.java
+++ b/camel-core/src/main/java/org/apache/camel/util/CamelContextStatDump.java
@@ -107,7 +107,7 @@ public final class CamelContextStatDump {
@XmlElementWrapper(name = "routeStats")
@XmlElements({
@XmlElement(type = RouteStatDump.class, name = "routeStat")
- })
+ })
private List<RouteStatDump> routeStats;
public String getId() {
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java b/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java
index 368b4c7..5c630b2 100644
--- a/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java
@@ -20,6 +20,9 @@ package org.apache.camel.util;
* A simple util to test Camel versions.
*/
public final class CamelVersionHelper {
+ private CamelVersionHelper() {
+ //utility class, never constructed
+ }
/**
* Checks whether other >= base
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/util/MessageDump.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageDump.java b/camel-core/src/main/java/org/apache/camel/util/MessageDump.java
index a9edffc..ee55f45 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageDump.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageDump.java
@@ -110,8 +110,8 @@ public final class MessageDump {
@XmlElementWrapper(name = "headers")
@XmlElements({
- @XmlElement(type = Header.class, name = "header")
- })
+ @XmlElement(type = Header.class, name = "header")
+ })
private List<Header> headers;
@XmlElementRef
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/main/java/org/apache/camel/util/RouteStatDump.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/RouteStatDump.java b/camel-core/src/main/java/org/apache/camel/util/RouteStatDump.java
index d27f4b8..8531195 100644
--- a/camel-core/src/main/java/org/apache/camel/util/RouteStatDump.java
+++ b/camel-core/src/main/java/org/apache/camel/util/RouteStatDump.java
@@ -107,7 +107,7 @@ public final class RouteStatDump {
@XmlElementWrapper(name = "processorStats")
@XmlElements({
@XmlElement(type = ProcessorStatDump.class, name = "processorStat")
- })
+ })
private List<ProcessorStatDump> processorStats;
public String getId() {
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java b/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
index 1464280..ea6a401 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/CamelCustomer.java
@@ -17,6 +17,10 @@
package org.apache.camel.component.bean;
public class CamelCustomer {
+ public CamelCustomer() {
+ }
+ public void extraMethod() {
+ }
public static boolean isGoldCustomer(String body) {
return body.contains("Camel");
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java
index 19dd76d..219b6c2 100644
--- a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java
@@ -193,19 +193,29 @@ public class ApiMethodHelperTest {
}
@Override
- public String getName() { return apiMethod.getName(); }
+ public String getName() {
+ return apiMethod.getName();
+ }
@Override
- public Class<?> getResultType() { return apiMethod.getResultType(); }
+ public Class<?> getResultType() {
+ return apiMethod.getResultType();
+ }
@Override
- public List<String> getArgNames() { return apiMethod.getArgNames(); }
+ public List<String> getArgNames() {
+ return apiMethod.getArgNames();
+ }
@Override
- public List<Class<?>> getArgTypes() { return apiMethod.getArgTypes(); }
+ public List<Class<?>> getArgTypes() {
+ return apiMethod.getArgTypes();
+ }
@Override
- public Method getMethod() { return apiMethod.getMethod(); }
+ public Method getMethod() {
+ return apiMethod.getMethod();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/17d39d90/tooling/apt/src/main/java/org/apache/camel/tools/apt/DocumentationHelper.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/DocumentationHelper.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/DocumentationHelper.java
index 61daf5d..6de021d 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/DocumentationHelper.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/DocumentationHelper.java
@@ -32,6 +32,9 @@ import static org.apache.camel.tools.apt.JsonSchemaHelper.parseJsonSchema;
* Helper to find documentation for inherited options when a component extends another.
*/
public final class DocumentationHelper {
+ private DocumentationHelper() {
+ //utility class, never constructed
+ }
public static String findComponentJavaDoc(String scheme, String extendsScheme, String fieldName) {
File file = jsonFile(scheme, extendsScheme);
[2/2] camel git commit: [CAMEL-8969] Add start of camel-coap component
Posted by dk...@apache.org.
[CAMEL-8969] Add start of camel-coap component
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fdcf9182
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fdcf9182
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fdcf9182
Branch: refs/heads/master
Commit: fdcf9182fb59929dd9239406f1db6dc8bc0c22b3
Parents: 17d39d9
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Jul 14 13:00:36 2015 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Tue Jul 14 16:18:15 2015 -0400
----------------------------------------------------------------------
components/camel-coap/pom.xml | 71 +++++++++++++++
.../org/apache/camel/coap/CoAPComponent.java | 93 ++++++++++++++++++++
.../org/apache/camel/coap/CoAPConsumer.java | 80 +++++++++++++++++
.../org/apache/camel/coap/CoAPEndpoint.java | 76 ++++++++++++++++
.../org/apache/camel/coap/CoAPProducer.java | 40 +++++++++
.../services/org/apache/camel/component/coap | 1 +
.../apache/camel/coap/CoAPComponentTest.java | 49 +++++++++++
.../src/test/resources/log4j.properties | 14 +++
...elSpringDelegatingTestContextLoaderTest.java | 2 +-
components/pom.xml | 1 +
10 files changed, 426 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-coap/pom.xml b/components/camel-coap/pom.xml
new file mode 100644
index 0000000..fe51b5e
--- /dev/null
+++ b/components/camel-coap/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>components</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <version>2.16-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-coap</artifactId>
+ <packaging>bundle</packaging>
+ <version>2.16-SNAPSHOT</version>
+
+ <name>Camel :: CoAP</name>
+ <url>http://www.myorganization.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <camel.osgi.export>
+ org.apache.camel.component.coap;${camel.osgi.version},
+ </camel.osgi.export>
+ <camel.osgi.import>
+ !org.apache.camel.component.coap,
+ *
+ </camel.osgi.import>
+ <camel.osgi.export.service>
+ org.apache.camel.spi.ComponentResolver;component=coap
+ </camel.osgi.export.service>
+
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.californium</groupId>
+ <artifactId>californium-core</artifactId>
+ <version>1.0.0-M3</version>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
new file mode 100644
index 0000000..15ac123
--- /dev/null
+++ b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPComponent.java
@@ -0,0 +1,93 @@
+/**
+ * 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.coap;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.RestConsumerFactory;
+import org.eclipse.californium.core.CoapServer;
+import org.eclipse.californium.core.network.config.NetworkConfig;
+
+/**
+ * Represents the component that manages {@link CoAPEndpoint}.
+ */
+public class CoAPComponent extends UriEndpointComponent implements RestConsumerFactory {
+ final Map<Integer, CoapServer> servers = new ConcurrentHashMap<>();
+
+ public CoAPComponent() {
+ super(CoAPEndpoint.class);
+ }
+
+ public CoAPComponent(CamelContext context) {
+ super(context, CoAPEndpoint.class);
+ }
+
+ public synchronized CoapServer getServer(int port) {
+ CoapServer server = servers.get(port);
+ if (server == null) {
+ NetworkConfig config = new NetworkConfig();
+ //FIXME- configure the network stuff
+ server = new CoapServer(config, port);
+ servers.put(port, server);
+ if (this.isStarted()) {
+ server.start();
+ }
+ }
+ return server;
+ }
+
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ Endpoint endpoint = new CoAPEndpoint(uri, this);
+ setProperties(endpoint, parameters);
+ return endpoint;
+ }
+
+ @Override
+ public Consumer createConsumer(CamelContext camelContext,
+ Processor processor,
+ String verb,
+ String basePath,
+ String uriTemplate,
+ String consumes,
+ String produces,
+ Map<String, Object> parameters) throws Exception {
+ return null;
+ }
+
+
+ @Override
+ protected void doStart() throws Exception {
+ super.doStart();
+ for (CoapServer s : servers.values()) {
+ s.start();
+ }
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ for (CoapServer s : servers.values()) {
+ s.stop();
+ }
+ super.doStop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPConsumer.java b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPConsumer.java
new file mode 100644
index 0000000..fc7c0a3
--- /dev/null
+++ b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPConsumer.java
@@ -0,0 +1,80 @@
+/**
+ * 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.coap;
+
+
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+import org.eclipse.californium.core.CoapResource;
+import org.eclipse.californium.core.coap.CoAP.ResponseCode;
+import org.eclipse.californium.core.network.Exchange;
+import org.eclipse.californium.core.server.resources.CoapExchange;
+
+/**
+ * The CoAP consumer.
+ */
+public class CoAPConsumer extends DefaultConsumer {
+ private final CoAPEndpoint endpoint;
+ private CoapResource resource;
+
+ public CoAPConsumer(final CoAPEndpoint endpoint, final Processor processor) {
+ super(endpoint, processor);
+ this.endpoint = endpoint;
+
+ String path = endpoint.getUri().getPath();
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+
+ this.resource = new CoapResource(path) {
+
+ @Override
+ public void handleRequest(Exchange exchange) {
+ CoapExchange cexchange = new CoapExchange(exchange, this);
+ org.apache.camel.Exchange camelExchange = endpoint.createExchange();
+ byte bytes[] = exchange.getCurrentRequest().getPayload();
+ camelExchange.getIn().setBody(bytes);
+ try {
+ processor.process(camelExchange);
+
+
+ Message target = camelExchange.hasOut() ? camelExchange.getOut() : camelExchange.getIn();
+
+ cexchange.respond(ResponseCode.CONTENT, target.getBody(byte[].class));
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ };
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ super.doStart();
+ endpoint.getCoapServer().add(resource);
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ endpoint.getCoapServer().remove(resource);
+ super.doStop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
new file mode 100644
index 0000000..5cc63ca
--- /dev/null
+++ b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPEndpoint.java
@@ -0,0 +1,76 @@
+/**
+ * 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.coap;
+
+import java.net.URI;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
+import org.eclipse.californium.core.CoapServer;
+
+/**
+ * Represents a CoAP endpoint.
+ */
+@UriEndpoint(scheme = "coap", title = "CoAP", syntax = "coap:name", consumerClass = CoAPConsumer.class, label = "CoAP")
+public class CoAPEndpoint extends DefaultEndpoint {
+ @UriPath
+ private URI uri;
+
+
+ private CoAPComponent component;
+
+ public CoAPEndpoint(String uri, CoAPComponent component) {
+ super(uri, component);
+ try {
+ this.uri = new URI(uri);
+ } catch (java.net.URISyntaxException use) {
+ this.uri = null;
+ }
+ this.component = component;
+ }
+
+ public Producer createProducer() throws Exception {
+ return new CoAPProducer(this);
+ }
+
+ public Consumer createConsumer(Processor processor) throws Exception {
+ return new CoAPConsumer(this, processor);
+ }
+
+ public boolean isSingleton() {
+ return true;
+ }
+
+ public void setUri(URI u) {
+ uri = u;
+ }
+
+ /**
+ * The URI for the CoAP endpoint
+ */
+ public URI getUri() {
+ return uri;
+ }
+
+ public CoapServer getCoapServer() {
+ return component.getServer(getUri().getPort());
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
new file mode 100644
index 0000000..70ab363
--- /dev/null
+++ b/components/camel-coap/src/main/java/org/apache/camel/coap/CoAPProducer.java
@@ -0,0 +1,40 @@
+/**
+ * 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.coap;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultProducer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The CoAP producer.
+ */
+public class CoAPProducer extends DefaultProducer {
+ private static final Logger LOG = LoggerFactory.getLogger(CoAPProducer.class);
+ private CoAPEndpoint endpoint;
+
+ public CoAPProducer(CoAPEndpoint endpoint) {
+ super(endpoint);
+ this.endpoint = endpoint;
+ }
+
+ public void process(Exchange exchange) throws Exception {
+ System.out.println(exchange.getIn().getBody());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/main/resources/META-INF/services/org/apache/camel/component/coap
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/resources/META-INF/services/org/apache/camel/component/coap b/components/camel-coap/src/main/resources/META-INF/services/org/apache/camel/component/coap
new file mode 100644
index 0000000..9dfaa26
--- /dev/null
+++ b/components/camel-coap/src/main/resources/META-INF/services/org/apache/camel/component/coap
@@ -0,0 +1 @@
+class=org.apache.camel.coap.CoAPComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTest.java b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTest.java
new file mode 100644
index 0000000..0000f8c
--- /dev/null
+++ b/components/camel-coap/src/test/java/org/apache/camel/coap/CoAPComponentTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.coap;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.eclipse.californium.core.CoapClient;
+import org.eclipse.californium.core.CoapResponse;
+import org.eclipse.californium.core.network.config.NetworkConfig;
+import org.junit.Test;
+
+public class CoAPComponentTest extends CamelTestSupport {
+
+ @Test
+ public void testCoAP() throws Exception {
+ NetworkConfig.createStandardWithoutFile();
+ CoapClient client = new CoapClient("coap://localhost:7777/TestResource");
+ CoapResponse rsp = client.get();
+ assertEquals("Hello ", rsp.getResponseText());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("coap://localhost:7777/TestResource")
+ .convertBodyTo(String.class)
+ .to("log:exch")
+ .transform(body().prepend("Hello "))
+ .to("log:exch");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-coap/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/test/resources/log4j.properties b/components/camel-coap/src/test/resources/log4j.properties
new file mode 100644
index 0000000..3b1bd38
--- /dev/null
+++ b/components/camel-coap/src/test/resources/log4j.properties
@@ -0,0 +1,14 @@
+#
+# The logging properties used
+#
+log4j.rootLogger=INFO, out
+
+# uncomment the following line to turn on Camel debugging
+#log4j.logger.org.apache.camel=DEBUG
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java
index a5092fe..4150fc3 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/CamelSpringDelegatingTestContextLoaderTest.java
@@ -41,7 +41,7 @@ import org.springframework.test.context.ContextConfiguration;
classes = {CamelSpringDelegatingTestContextLoaderTest.TestConfig.class},
// Since Camel 2.11.0
loader = CamelSpringDelegatingTestContextLoader.class
-)
+ )
@MockEndpoints
public class CamelSpringDelegatingTestContextLoaderTest {
@EndpointInject(uri = "mock:direct:end")
http://git-wip-us.apache.org/repos/asf/camel/blob/fdcf9182/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 0a6c3b5..7982b57 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -80,6 +80,7 @@
<module>camel-cdi</module>
<module>camel-chunk</module>
<module>camel-cmis</module>
+ <module>camel-coap</module>
<module>camel-cometd</module>
<module>camel-context</module>
<module>camel-couchdb</module>