git commit: Polished the code base of the new Camel Weather component.
Updated Branches: refs/heads/master 1995e574c -> 46a43b371 Polished the code base of the new Camel Weather component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/46a43b37 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/46a43b37 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/46a43b37 Branch: refs/heads/master Commit: 46a43b371a0b19ac0c546ca000f9565b0777e738 Parents: 1995e57 Author: Babak Vahdat Authored: Tue May 28 07:45:53 2013 +0200 Committer: Babak Vahdat Committed: Tue May 28 07:45:53 2013 +0200 -- .../component/weather/WeatherConfiguration.java| 17 --- .../camel/component/weather/WeatherEndpoint.java |6 ++-- .../component/weather/BaseWeatherConsumerTest.java |1 + 3 files changed, 13 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/46a43b37/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java index 08066e1..0496951 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java @@ -35,7 +35,7 @@ public class WeatherConfiguration { private String period = ""; @UriParam private WeatherUnits units = METRIC; -private WeatherComponent component; +private final WeatherComponent component; public WeatherConfiguration(WeatherComponent component) { this.component = notNull(component, "component"); @@ -75,8 +75,9 @@ public class WeatherConfiguration { } public String getQuery() throws Exception { -String result = "http://api.openweathermap.org/data/2.5/";; -String location = ""; +String answer = "http://api.openweathermap.org/data/2.5/";; + +String location; if (isEmpty(getLocation())) { location = getGeoLocation(); } else { @@ -85,13 +86,13 @@ public class WeatherConfiguration { } if (isEmpty(getPeriod())) { -result += "weather?" + location; +answer += "weather?" + location; } else { -result += "forecast/daily?" + location + "&cnt=" + getPeriod(); +answer += "forecast/daily?" + location + "&cnt=" + getPeriod(); } -result += "&units=" + units.name().toLowerCase(); +answer += "&units=" + units.name().toLowerCase(); -return result; +return answer; } private String getGeoLocation() throws Exception { @@ -105,6 +106,6 @@ public class WeatherConfiguration { JsonNode latitudeNode = notNull(node.get("latitude"), "latitude"); JsonNode longitudeNode = notNull(node.get("longitude"), "longitude"); -return "lat=" + latitudeNode.toString() + "&lon=" + longitudeNode.toString(); +return "lat=" + latitudeNode + "&lon=" + longitudeNode; } } http://git-wip-us.apache.org/repos/asf/camel/blob/46a43b37/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java index a23cd42..b70a4fa 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java @@ -27,7 +27,7 @@ import org.apache.camel.spi.UriParam; */ public class WeatherEndpoint extends DefaultPollingEndpoint { @UriParam -private WeatherConfiguration configuration; +private final WeatherConfiguration configuration; public WeatherEndpoint(String uri, WeatherComponent component, WeatherConfiguration properties) { super(uri, component); @@ -48,8 +48,8 @@ public class WeatherEndpoint extends DefaultPollingEndpoint { public Consumer createConsumer(Processor processor) throws Exception { WeatherConsumer answer = new WeatherConsumer(this, processor, this.configuration.getQuery()); -// ScheduledPollConsumer default delay is 500 millis and that is too often for polling a feed, -// so we override with a new default value. End user can override this value by providing a consumer.delay parameter +
git commit: Polished the code base of the new Camel Weather component.
Updated Branches: refs/heads/master 46a43b371 -> b5902106e Polished the code base of the new Camel Weather component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b5902106 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b5902106 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b5902106 Branch: refs/heads/master Commit: b5902106e9b6f85c216e9e788845b2ab4941d5ee Parents: 46a43b3 Author: Babak Vahdat Authored: Tue May 28 07:55:12 2013 +0200 Committer: Babak Vahdat Committed: Tue May 28 07:55:12 2013 +0200 -- .../camel/component/weather/WeatherConsumer.java | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b5902106/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConsumer.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConsumer.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConsumer.java index d8a906f..d4a36cb 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConsumer.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConsumer.java @@ -38,14 +38,14 @@ public class WeatherConsumer extends ScheduledPollConsumer { @Override protected int poll() throws Exception { LOG.debug("Going to execute the query '{}'", query); -String answer = getEndpoint().getCamelContext().getTypeConverter().mandatoryConvertTo(String.class, new URL(query)); -LOG.debug("Got back the answer '{}'", answer); -if (ObjectHelper.isEmpty(answer)) { -throw new IllegalStateException("Got the empty string '" + answer + "' as the result of the query '" + query + "'"); +String weather = getEndpoint().getCamelContext().getTypeConverter().mandatoryConvertTo(String.class, new URL(query)); +LOG.debug("Got back the answer '{}'", weather); +if (ObjectHelper.isEmpty(weather)) { +throw new IllegalStateException("Got the empty string '" + weather + "' as the result of the query '" + query + "'"); } Exchange exchange = getEndpoint().createExchange(); -exchange.getIn().setBody(answer); +exchange.getIn().setBody(weather); exchange.getIn().setHeader(WeatherConstants.WEATHER_QUERY, query); getProcessor().process(exchange);
svn commit: r863399 - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache properties.html using-propertyplaceholder.html
Author: buildbot Date: Tue May 28 05:27:31 2013 New Revision: 863399 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-component-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/properties.html websites/production/camel/content/using-propertyplaceholder.html Modified: websites/production/camel/content/book-component-appendix.html == --- websites/production/camel/content/book-component-appendix.html (original) +++ websites/production/camel/content/book-component-appendix.html Tue May 28 05:27:31 2013 @@ -14240,6 +14240,26 @@ destination=mock:result Notice how the hello bean is using pure Spring property placeholders using the ${ } notation. And in the Camel routes we use the Camel placeholder notation with {{ }}. +Clashing Spring property placeholders with Camels Simple language +Take notice when using Spring bridging placeholder then the spring ${ } syntax clashes with the Simple in Camel, and therefore take care. For example: + + ++ + + +clashes with Spring property placeholders, and you should use $simple{ } to indicate using the Simple language in Camel. + + +{{file.rootdir}}/${in.header.CamelFileName} ++ + + + +An alternative is to configure the PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders option to true. + Overriding properties from Camel test kit Available as of Camel 2.10 Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Tue May 28 05:27:31 2013 @@ -35293,6 +35293,26 @@ destination=mock:result Notice how the hello bean is using pure Spring property placeholders using the ${ } notation. And in the Camel routes we use the Camel placeholder notation with {{ }}. +Clashing Spring property placeholders with Camels Simple language +Take notice when using Spring bridging placeholder then the spring ${ } syntax clashes with the Simple in Camel, and therefore take care. For example: + + +{{file.rootdir}}/$simple{in.header.CamelFileName} ++ + + +clashes with Spring property placeholders, and you should use $simple{ } to indicate using the Simple language in Camel. + + +{{file.rootdir}}/${in.header.CamelFileName} ++ + + + +An alternative is to configure the PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders option to true. + Overriding properties from Camel test kit Available as of Camel 2.10 Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/properties.html == --- websites/production/camel/content/properties.html (original) +++ websites/production/camel/content/properties.html Tue May 28 05:27:31 2013 @@ -758,6 +758,26 @@ destination=mock:result Notice how the hello bean is using pure Spring property placeholders using the ${ } notation. And in the Camel routes we use the Camel placeholder notation with {{ }}. +Clashing Spring property placeholders with Camels Simple language +Take notice when using Spring bridging placeholder then the spring ${ } syntax clashes with the Simple in Camel, and therefore take care. For example: + + +{{file.rootdir}}/$simple{in.header.CamelFileName} ++ + + +clashes with Spring property placeholders, and you should use $simple{ } to indicate using the Simple language in Camel. + + +{{file.rootdir}}/${in.header.CamelFileName} ++ + + + +An alternative is to configure the PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders option to true. + Overriding properties from Camel test kit Available as of Camel 2.10 Modified: websites/production/camel/content/using-propertyplaceholder.html == --- websites/production/camel/content/using-propertyplaceholder.html (original) +++ websites/production/camel/content/using-propertyplaceholder.html Tue May 28 05:27:31 2013 @@ -737,6 +737,26 @@ destination=mock:resul{{file.rootdir}}/$simple{in.header.CamelFileName} +
[CONF] Apache Camel > Using PropertyPlaceholder
Using PropertyPlaceholder Page edited by Claus Ibsen Changes (2) ... Notice how the hello bean is using pure Spring property placeholders using the ${ } notation. And in the Camel routes we use the Camel placeholder notation with {{ }}. h4. Clashing Spring property placeholders with Camels [Simple] language Take notice when using Spring bridging placeholder then the spring ${ } syntax clashes with the [Simple] in Camel, and therefore take care. For example: {code}{{file.rootdir}}/${in.header.CamelFileName} {code} clashes with Spring property placeholders, and you should use $simple{ } to indicate using the [Simple] language in Camel. {code}{{file.rootdir}}/$simple{in.header.CamelFileName} {code} An alternative is to configure the {{PropertyPlaceholderConfigurer}} with {{ignoreUnresolvablePlaceholders}} option to {{true}}. h3. Overriding properties from Camel test kit *Available as of Camel 2.10* ... Full Content Using PropertyPlaceholder Available as of Camel 2.3 Camel now provides a new PropertiesComponent in camel-core which allows you to use property placeholders when defining Camel Endpoint URIs. This works much like you would do if using Spring's tag. However Spring have a limitation which prevents 3rd party frameworks to leverage Spring property placeholders to the fullest. See more at How do I use Spring Property Placeholder with Camel XML. Bridging Spring and Camel property placeholdersFrom Camel 2.10 onwards, you can bridge the Spring property placeholder with Camel, see further below for more details. The property placeholder is generally in use when doing: lookup or creating endpoints lookup of beans in the Registry additional supported in Spring XML (see below in examples) using Blueprint PropertyPlaceholder with Camel Properties component Syntax The syntax to use Camel's property placeholder is to use {{key}} for example {{file.uri}} where file.uri is the property key. You can use property placeholders in parts of the endpoint URI's which for example you can use placeholders for parameters in the URIs. PropertyResolver Camel provides a pluggable mechanism which allows 3rd part to provide their own resolver to lookup properties. Camel provides a default implementation org.apache.camel.component.properties.DefaultPropertiesResolver which is capable of loading properties from the file system, classpath or Registry. You can prefix the locations with either: ref: Camel 2.4: to lookup in the Registry file: to load the from file system classpath: to load from classpath (this is also the default if no prefix is provided) blueprint: Camel 2.7: to use a specific OSGi blueprint placeholder service Defining location The PropertiesResolver need to know a location(s) where to resolve the properties. You can define 1 to many locations. If you define the location in a single String property you can separate multiple locations with comma such as: pc.setLocation("com/mycompany/myprop.properties,com/mycompany/other.properties"); Using system and environment variables in locations Available as of Camel 2.7 The location now supports using placeholders for JVM system properties and OS environments variables. For example: location=file:${karaf.home}/etc/foo.properties In the location above we defined a location using the file scheme using the JVM system property with key karaf.home. To use an OS environment variable instead you would have to prefix with env: location=file:${env:APP_HOME}/etc/foo.properties Where APP_HOME is an OS environment. You can have multiple placeholders in the same location, such as: location=file:${env:APP_HOME}/etc/${prop.name}.properties Configuring in Java DSL You have to create and register the PropertiesComponent under the name properties such as: PropertiesComponent pc = new PropertiesComponent(); pc.setLocation("classpath:com/mycompany/myprop.properties"); context.addComponent("properties", pc); Configuring in Spring XML Spring XML offers two variations to configure. You can define a spring bean as a PropertiesComponent which resembles the way done in Java DSL. Or you can use the tag. "properties" class="org.apache.camel.component.properties.PropertiesComponent"> "location" value="classpath:com/mycompany/myprop.properties"/> Using the tag makes the configuration a bit more fresh such as: "properties" location="com/mycompany/myprop.properties"/> Specifying the cache option inside XMLCamel 2.10 onwards supports specifying a value for the cache option both inside the Spring as well as the Blueprint XML. Using a Properties from the Registry Available as of Camel 2.4 For example in OSGi you may want to expose
git commit: CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch
Updated Branches: refs/heads/camel-2.10.x 8d97a4711 -> e28ff6849 CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e28ff684 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e28ff684 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e28ff684 Branch: refs/heads/camel-2.10.x Commit: e28ff684957954684b591807fb315bcda0eb2bfd Parents: 8d97a47 Author: cmueller Authored: Mon May 27 23:10:38 2013 +0200 Committer: cmueller Committed: Mon May 27 23:18:47 2013 +0200 -- .../java/org/apache/camel/util/GZIPHelper.java |4 +--- .../camel/component/http4/HttpEntityConverter.java | 10 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e28ff684/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java index d615260..c016d9a 100644 --- a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java @@ -42,9 +42,8 @@ public final class GZIPHelper { return in; } } - -public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { +public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { if (isGzip(contentEncoding)) { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(os); @@ -59,7 +58,6 @@ public final class GZIPHelper { } else { return in; } - } public static InputStream compressGzip(String contentEncoding, byte[] data) throws IOException { http://git-wip-us.apache.org/repos/asf/camel/blob/e28ff684/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java -- diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java index 5991e65..e88ceb5 100644 --- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java +++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java @@ -61,7 +61,9 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, in), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, in); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { entity = new InputStreamEntity(in, -1); } @@ -78,9 +80,11 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, data), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, data); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { -entity = new InputStreamEntity(new ByteArrayInputStream(data), -1); +entity = new InputStreamEntity(new ByteArrayInputStream(data), data.length); } if (exchange != null) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
git commit: CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch
Updated Branches: refs/heads/camel-2.11.x 01fa3b52f -> 5438802c8 CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5438802c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5438802c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5438802c Branch: refs/heads/camel-2.11.x Commit: 5438802c8b13a1d53f9339540b664130be57cce5 Parents: 01fa3b5 Author: cmueller Authored: Mon May 27 23:10:38 2013 +0200 Committer: cmueller Committed: Mon May 27 23:14:40 2013 +0200 -- .../java/org/apache/camel/util/GZIPHelper.java |4 +--- .../camel/component/http4/HttpEntityConverter.java | 10 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5438802c/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java index d615260..c016d9a 100644 --- a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java @@ -42,9 +42,8 @@ public final class GZIPHelper { return in; } } - -public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { +public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { if (isGzip(contentEncoding)) { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(os); @@ -59,7 +58,6 @@ public final class GZIPHelper { } else { return in; } - } public static InputStream compressGzip(String contentEncoding, byte[] data) throws IOException { http://git-wip-us.apache.org/repos/asf/camel/blob/5438802c/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java -- diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java index 5991e65..e88ceb5 100644 --- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java +++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java @@ -61,7 +61,9 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, in), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, in); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { entity = new InputStreamEntity(in, -1); } @@ -78,9 +80,11 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, data), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, data); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { -entity = new InputStreamEntity(new ByteArrayInputStream(data), -1); +entity = new InputStreamEntity(new ByteArrayInputStream(data), data.length); } if (exchange != null) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
git commit: CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch
Updated Branches: refs/heads/master 42d431f80 -> 1995e574c CAMEL-6402: HTTP4 - Set the content length for requests, if known Thanks to Chris Geer for the patch Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1995e574 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1995e574 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1995e574 Branch: refs/heads/master Commit: 1995e574cc5727ba950cefa37c965201a8acdd2e Parents: 42d431f Author: cmueller Authored: Mon May 27 23:10:38 2013 +0200 Committer: cmueller Committed: Mon May 27 23:10:38 2013 +0200 -- .../java/org/apache/camel/util/GZIPHelper.java |4 +--- .../camel/component/http4/HttpEntityConverter.java | 10 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1995e574/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java index d615260..c016d9a 100644 --- a/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/GZIPHelper.java @@ -42,9 +42,8 @@ public final class GZIPHelper { return in; } } - -public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { +public static InputStream compressGzip(String contentEncoding, InputStream in) throws IOException { if (isGzip(contentEncoding)) { ByteArrayOutputStream os = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(os); @@ -59,7 +58,6 @@ public final class GZIPHelper { } else { return in; } - } public static InputStream compressGzip(String contentEncoding, byte[] data) throws IOException { http://git-wip-us.apache.org/repos/asf/camel/blob/1995e574/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java -- diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java index 5991e65..e88ceb5 100644 --- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java +++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpEntityConverter.java @@ -61,7 +61,9 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, in), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, in); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { entity = new InputStreamEntity(in, -1); } @@ -78,9 +80,11 @@ public final class HttpEntityConverter { InputStreamEntity entity; if (exchange != null && !exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class); -entity = new InputStreamEntity(GZIPHelper.compressGzip(contentEncoding, data), -1); +InputStream stream = GZIPHelper.compressGzip(contentEncoding, data); +entity = new InputStreamEntity(stream, stream instanceof ByteArrayInputStream +? stream.available() != 0 ? stream.available() : -1 : -1); } else { -entity = new InputStreamEntity(new ByteArrayInputStream(data), -1); +entity = new InputStreamEntity(new ByteArrayInputStream(data), data.length); } if (exchange != null) { String contentEncoding = exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
svn commit: r863353 - in /websites/production/camel/content: cache/main.pageCache camel-2120-release.html
Author: buildbot Date: Mon May 27 20:18:46 2013 New Revision: 863353 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/camel-2120-release.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/camel-2120-release.html == --- websites/production/camel/content/camel-2120-release.html (original) +++ websites/production/camel/content/camel-2120-release.html Mon May 27 20:18:46 2013 @@ -96,7 +96,7 @@ New Components -camel-mvel - For templating using http://mvel.codehaus.org/"; rel="nofollow">MVELcamel-netty-http - HTTP component using Netty as transport +camel-mvel - For templating using http://mvel.codehaus.org/"; rel="nofollow">MVELcamel-netty-http - HTTP component using Netty as transportcamel-weather - For polling weather information from http://openweathermap.org"; rel="nofollow">Open Weather Map New DSL
git commit: Better is to not catch java.lang.Error.
Updated Branches: refs/heads/master eb1fa8294 -> 42d431f80 Better is to not catch java.lang.Error. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/42d431f8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/42d431f8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/42d431f8 Branch: refs/heads/master Commit: 42d431f809f73c713e44c38db1976f2461e2ae03 Parents: eb1fa82 Author: Babak Vahdat Authored: Mon May 27 22:04:03 2013 +0200 Committer: Babak Vahdat Committed: Mon May 27 22:04:03 2013 +0200 -- .../component/weather/WeatherConfiguration.java|2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/42d431f8/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java index 8a932f4..08066e1 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java @@ -50,7 +50,7 @@ public class WeatherConfiguration { int result = 0; try { result = new Scanner(period).useDelimiter("\\D+").nextInt(); -} catch (Throwable e) { +} catch (Exception e) { // ignore and fallback the period to be an empty string } if (result != 0) {
[CONF] Apache Camel > Camel 2.12.0 Release
Camel 2.12.0 Release Page edited by Babak Vahdat Changes (1) ... * [{{camel-mvel}}|MVEL Component] - For templating using [MVEL|http://mvel.codehaus.org/] * [{{camel-netty-http}}|Netty HTTP] - HTTP component using [Netty] as transport * [{{camel-weather}}|Weather] - For polling weather information from [Open Weather Map|http://openweathermap.org] h3. New DSL ... Full Content Camel 2.12.0 release (currently in progress) New and Noteworthy Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free. ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings. EndpointCompleter API provides a hook so that command line tools (like Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpoints Reduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing. Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message. Evaluating Groovy expressions is faster as we cache the compiled scripts. Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation. Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route. Bindy now supports enums. Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger. While using the Jackson library through the JSON Dataformat there's now a jsonView attribute you could make use of directly inside the DSL itself. Fixed Issues Fixed setting .id in Java DSL on some EIPs such as the Validate Fixed Dead Letter Channel always handled exception, which wasn't the case if an Exception Clause was in use, which didn't had handled=true. Fixed Using PropertyPlaceholder in attributes defined on . All Camel Components will configure their consumers when being created to ensure you can configure from URIs with consumer. as prefix. Fixed QuickfixJEndpoint to adhere a given InOut MEP correctly. Fixed using property placeholders in a Simple predicate used inside a when in a Content Based Router when using Java DSL New Enterprise Integration Patterns New Components camel-mvel - For templating using MVEL camel-netty-http - HTTP component using Netty as transport camel-weather - For polling weather information from Open Weather Map New DSL New Annotations New Data Formats New Languages New Examples New Tutorials API breaking Known Issues Dependency Upgrades Commons Httpclient 4.2.3 to 4.2.5 Commons Httpcore 4.2.3 to 4.2.4 CXF 2.7.4 to 2.7.5 EHCache 2.5.2 to 2.6.5 HAPI 2.0 to 2.1 Hawtdispatch 1.13 to 1.17 Hibernate Validator 4.1.0 to 4.3.1 JRuby 1.7.2 to 1.7.3 Krati 0.4.8 to 0.4.9 Leveldbjni 1.6 to 1.7 MQTT Client 1.4 to 1.5 Netty 3.6.5 to 3.6.6 OpenJPA 2.2.1 to 2.2.2 Spring 3.1.4.RELEASE to 3.2.3.RELEASE Spring Data Redis 1.0.3.RELEASE to 1.0.4.RELEASE Spring Security 3.1.3.RELEASE to 3.1.4.RELEASE Spring Web Services 2.1.2 to 2.1.3 TestNG 6.8 to 6.8.5 XStream 1.4.3 to 1.4.4 Internal changes The following classes in org.apache.camel.processor has been removed as they are no longer needed due internal optimization: UnitOfWorkProcessor, ChildUnitOfWorkProcessor, RouteContextProcessor, RouteInflightRepositoryProcessor, and RoutePolicyProcessor Changes that may affect end users The File and FTP consumers when using idempotent repository will no longer invoke contains with a directory name; this has been changed to only be checked for files. Shutting down using Graceful Shutdown now requires the timeout value to be positive. And improved logic to avoid getting stuc
git commit: Polished the code base of the new Camel Weather component.
Updated Branches: refs/heads/master 1c7ed3d5f -> eb1fa8294 Polished the code base of the new Camel Weather component. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/eb1fa829 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/eb1fa829 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/eb1fa829 Branch: refs/heads/master Commit: eb1fa8294925d8fb598831256a7411af2781aa36 Parents: 1c7ed3d Author: Babak Vahdat Authored: Mon May 27 21:33:06 2013 +0200 Committer: Babak Vahdat Committed: Mon May 27 21:33:06 2013 +0200 -- .../camel/component/weather/WeatherComponent.java |6 +- .../component/weather/WeatherConfiguration.java| 100 ++- .../camel/component/weather/WeatherConstants.java | 30 + .../camel/component/weather/WeatherConsumer.java | 44 +++ .../camel/component/weather/WeatherEndpoint.java |5 +- .../camel/component/weather/WeatherUnits.java | 26 .../component/weather/BaseWeatherConsumerTest.java | 16 +-- .../weather/CurrentWeatherConsumerTest.java|3 +- .../weather/CurrentWeatherMadridConsumerTest.java |2 + .../Forecast7WeatherMadridConsumerTest.java|5 +- 10 files changed, 126 insertions(+), 111 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/eb1fa829/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherComponent.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherComponent.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherComponent.java index d21ad1d..3ddae29 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherComponent.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherComponent.java @@ -23,13 +23,12 @@ import org.apache.camel.Endpoint; import org.apache.camel.impl.UriEndpointComponent; /** - * An http://camel.apache.org/weather.html";>Weather Component. + * A http://camel.apache.org/weather.html";>Weather Component. * * Camel uses http://openweathermap.org/api#weather";>Open Weather to get the information. */ public class WeatherComponent extends UriEndpointComponent { - public WeatherComponent() { super(WeatherEndpoint.class); } @@ -38,8 +37,9 @@ public class WeatherComponent extends UriEndpointComponent { super(context, WeatherEndpoint.class); } +@Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { -WeatherConfiguration configuration = new WeatherConfiguration(); +WeatherConfiguration configuration = new WeatherConfiguration(this); // and then override from parameters setProperties(configuration, parameters); http://git-wip-us.apache.org/repos/asf/camel/blob/eb1fa829/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java -- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java index 321bc6f..8a932f4 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConfiguration.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.weather; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.URL; import java.util.Scanner; @@ -26,6 +23,10 @@ import org.apache.camel.spi.UriParam; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.map.ObjectMapper; +import static org.apache.camel.component.weather.WeatherUnits.METRIC; +import static org.apache.camel.util.ObjectHelper.isEmpty; +import static org.apache.camel.util.ObjectHelper.notNull; + public class WeatherConfiguration { @UriParam @@ -33,42 +34,36 @@ public class WeatherConfiguration { @UriParam private String period = ""; @UriParam -private String units = "metric"; +private WeatherUnits units = METRIC; +private WeatherComponent component; +public WeatherConfiguration(WeatherComponent component) { +this.component = notNull(component, "component"); +} public String getPeriod() { return period; } public void setPeriod(String period) { -if (period != null) { -int result = 0; -try { -
svn commit: r863350 - in /websites/production/camel/content: cache/main.pageCache weather.html
Author: buildbot Date: Mon May 27 19:18:54 2013 New Revision: 863350 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/weather.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/weather.html == --- websites/production/camel/content/weather.html (original) +++ websites/production/camel/content/weather.html Mon May 27 19:18:54 2013 @@ -105,9 +105,7 @@ weather://< Options - Property Default Description location null If null Camel will try and determine your current location using the geolocation of your ip address, else specify the city,country. For well known city names, Open Weather Map will determine the best fit, but multiple results may be returned. Hence specifying and country as well will return more accurate data. units metric the units for temperature measurem ent. Valid values are: -imperial -metric period null If null, the current weather will be returned, else use values of 5, 7, 14 days. Only the numeric value for the forecast period is actually parsed, so spelling, capitalisation of the time period is up to you (its ignored) consumer.delay 360 Delay in millis between each poll (default is 1 hour) consumer.initialDelay 1000 Millis before polling starts. consumer.userFixedDelay false If true, use fixed delay between polls, otherwise fixed rate is used. See http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html"; rel="nofollow">ScheduledExecutorService in JDK for details. + Property Default Description location null If null Camel will try and determine your current location using the geolocation of your ip address, else specify the city,country. For well known city names, Open Weather Map will determine the best fit, but multiple results may be returned. Hence specifying and country as well will return more accurate data. units METRIC the units for temperature measurem ent. The possible values are IMPERIAL, METRIC period null If null, the current weather will be returned, else use values of 5, 7, 14 days. Only the numeric value for the forecast period is actually parsed, so spelling, capitalisation of the time period is up to you (its ignored) consumer.delay 360 Delay in millis between each poll (default is 1 hour) consumer.initialDelay 1000 Millis befo re polling starts. consumer.userFixedDelay false If true, use fixed delay between polls, otherwise fixed rate is used. See http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html"; rel="nofollow">ScheduledExecutorService in JDK for details. @@ -119,9 +117,8 @@ weather://< Message Headers -Camel atom uses these headers. - Header Description query The original query URL sent to the Open Weather Map site + Header Description CamelWeatherQuery The original query URL sent to the Open Weather Map site
[CONF] Apache Camel > Weather
Weather Page edited by Babak Vahdat Changes (4) ... || Property || Default || Description || | {{location}} | {{null}} | If null Camel will try and determine your current location using the geolocation of your ip address, else specify the city,country. For well known city names, Open Weather Map will determine the best fit, but multiple results may be returned. Hence specifying and country as well will return more accurate data. | | {{units}} | {{metric}} | the units for temperature measurement. Valid values are:\\ {{imperial}}\\ {{metric}} | | {{units}} | {{METRIC}} | the units for temperature measurement. The possible values are {{IMPERIAL}}, {{METRIC}} | | {{period}} | {{null}} | If null, the current weather will be returned, else use values of 5, 7, 14 days. Only the numeric value for the forecast period is actually parsed, so spelling, capitalisation of the time period is up to you (its ignored) | | {{consumer.delay}} | {{360}} | Delay in millis between each poll (default is 1 hour) | ... h3. Message Headers Camel atom uses these headers. {div:class=confluenceTableSmall} || Header || Description || | {{query}} {{CamelWeatherQuery}} | The original query URL sent to the Open Weather Map site | {div} ... Full Content Weather Component The weather: component is used for polling weather information from Open Weather Map - a site that provides free global weather and forecast information. The information is returned as a json String object. Camel will poll for updates to the current weather and forecasts once per hour by default. Note: The component currently only supports consuming weather - though we will continue to research ways to influence the weather reliably Maven users will need to add the following dependency to their pom.xml for this component: org.apache.camel camel-weather x.x.x URI format weather://[?options] Options Property Default Description location null If null Camel will try and determine your current location using the geolocation of your ip address, else specify the city,country. For well known city names, Open Weather Map will determine the best fit, but multiple results may be returned. Hence specifying and country as well will return more accurate data. units METRIC the units for temperature measurement. The possible values are IMPERIAL, METRIC period null If null, the current weather will be returned, else use values of 5, 7, 14 days. Only the numeric value for the forecast period is actually parsed, so spelling, capitalisation of the time period is up to you (its ignored) consumer.delay 360 Delay in millis between each poll (default is 1 hour) consumer.initialDelay 1000 Millis before polling starts. consumer.userFixedDelay false If true, use fixed delay between polls, otherwise fixed rate is used. See ScheduledExecutorService in JDK for details. You can append query options to the URI in the following format, ?option=value&option=value&... Exchange data format Camel will deliver the body as a json formatted java.lang.String Message Headers Header Description CamelWeatherQuery The original query URL sent to the Open Weather Map site Samples In this sample we find the 7 day weather forecast for Madrid, Spain: from("weather:foo?location=Madrid,Spain&period=7 days").to("jms:queue:weather"); To just find the current weather for your current location you can use this: from("weather:foo").to("jms:queue:weather"); Change Notification Preferences View Online | View Changes | Add Comment
svn commit: r863289 - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache camel-2120-release.html json.html
Author: buildbot Date: Mon May 27 13:21:02 2013 New Revision: 863289 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-dataformat-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/camel-2120-release.html websites/production/camel/content/json.html Modified: websites/production/camel/content/book-dataformat-appendix.html == --- websites/production/camel/content/book-dataformat-appendix.html (original) +++ websites/production/camel/content/book-dataformat-appendix.html Mon May 27 13:21:02 2013 @@ -1185,7 +1185,7 @@ from("direct:in -Directly specify the http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: +Directly specify your http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Mon May 27 13:21:02 2013 @@ -12412,7 +12412,7 @@ from("direct:in -Directly specify the http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: +Directly specify your http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/camel-2120-release.html == --- websites/production/camel/content/camel-2120-release.html (original) +++ websites/production/camel/content/camel-2120-release.html Mon May 27 13:21:02 2013 @@ -84,7 +84,7 @@ Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) -Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free.ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings.EndpointCompleter API provides a hook so that command line tools (like http://karaf.apache.org/manual/latest-2.3.x/users-guide/using-console.html";>Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpointsReduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing.Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message.Evaluating Gro ovy expressions is faster as we cache the compiled scripts.Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation.Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route.Bindy now supports enums.Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger. +Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free.ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings.EndpointCompleter API provides a hook so
[CONF] Apache Camel > Camel 2.12.0 Release
Camel 2.12.0 Release Page edited by Babak Vahdat Changes (1) ... * [Bindy] now supports enums. * Added new [BacklogDebugger] to perform live debugging of messages during routing. The [BacklogDebugger] has JMX API allows tooling to control the debugger. * While using the [Jackson library|http://xircles.codehaus.org/projects/jackson] through the [JSON] Dataformat there's now a {{jsonView}} attribute you could make use of directly inside the [DSL] itself. h3. Fixed Issues ... Full Content Camel 2.12.0 release (currently in progress) New and Noteworthy Welcome to the 2.12.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...) Endpoint Annotations along with automatically created HTML documentation for the endpoint parameters; this makes it easier for component developers to add a few refactoring-safe annotations to their Endpoint or Consumer implementations and, (along with javadoc comments on the field or setter method), get nice user documentation on how to use the endpoint for free. ComponentConfiguration API provides a handy API for tools developers to introspect on a Component to find all the possible parameters, their types and any extra annotations (like Bean Validation Annotations) to be able to create/edit endpoints or URI strings so that tools can generate nicer UIs for configuring endpoints than just letting folks edit Strings. EndpointCompleter API provides a hook so that command line tools (like Karaf's shell), IDEs and web tools can get (bash tab like) auto-completion on endpoint paths (such as file or directory names, message queue names, database table names) when creating or using new endpoints Reduced stack-frames in use during routing, that also makes Camel's stack traces being logged much less verbose. This also allows people to easier debug the internals of Camel as less AsyncCallback callbacks are in use during routing. Spring Web Services now supports setting/receiving SOAP headers more easily using a header on the Camel Message. Evaluating Groovy expressions is faster as we cache the compiled scripts. Added base64 option to Shiro Security to allow transferring security token over JMS and other transports as base64 encoded representation. Made it easier to use Shiro Security as the credentials can be provided in headers, when sending a message to a secured route. Bindy now supports enums. Added new BacklogDebugger to perform live debugging of messages during routing. The BacklogDebugger has JMX API allows tooling to control the debugger. While using the Jackson library through the JSON Dataformat there's now a jsonView attribute you could make use of directly inside the DSL itself. Fixed Issues Fixed setting .id in Java DSL on some EIPs such as the Validate Fixed Dead Letter Channel always handled exception, which wasn't the case if an Exception Clause was in use, which didn't had handled=true. Fixed Using PropertyPlaceholder in attributes defined on . All Camel Components will configure their consumers when being created to ensure you can configure from URIs with consumer. as prefix. Fixed QuickfixJEndpoint to adhere a given InOut MEP correctly. Fixed using property placeholders in a Simple predicate used inside a when in a Content Based Router when using Java DSL New Enterprise Integration Patterns New Components camel-mvel - For templating using MVEL camel-netty-http - HTTP component using Netty as transport New DSL New Annotations New Data Formats New Languages New Examples New Tutorials API breaking Known Issues Dependency Upgrades Commons Httpclient 4.2.3 to 4.2.5 Commons Httpcore 4.2.3 to 4.2.4 CXF 2.7.4 to 2.7.5 EHCache 2.5.2 to 2.6.5 HAPI 2.0 to 2.1 Hawtdispatch 1.13 to 1.17 Hibernate Validator 4.1.0 to 4.3.1 JRuby 1.7.2 to 1.7.3 Krati 0.4.8 to 0.4.9 Leveldbjni 1.6 to 1.7 MQTT Client 1.4 to 1.5 Netty 3.6.5 to 3.6.6 OpenJPA 2.2.1 to 2.2.2 Spring 3.1.4.RELEASE to 3.2.3.RELEASE Spring Data Redis 1.0.3.RELEASE to 1.0.4.RELEASE Spring Security 3.1.3.RELEASE to 3.1.4.RELEASE Spring Web Services 2.1.2 to 2.1.3 TestNG 6.8 to 6.8.5 XStream 1.4.3 to 1.4.4 Internal changes The following classes in org.apache.camel.processor has been removed as they are no longer needed due internal optimization: UnitOfWorkProcessor, ChildUnitOfWorkProcessor, RouteContextProcessor, RouteInflightRepositoryProcessor, and RoutePolicyProcessor Changes that may affect end users The File and FTP consumers when using idempotent repository will no longer invoke contains with a directory name; this has been changed to only be checked for files. Shutting down using Graceful Shutdown now requires the timeout value to be positive.
git commit: Polished Javadoc.
Updated Branches: refs/heads/master 0f631065c -> 1c7ed3d5f Polished Javadoc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c7ed3d5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c7ed3d5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c7ed3d5 Branch: refs/heads/master Commit: 1c7ed3d5f01f080bfaaf0898b2769f6d1322b871 Parents: 0f63106 Author: Babak Vahdat Authored: Mon May 27 14:29:55 2013 +0200 Committer: Babak Vahdat Committed: Mon May 27 14:29:55 2013 +0200 -- .../org/apache/camel/builder/DataFormatClause.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1c7ed3d5/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java -- diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java index 5167365..beb817b 100644 --- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java +++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java @@ -355,7 +355,7 @@ public class DataFormatClause> { * * @param type the json type to use * @param unmarshalType unmarshal type for json jackson type - * @param jsonView the view type for json jackson type + * @param jsonView the view type for json jackson type */ public T json(Class unmarshalType, Class jsonView) { JsonDataFormat json = new JsonDataFormat(JsonLibrary.Jackson);
[CONF] Apache Camel > JSON
JSON Page edited by Babak Vahdat Changes (1) ... {code} Directly specify the your [JSON view|http://wiki.fasterxml.com/JacksonJsonViews] inside the Java DSL as: {code:java} ... Full Content JSON JSON is a Data Format to marshal and unmarshal Java objects to and from JSON. For JSON to object marshalling, Camel provides integration with three popular JSON libraries: The XStream library and Jettsion The Jackson library Camel 2.10: The GSon library By default Camel uses the XStream library. Direct, bi-directional JSON <=> XML conversionsAs of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the camel-xmljson data format, which is documented separately. Using JSON data format with the XStream library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(). to("mqseries:Another.Queue"); Using JSON data format with the Jackson library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(JsonLibrary.Jackson). to("mqseries:Another.Queue"); Using JSON data format with the GSON library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(JsonLibrary.Gson). to("mqseries:Another.Queue"); Using JSON in Spring DSL When using Data Format in Spring DSL you need to declare the data formats first. This is done in the DataFormats XML tag. "jack" library="Jackson" unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/> And then you can refer to this id in the route: "direct:back"/> "jack"/> "mock:reverse"/> Excluding POJO fields from marshalling As of Camel 2.10 When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. First create one or more marker classes. public class Views { static class Weight { } static class Age { } } Use the marker classes with the @JsonView annotation to include/exclude certain fields. The annotation also works on getters. @JsonView(Views.Age.class) private int age = 30; private int height = 190; @JsonView(Views.Weight.class) private int weight = 70; Finally use the Camel JacksonDataFormat to marshall the above POJO to JSON. JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); from("direct:inPojoAgeView").marshal(ageViewFormat); Note that the weight field is missing in the resulting JSON: {"age":30, "height":190} The GSON library supports a similar feature through the notion of ExclusionStrategies: /** * Strategy to exclude {@link ExcludeAge} annotated fields */ protected static class AgeExclusionStrategy implements ExclusionStrategy { @Override public boolean shouldSkipField(FieldAttributes f) { return f.getAnnotation(ExcludeAge.class) != null; } @Override public boolean shouldSkipClass(Class clazz) { return false; } } The GsonDataFormat accepts an ExclusionStrategy in its constructor: GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class, new AgeExclusionStrategy()); from("direct:inPojoExcludeAge").marshal(ageExclusionFormat); The line above will exclude fields annotated with @ExcludeAge when marshalling to JSON. Configuring field naming policy Available as of Camel 2.11 The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores. We may have this JSON string { "id" : 123, "first_name" : "Donald" "last_name" : "Duck" } Which we want to map to a POJO that has getter/setters as public class PersonPojo { private int id; private String firstName; private String lastName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } Then we can configure the org.apache.camel.component.gson.GsonDataFormat in a Spring XML files as shown below. Notice we use fieldNamingPolicy property to set the field mapping. This property is an enum from GSon com.google.gson.FieldNamingPolicy which has a number of pre defined mappings. If you need full control you can use the
svn commit: r863286 - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache json.html
Author: buildbot Date: Mon May 27 12:20:45 2013 New Revision: 863286 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-dataformat-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/json.html Modified: websites/production/camel/content/book-dataformat-appendix.html == --- websites/production/camel/content/book-dataformat-appendix.html (original) +++ websites/production/camel/content/book-dataformat-appendix.html Mon May 27 12:20:45 2013 @@ -1172,6 +1172,39 @@ from("direct:in +Include/Exclude fields using the jsonView attribute with JacksonDataFormat +Available as of Camel 2.12 + +As an example of using this attribute you can instead of: + + + +JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); +from("direct:inPojoAgeView"). + marshal(ageViewFormat); + + + +Directly specify the http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: + + + +from("direct:inPojoAgeView"). + marshal().json(TestPojoView.class, Views.Age.class); + + + +And the same in XML DSL: + + + ++ + + + + Dependencies for XStream To use JSON in your camel routes you need to add the a dependency on camel-xstream which implements this data format. Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Mon May 27 12:20:45 2013 @@ -12399,6 +12399,39 @@ from("direct:in +Include/Exclude fields using the jsonView attribute with JacksonDataFormat +Available as of Camel 2.12 + +As an example of using this attribute you can instead of: + + + +JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); +from("direct:inPojoAgeView"). + marshal(ageViewFormat); + + + +Directly specify the http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: + + + +from("direct:inPojoAgeView"). + marshal().json(TestPojoView.class, Views.Age.class); + + + +And the same in XML DSL: + + + ++ + + + + + Dependencies for XStream To use JSON in your camel routes you need to add the a dependency on camel-xstream which implements this data format. Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/json.html == --- websites/production/camel/content/json.html (original) +++ websites/production/camel/content/json.html Mon May 27 12:20:45 2013 @@ -293,6 +293,39 @@ from("direct:in +Include/Exclude fields using the jsonView attribute with JacksonDataFormat +Available as of Camel 2.12 + +As an example of using this attribute you can instead of: + + + +JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); +from("direct:inPojoAgeView"). + marshal(ageViewFormat); + + + +Directly specify the http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON view inside the Java DSL as: + + + +from("direct:inPojoAgeView"). + marshal().json(TestPojoView.class, Views.Age.class); + + + +And the same in XML DSL: + + + ++ + + + + + Dependencies for XStream To use JSON in your camel routes you need to add the a dependency on camel-xstream which implements this data format.+
[CONF] Apache Camel > JSON
JSON Page edited by Babak Vahdat Changes (1) ... h3. Include/Exclude fields using the {{jsonView}} attribute with {{JacksonDataFormat}} *Available as of Camel 2.12* As an example of using this attribute you can instead of: {code:java} JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); from("direct:inPojoAgeView"). marshal(ageViewFormat); {code} Directly specify the [JSON view|http://wiki.fasterxml.com/JacksonJsonViews] inside the Java DSL as: {code:java} from("direct:inPojoAgeView"). marshal().json(TestPojoView.class, Views.Age.class); {code} And the same in XML DSL: {code:java} {code} h3. Dependencies for XStream ... Full Content JSON JSON is a Data Format to marshal and unmarshal Java objects to and from JSON. For JSON to object marshalling, Camel provides integration with three popular JSON libraries: The XStream library and Jettsion The Jackson library Camel 2.10: The GSon library By default Camel uses the XStream library. Direct, bi-directional JSON <=> XML conversionsAs of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the camel-xmljson data format, which is documented separately. Using JSON data format with the XStream library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(). to("mqseries:Another.Queue"); Using JSON data format with the Jackson library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(JsonLibrary.Jackson). to("mqseries:Another.Queue"); Using JSON data format with the GSON library // lets turn Object messages into json then send to MQSeries from("activemq:My.Queue"). marshal().json(JsonLibrary.Gson). to("mqseries:Another.Queue"); Using JSON in Spring DSL When using Data Format in Spring DSL you need to declare the data formats first. This is done in the DataFormats XML tag. "jack" library="Jackson" unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/> And then you can refer to this id in the route: "direct:back"/> "jack"/> "mock:reverse"/> Excluding POJO fields from marshalling As of Camel 2.10 When marshalling a POJO to JSON you might want to exclude certain fields from the JSON output. With Jackson you can use JSON views to accomplish this. First create one or more marker classes. public class Views { static class Weight { } static class Age { } } Use the marker classes with the @JsonView annotation to include/exclude certain fields. The annotation also works on getters. @JsonView(Views.Age.class) private int age = 30; private int height = 190; @JsonView(Views.Weight.class) private int weight = 70; Finally use the Camel JacksonDataFormat to marshall the above POJO to JSON. JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class); from("direct:inPojoAgeView").marshal(ageViewFormat); Note that the weight field is missing in the resulting JSON: {"age":30, "height":190} The GSON library supports a similar feature through the notion of ExclusionStrategies: /** * Strategy to exclude {@link ExcludeAge} annotated fields */ protected static class AgeExclusionStrategy implements ExclusionStrategy { @Override public boolean shouldSkipField(FieldAttributes f) { return f.getAnnotation(ExcludeAge.class) != null; } @Override public boolean shouldSkipClass(Class clazz) { return false; } } The GsonDataFormat accepts an ExclusionStrategy in its constructor: GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class, new AgeExclusionStrategy()); from("direct:inPojoExcludeAge").marshal(ageExclusionFormat); The line above will exclude fields annotated with @ExcludeAge when marshalling to JSON. Configuring field naming policy Available as of Camel 2.11 The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores. We may have this JSON string { "id" : 123, "first_name" : "Donald" "last_name" : "Duck" } Which we want to map to a POJO that has getter/setters as public class PersonPojo { private int id; private String firstName; private String lastName; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.fir
git commit: CAMEL-6379: Allow to configure jsonView of Jackson directly inside Java/XML DSL itself.
Updated Branches: refs/heads/master 7a179eac7 -> 0f631065c CAMEL-6379: Allow to configure jsonView of Jackson directly inside Java/XML DSL itself. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0f631065 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0f631065 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0f631065 Branch: refs/heads/master Commit: 0f631065c0c5532b5dceb069a45522650ab7975d Parents: 7a179ea Author: Babak Vahdat Authored: Mon May 27 14:08:07 2013 +0200 Committer: Babak Vahdat Committed: Mon May 27 14:08:07 2013 +0200 -- .../org/apache/camel/builder/DataFormatClause.java | 14 ++ .../camel/model/dataformat/JsonDataFormat.java | 14 ++ .../component/jackson/JacksonMarshalViewTest.java | 11 +++ .../jackson/SpringJacksonJsonDataFormatTest.java | 20 +- .../org/apache/camel/component/jackson/Views.java |2 +- .../jackson/SpringJacksonJsonDataFormatTest.xml| 13 + 6 files changed, 65 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0f631065/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java -- diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java index 7f87846..5167365 100644 --- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java +++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java @@ -351,6 +351,20 @@ public class DataFormatClause> { } /** + * Uses the JSON data format + * + * @param type the json type to use + * @param unmarshalType unmarshal type for json jackson type + * @param jsonView the view type for json jackson type + */ +public T json(Class unmarshalType, Class jsonView) { +JsonDataFormat json = new JsonDataFormat(JsonLibrary.Jackson); +json.setUnmarshalType(unmarshalType); +json.setJsonView(jsonView); +return dataFormat(json); +} + +/** * Uses the protobuf data format */ public T protobuf() { http://git-wip-us.apache.org/repos/asf/camel/blob/0f631065/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java -- diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java index ecfdf27..027e6d3 100644 --- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java +++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java @@ -43,6 +43,8 @@ public class JsonDataFormat extends DataFormatDefinition { private String unmarshalTypeName; @XmlTransient private Class unmarshalType; +@XmlAttribute +private Class jsonView; public JsonDataFormat() { } @@ -83,6 +85,14 @@ public class JsonDataFormat extends DataFormatDefinition { this.library = library; } +public Class getJsonView() { +return jsonView; +} + +public void setJsonView(Class jsonView) { +this.jsonView = jsonView; +} + @Override protected DataFormat createDataFormat(RouteContext routeContext) { if (library == JsonLibrary.XStream) { @@ -112,6 +122,10 @@ public class JsonDataFormat extends DataFormatDefinition { if (prettyPrint != null) { setProperty(dataFormat, "prettyPrint", unmarshalType); } + +if (jsonView != null) { +setProperty(dataFormat, "jsonView", jsonView); +} } } http://git-wip-us.apache.org/repos/asf/camel/blob/0f631065/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java -- diff --git a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java index 1c0e53f..25a82b7 100644 --- a/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java +++ b/components/camel-jackson/src/test/java/org/apache/camel/component/jackson/JacksonMarshalViewTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.jackson; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.model.dataformat.JsonLibrary; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.
git commit: CAMEL-6398: Added camel-weather as feature
Updated Branches: refs/heads/master bf98a5293 -> 76074a9ca CAMEL-6398: Added camel-weather as feature Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/76074a9c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/76074a9c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/76074a9c Branch: refs/heads/master Commit: 76074a9ca3bd3369e82c5aceb22577a2eb5e387d Parents: bf98a52 Author: Claus Ibsen Authored: Mon May 27 13:19:19 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 13:19:19 2013 +0200 -- .../apache/camel/itest/karaf/CamelWeatherTest.java | 40 +++ 1 files changed, 40 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/76074a9c/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWeatherTest.java -- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWeatherTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWeatherTest.java new file mode 100644 index 000..766a49f --- /dev/null +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWeatherTest.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.itest.karaf; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.JUnit4TestRunner; + +@RunWith(JUnit4TestRunner.class) +public class CamelWeatherTest extends AbstractFeatureTest { + +public static final String COMPONENT = extractName(CamelWeatherTest.class); + +@Test +public void test() throws Exception { +testComponent(COMPONENT); +} + +@Configuration +public static Option[] configure() { +return configure(COMPONENT); +} + +} \ No newline at end of file
git commit: Added karaf test for camel-disruptor, which still have a problem with install in osgi.
Updated Branches: refs/heads/master 76074a9ca -> 7a179eac7 Added karaf test for camel-disruptor, which still have a problem with install in osgi. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7a179eac Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7a179eac Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7a179eac Branch: refs/heads/master Commit: 7a179eac72770c1eec74a545f15fc194e819c869 Parents: 76074a9 Author: Claus Ibsen Authored: Mon May 27 13:25:08 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 13:25:08 2013 +0200 -- .../karaf/features/src/main/resources/features.xml | 15 -- .../camel/itest/karaf/CamelDisruptorTest.java | 41 +++ 2 files changed, 51 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/7a179eac/platforms/karaf/features/src/main/resources/features.xml -- diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index c099630..8dab5f0 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -218,11 +218,10 @@ mvn:org.apache.camel/camel-cxf/${project.version} - mvn:com.lmax/disruptor/${disruptor-version} - camel-core - mvn:org.apache.camel/camel-disruptor/${project.version} - - +mvn:com.lmax/disruptor/${disruptor-version} +camel-core +mvn:org.apache.camel/camel-disruptor/${project.version} + The camel-dns feature can only run on a SUN JVM. You need to ddd the package sun.net.spi.nameservice to the java platform packages in the etc/jre.properties file. mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dnsjava/${dnsjava-bundle-version} @@ -960,6 +959,12 @@ camel-core mvn:org.apache.camel/camel-velocity/${project.version} + +mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version} +mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version} +camel-core +mvn:org.apache.camel/camel-weather/${project.version} + jetty camel-core http://git-wip-us.apache.org/repos/asf/camel/blob/7a179eac/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDisruptorTest.java -- diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDisruptorTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDisruptorTest.java new file mode 100644 index 000..728d894 --- /dev/null +++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelDisruptorTest.java @@ -0,0 +1,41 @@ +/** + * 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.itest.karaf; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.JUnit4TestRunner; + +@RunWith(JUnit4TestRunner.class) +@Ignore("disruptor requries sun.misc package") +public class CamelDisruptorTest extends AbstractFeatureTest { + +@Test +public void test() throws Exception { +testComponent("disruptor"); +testComponent("disruptor-vm"); +} + +@Configuration +public static Option[] configure() { +return configure("disruptor"); +} + +} \ No newline at end of file
git commit: CAMEL-6398: Added camel-weather to dist. Thanks to Nerses Aznauryan for spotting the spelling mistake.
Updated Branches: refs/heads/master 2ff3b1dab -> bf98a5293 CAMEL-6398: Added camel-weather to dist. Thanks to Nerses Aznauryan for spotting the spelling mistake. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bf98a529 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bf98a529 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bf98a529 Branch: refs/heads/master Commit: bf98a52932df7d5aa562650e57371db2108afc09 Parents: 2ff3b1d Author: Claus Ibsen Authored: Mon May 27 12:10:46 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 12:10:46 2013 +0200 -- apache-camel/src/main/descriptors/common-bin.xml |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/bf98a529/apache-camel/src/main/descriptors/common-bin.xml -- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index c102e39..0ebd556 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -154,7 +154,7 @@ org.apache.camel:camel-twitter org.apache.camel:camel-urlrewrite org.apache.camel:camel-velocity -org.apache.camel:camel-veather +org.apache.camel:camel-weather org.apache.camel:camel-websocket org.apache.camel:camel-xmlbeans org.apache.camel:camel-xmljson
[3/4] git commit: CAMEL-6398: Added camel-weather to dist
CAMEL-6398: Added camel-weather to dist Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d12dbff0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d12dbff0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d12dbff0 Branch: refs/heads/master Commit: d12dbff0eaa47d5458c85e26ed0e4a860e33b70c Parents: d1d95bf Author: Claus Ibsen Authored: Mon May 27 08:51:40 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 08:51:40 2013 +0200 -- apache-camel/pom.xml |4 +++ apache-camel/src/main/descriptors/common-bin.xml |1 + components/camel-weather/pom.xml | 18 +-- .../src/test/resources/log4j.properties|9 ++- 4 files changed, 14 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d12dbff0/apache-camel/pom.xml -- diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index bc0e744..54c2382 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -564,6 +564,10 @@ org.apache.camel + camel-weather + + + org.apache.camel camel-websocket http://git-wip-us.apache.org/repos/asf/camel/blob/d12dbff0/apache-camel/src/main/descriptors/common-bin.xml -- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 25ca259..0ceec51 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -153,6 +153,7 @@ org.apache.camel:camel-twitter org.apache.camel:camel-urlrewrite org.apache.camel:camel-velocity +org.apache.camel:camel-veather org.apache.camel:camel-websocket org.apache.camel:camel-xmlbeans org.apache.camel:camel-xmljson http://git-wip-us.apache.org/repos/asf/camel/blob/d12dbff0/components/camel-weather/pom.xml -- diff --git a/components/camel-weather/pom.xml b/components/camel-weather/pom.xml index a6cb07d..f9b60ad 100644 --- a/components/camel-weather/pom.xml +++ b/components/camel-weather/pom.xml @@ -31,7 +31,7 @@ Camel Weather support - org.apache.camel.component.weather.* + org.apache.camel.component.weather.* org.apache.camel.spi.ComponentResolver;component=weather @@ -40,12 +40,11 @@ org.apache.camel camel-core - - org.codehaus.jackson - jackson-mapper-asl - ${jackson-version} - - + + org.codehaus.jackson + jackson-mapper-asl + ${jackson-version} + @@ -58,11 +57,6 @@ slf4j-log4j12 test - - junit - junit - test - http://git-wip-us.apache.org/repos/asf/camel/blob/d12dbff0/components/camel-weather/src/test/resources/log4j.properties -- diff --git a/components/camel-weather/src/test/resources/log4j.properties b/components/camel-weather/src/test/resources/log4j.properties index 90db5fc..33efa4c 100644 --- a/components/camel-weather/src/test/resources/log4j.properties +++ b/components/camel-weather/src/test/resources/log4j.properties @@ -16,15 +16,12 @@ ## # -# The logging properties used for eclipse testing, We want to see debug output on the console. +# The logging properties used for testing. # log4j.rootLogger=INFO, file -#log4j.logger.org.apache.activemq=DEBUG #log4j.logger.org.apache.camel=DEBUG -#log4j.logger.org.apache.camel.component.rss=DEBUG - -log4j.logger.org.apache.camel.impl.converter=INFO +#log4j.logger.org.apache.camel.component.weather=DEBUG # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender @@ -36,5 +33,5 @@ log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n -log4j.appender.file.file=target/camel-rss-test.log +log4j.appender.file.file=target/camel-weather-test.log log4j.appender.file.append=true
[2/4] git commit: CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d1d95bf7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d1d95bf7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d1d95bf7 Branch: refs/heads/master Commit: d1d95bf7587ecca15b3c5f07ed29ee04545de21e Parents: f3b233d Author: Claus Ibsen Authored: Mon May 27 05:03:22 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 05:03:22 2013 +0200 -- .../org/apache/camel/processor/WrapProcessor.java | 30 --- .../processor/interceptor/DefaultChannel.java |2 +- 2 files changed, 1 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d1d95bf7/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java index 3eb629a..adb508a 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java @@ -18,11 +18,7 @@ package org.apache.camel.processor; import java.util.List; -import org.apache.camel.AsyncCallback; -import org.apache.camel.AsyncProcessor; -import org.apache.camel.Exchange; import org.apache.camel.Processor; -import org.apache.camel.util.AsyncProcessorHelper; import org.apache.camel.util.ServiceHelper; /** @@ -52,32 +48,6 @@ public class WrapProcessor extends DelegateAsyncProcessor { } @Override -public void process(Exchange exchange) throws Exception { -if (wrapped instanceof AsyncProcessor) { -AsyncProcessor async = (AsyncProcessor) wrapped; -AsyncProcessorHelper.process(async, exchange); -} else { -wrapped.process(exchange); -} -} - -@Override -public boolean process(Exchange exchange, AsyncCallback callback) { -if (wrapped instanceof AsyncProcessor) { -AsyncProcessor async = (AsyncProcessor) wrapped; -return async.process(exchange, callback); -} else { -try { -wrapped.process(exchange); -} catch (Exception e) { -exchange.setException(e); -} -callback.done(true); -return true; -} -} - -@Override protected void doStart() throws Exception { ServiceHelper.startService(wrapped); super.doStart(); http://git-wip-us.apache.org/repos/asf/camel/blob/d1d95bf7/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java index 9a68502..a6282fb 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java +++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java @@ -262,7 +262,7 @@ public class DefaultChannel extends ServiceSupport implements ModelChannel { bridge.setTarget(wrapped); wrapped = bridge; } -if (!(wrapped instanceof Service)) { +if (!(wrapped instanceof WrapProcessor)) { // wrap the target so it becomes a service and we can manage its lifecycle wrapped = new WrapProcessor(wrapped, target); }
[4/4] git commit: Added camel-disruptor to dist
Added camel-disruptor to dist Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2ff3b1da Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2ff3b1da Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2ff3b1da Branch: refs/heads/master Commit: 2ff3b1dab5193c79160a689ae7adff638ed0e7c2 Parents: d12dbff Author: Claus Ibsen Authored: Mon May 27 08:58:12 2013 +0200 Committer: Claus Ibsen Committed: Mon May 27 08:58:12 2013 +0200 -- apache-camel/pom.xml |8 + apache-camel/src/main/descriptors/common-bin.xml |1 + components/camel-disruptor/pom.xml | 24 + 3 files changed, 16 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2ff3b1da/apache-camel/pom.xml -- diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml index 54c2382..a1ca22e 100644 --- a/apache-camel/pom.xml +++ b/apache-camel/pom.xml @@ -141,6 +141,14 @@ org.apache.camel + camel-cxf-transport + + + org.apache.camel + camel-disruptor + + + org.apache.camel camel-dns http://git-wip-us.apache.org/repos/asf/camel/blob/2ff3b1da/apache-camel/src/main/descriptors/common-bin.xml -- diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml index 0ceec51..c102e39 100644 --- a/apache-camel/src/main/descriptors/common-bin.xml +++ b/apache-camel/src/main/descriptors/common-bin.xml @@ -49,6 +49,7 @@ org.apache.camel:camel-csv org.apache.camel:camel-cxf org.apache.camel:camel-cxf-transport +org.apache.camel:camel-disruptor org.apache.camel:camel-dns org.apache.camel:camel-dozer org.apache.camel:camel-eclipse http://git-wip-us.apache.org/repos/asf/camel/blob/2ff3b1da/components/camel-disruptor/pom.xml -- diff --git a/components/camel-disruptor/pom.xml b/components/camel-disruptor/pom.xml index b5eaa45..9943b58 100644 --- a/components/camel-disruptor/pom.xml +++ b/components/camel-disruptor/pom.xml @@ -27,7 +27,6 @@ 2.12-SNAPSHOT - Camel :: Disruptor camel-disruptor Camel :: Disruptor component @@ -35,19 +34,17 @@ org.apache.camel.component.disruptor.* - org.apache.camel.spi.ComponentResolver;component=disruptor - - org.apache.camel.spi.ComponentResolver;component=disruptor-vm + + org.apache.camel.spi.ComponentResolver;component=disruptor, + org.apache.camel.spi.ComponentResolver;component=disruptor-vm - org.apache.camel camel-core - com.lmax disruptor @@ -55,23 +52,15 @@ - - -org.apache.camel -camel-core -test-jar - - org.apache.camel camel-test test - -junit -junit -test +org.apache.camel +camel-core +test-jar org.slf4j @@ -79,4 +68,5 @@ test +
[1/4] git commit: CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
Updated Branches: refs/heads/master 7b786b9d0 -> 2ff3b1dab CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3b233d4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3b233d4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3b233d4 Branch: refs/heads/master Commit: f3b233d447c94245d260121f94748fd6039239a1 Parents: 7b786b9 Author: Claus Ibsen Authored: Sun May 26 20:36:11 2013 +0200 Committer: Claus Ibsen Committed: Sun May 26 21:16:08 2013 +0200 -- .../org/apache/camel/processor/WrapProcessor.java | 30 +++ .../processor/interceptor/DefaultChannel.java |4 +- 2 files changed, 32 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f3b233d4/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java index adb508a..3eb629a 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/processor/WrapProcessor.java @@ -18,7 +18,11 @@ package org.apache.camel.processor; import java.util.List; +import org.apache.camel.AsyncCallback; +import org.apache.camel.AsyncProcessor; +import org.apache.camel.Exchange; import org.apache.camel.Processor; +import org.apache.camel.util.AsyncProcessorHelper; import org.apache.camel.util.ServiceHelper; /** @@ -48,6 +52,32 @@ public class WrapProcessor extends DelegateAsyncProcessor { } @Override +public void process(Exchange exchange) throws Exception { +if (wrapped instanceof AsyncProcessor) { +AsyncProcessor async = (AsyncProcessor) wrapped; +AsyncProcessorHelper.process(async, exchange); +} else { +wrapped.process(exchange); +} +} + +@Override +public boolean process(Exchange exchange, AsyncCallback callback) { +if (wrapped instanceof AsyncProcessor) { +AsyncProcessor async = (AsyncProcessor) wrapped; +return async.process(exchange, callback); +} else { +try { +wrapped.process(exchange); +} catch (Exception e) { +exchange.setException(e); +} +callback.done(true); +return true; +} +} + +@Override protected void doStart() throws Exception { ServiceHelper.startService(wrapped); super.doStart(); http://git-wip-us.apache.org/repos/asf/camel/blob/f3b233d4/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java index 4634ec6..9a68502 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java +++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java @@ -262,8 +262,8 @@ public class DefaultChannel extends ServiceSupport implements ModelChannel { bridge.setTarget(wrapped); wrapped = bridge; } -// ensure target gets wrapped so we can control its lifecycle -if (!(wrapped instanceof WrapProcessor)) { +if (!(wrapped instanceof Service)) { +// wrap the target so it becomes a service and we can manage its lifecycle wrapped = new WrapProcessor(wrapped, target); } target = wrapped;