You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/14 18:07:44 UTC
[camel-examples] branch master updated: Camel 16012 remove prefix
01 (#34)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-examples.git
The following commit(s) were added to refs/heads/master by this push:
new 458c479 Camel 16012 remove prefix 01 (#34)
458c479 is described below
commit 458c479e690a1ef8e516d57bed76a91039270d94
Author: metters <me...@users.noreply.github.com>
AuthorDate: Sun Feb 14 19:07:36 2021 +0100
Camel 16012 remove prefix 01 (#34)
* [CAMEL-16012] Improve/Fix several README.adoc files
* [CAMEL-16012] Fix some sonar issues in several classes and reformat code
* [CAMEL-16012] Improve README.adoc
* [CAMEL-16012] Fix root README.adoc
* [CAMEL-16012] Rename modules with character 'a'
* [CAMEL-16012] Rename modules with character 'b'
* [CAMEL-16012] Fix some sonar issues
* [CAMEL-16012] Fix root pom and rename billboard
billboard was renamed to match the other aggregate example
* Added xml route
* Reduce number of JARs on classpath
* Fixed example
* Remove example that wont run after some SSH server upgrade.
* CAMEL-16170: Modularize camel-spring
* Fixed example
* Next is 3.9.0-SNAPSHOT
* Next is 3.9.0-SNAPSHOT
* Camel-examples cdi minio: Use the camel version from parent pom
* [CAMEL-16012] Improve/Fix several README.adoc files
* [CAMEL-16012] Fix some sonar issues in several classes and reformat code
* [CAMEL-16012] Improve README.adoc
* [CAMEL-16012] Fix root README.adoc
* [CAMEL-16012] Rename modules with character 'a'
* [CAMEL-16012] Rename modules with character 'b'
* [CAMEL-16012] Fix some sonar issues
* [CAMEL-16012] Fix root pom and rename billboard
billboard was renamed to match the other aggregate example
Co-authored-by: Matthias Streidel <ma...@senacor.com>
Co-authored-by: Claus Ibsen <cl...@gmail.com>
Co-authored-by: Claus Ibsen <da...@Mac-mini.local>
Co-authored-by: Andrea Cosentino <an...@gmail.com>
---
examples/README.adoc | 26 ++++----
.../README.adoc | 28 ++++----
.../pom.xml | 0
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../src/main/resources/broker.xml | 0
.../src/main/resources/camel-config.xml | 0
.../src/main/resources/log4j2.properties | 0
.../src/main/webapp/WEB-INF/web.xml | 0
.../README.adoc | 7 +-
.../pom.xml | 0
.../java/org/apache/camel/example/Application.java | 51 ++++++++-------
.../src/main/resources/log4j2.properties | 0
.../.gitignore | 0
.../README.adoc | 30 +++++----
.../{camel-example-aggregate => aggregate}/pom.xml | 0
.../camel/example/NumberAggregationStrategy.java | 0
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../resources/META-INF/spring/camel-context.xml | 0
.../src/main/resources/log4j2.properties | 0
.../{camel-example-any23 => any23}/README.adoc | 19 ++++--
examples/{camel-example-any23 => any23}/pom.xml | 0
.../camel/example/any23/Any23RouteBuilder.java | 75 ++++++++++++++++++++++
.../camel/example/any23/Any23StartupMessage.java | 12 ++--
.../apache/camel/example/any23/Application.java | 10 +--
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../src/main/resources/log4j2.properties | 0
.../README.adoc | 45 +++++++------
.../pom.xml | 0
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../resources/META-INF/spring/camel-context.xml | 0
.../src/main/resources/log4j2.properties | 0
.../{camel-example-artemis => artemis}/README.adoc | 55 ++++++++--------
.../{camel-example-artemis => artemis}/pom.xml | 0
.../src/data/order1.xml | 0
.../src/data/order2.xml | 0
.../apache/camel/example/artemis/ArtemisMain.java | 0
.../camel/example/artemis/CreateOrderRoute.java | 0
.../camel/example/artemis/WidgetGadgetRoute.java | 0
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../src/main/resources/log4j2.properties | 0
examples/{camel-example-as2 => as2}/README.adoc | 14 ++--
examples/{camel-example-as2 => as2}/pom.xml | 0
.../as2/ExamineAS2ServerEndpointExchange.java | 0
.../example/as2/ProvisionAS2ComponentCrypto.java | 0
.../as2/ProvisionExchangeMessageCrypto.java | 0
.../java/org/apache/camel/example/as2/Utils.java | 4 +-
.../src/main/resources/META-INF/LICENSE.txt | 0
.../src/main/resources/META-INF/NOTICE.txt | 0
.../resources/META-INF/spring/camel-context.xml | 0
.../src/main/resources/log4j.properties | 0
.../README.adoc | 22 +++----
.../pom.xml | 0
.../example/azurestorageblob/Application.java | 0
.../src/main/resources/log4j2.properties | 0
.../{camel-example-basic => basic}/README.adoc | 22 +++----
examples/{camel-example-basic => basic}/pom.xml | 0
.../org/apache/camel/example/basic/CamelBasic.java | 33 +++++-----
.../src/main/resources/log4j2.properties | 0
.../README.adoc | 18 +++---
.../pom.xml | 0
.../org/apache/camel/example/bigxml/Record.java | 0
.../camel/example/bigxml/StaxTokenizerTest.java | 0
.../org/apache/camel/example/bigxml/TestUtils.java | 0
.../camel/example/bigxml/XmlTokenizerTest.java | 0
.../src/test/resources/log4j2.properties | 0
.../README.adoc | 8 +--
.../pom.xml | 0
.../src/test/data/billboard_lyrics_1964-2015.csv | 0
.../camel/example/billboard/BillboardAggrTest.java | 0
.../apache/camel/example/billboard/SongRecord.java | 0
.../src/test/resources/log4j2.properties | 0
.../camel/example/any23/Any23RouteBuilder.java | 71 --------------------
examples/pom.xml | 22 +++----
78 files changed, 301 insertions(+), 271 deletions(-)
diff --git a/examples/README.adoc b/examples/README.adoc
index a107af6..ea7ddba 100644
--- a/examples/README.adoc
+++ b/examples/README.adoc
@@ -1,6 +1,6 @@
-# Welcome to the Apache Camel Examples
+= Welcome to the Apache Camel Examples
-= Introduction
+== Introduction
This directory contains the various examples for working with Apache
Camel. The examples can be run using Maven. When using the Maven
@@ -19,13 +19,13 @@ Number of Examples: 87 (0 deprecated)
| link:camel-example-micrometer/README.adoc[Micrometer] (camel-example-micrometer) | Advanced | An example showing how to work with Camel, Spring Java Config and Micrometer monitoring
-| link:camel-example-any23/README.adoc[Any23 example] (camel-example-any23) | Beginner | An example that uses the Any23 dataformat
+| link:any23/README.adoc[Any23 example] (camel-example-any23) | Beginner | An example that uses the Any23 dataformat
-| link:camel-example-as2/README.adoc[AS2 Example] (camel-example-as2) | Beginner | An example which demonstrates the use of the Camel AS2 component
+| link:as2/README.adoc[AS2 Example] (camel-example-as2) | Beginner | An example which demonstrates the use of the Camel AS2 component
-| link:camel-example-azure-storage-blob/README.adoc[Azure Storage Blob] (camel-example-azure-storage-blob) | Beginner | Azure Storage Blob example
+| link:azure-storage-blob/README.adoc[Azure Storage Blob] (camel-example-azure-storage-blob) | Beginner | Azure Storage Blob example
-| link:camel-example-basic/README.adoc[Basic] (camel-example-basic) | Beginner | Basic example
+| link:basic/README.adoc[Basic] (camel-example-basic) | Beginner | Basic example
| link:camel-example-cdi/README.adoc[CDI] (camel-example-cdi) | Beginner | An example showing how to work with Camel and CDI for dependency injection
@@ -104,15 +104,15 @@ Number of Examples: 87 (0 deprecated)
| link:camel-example-mongodb/README.adoc[Mongodb] (camel-example-mongodb) | Database | An example that uses Camel MongoDB component
-| link:camel-example-aggregate/README.adoc[Aggregate] (camel-example-aggregate) | EIP | Demonstrates the persistent support for the Camel aggregator
+| link:aggregate/README.adoc[Aggregate] (camel-example-aggregate) | EIP | Demonstrates the persistent support for the Camel aggregator
-| link:camel-example-aggregate-dist/README.adoc[Aggregate Dist] (camel-example-aggregate-dist) | EIP | How to use the JdbcAggregationRepository in a distributed environment
+| link:aggregate-dist/README.adoc[Aggregate Dist] (camel-example-aggregate-dist) | EIP | How to use the JdbcAggregationRepository in a distributed environment
-| link:camel-example-artemis/README.adoc[Widget Gadget using Apache ActiveMQ Artemis] (camel-example-artemis) | EIP | The widget and gadget example from the EIP book using Apache ActiveMQ Artemis
+| link:artemis/README.adoc[Widget Gadget using Apache ActiveMQ Artemis] (camel-example-artemis) | EIP | The widget and gadget example from the EIP book using Apache ActiveMQ Artemis
-| link:camel-example-bigxml-split/README.adoc[Bigxml Split] (camel-example-bigxml-split) | EIP | How to deal with big XML files in Camel
+| link:bigxml-split/README.adoc[Bigxml Split] (camel-example-bigxml-split) | EIP | How to deal with big XML files in Camel
-| link:camel-example-billboard-aggr/README.adoc[Billboard Aggr] (camel-example-billboard-aggr) | EIP | Billboard aggregation example
+| link:billboard-aggregate/README.adoc[Billboard Aggr] (camel-example-billboard-aggr) | EIP | Billboard aggregation example
| link:camel-example-cafe/README.adoc[Cafe] (camel-example-cafe) | EIP | A cafe example showing how to work with Camel
@@ -153,9 +153,9 @@ Number of Examples: 87 (0 deprecated)
| link:camel-example-splunk/README.adoc[Splunk] (camel-example-splunk) | Management and Monitoring | An example using Splunk
-| link:camel-example-activemq-tomcat/README.adoc[ActiveMQ Tomcat] (camel-example-activemq-tomcat) | Messaging | An example using ActiveMQ Broker and Camel with Apache Tomcat
+| link:activemq-tomcat/README.adoc[ActiveMQ Tomcat] (camel-example-activemq-tomcat) | Messaging | An example using ActiveMQ Broker and Camel with Apache Tomcat
-| link:camel-example-artemis-large-messages/README.adoc[Artemis Large Messages] (camel-example-artemis-large-messages) | Messaging | Demonstrates sending large messages (handles GBs in size) between Apache Camel and ActiveMQ Artemis in
+| link:artemis-large-messages/README.adoc[Artemis Large Messages] (camel-example-artemis-large-messages) | Messaging | Demonstrates sending large messages (handles GBs in size) between Apache Camel and ActiveMQ Artemis in
streaming mode
diff --git a/examples/camel-example-activemq-tomcat/README.adoc b/examples/activemq-tomcat/README.adoc
similarity index 57%
rename from examples/camel-example-activemq-tomcat/README.adoc
rename to examples/activemq-tomcat/README.adoc
index 2f48637..56e8220 100644
--- a/examples/camel-example-activemq-tomcat/README.adoc
+++ b/examples/activemq-tomcat/README.adoc
@@ -6,7 +6,7 @@ This example shows how you can embed Apache ActiveMQ Broker and Camel in
a web application, which can run on Apache Tomcat or other web
containers.
-This example embeds ActiveMQ Broker and a Camel application which will
+This example embeds ActiveMQ Broker and a Camel application, which will
continuously send a message per second to an inbox queue. Then another
Camel route will route messages from the inbox to the outbox queue.
@@ -20,27 +20,29 @@ Camel route will route messages from the inbox to the outbox queue.
You will need to build this example first:
-....
-mvn install
-....
+[source,sh]
+----
+$ mvn package
+----
=== Run
-Which will create a `+.war+` file in the target directly.
+Which will create a `.war` file in the target directly.
-You can then deploy this `+.war+` file in any web container such as
-Apache Tomcat, by copying the `+.war+` file to its `+/webapp+`
-directory.
+You can then deploy this `.war` file in any web container such as
+Apache Tomcat, by copying the `.war` file to its `/webapp`
+directory manually or via the following command:
-This example embeds ActiveMQ Broker and a Camel application which will
-continuously send a message per second to an inbox queue. Then another
-Camel route will route messages from the inbox to the outbox queue.
+[source,sh]
+----
+$ mv target/camel-example-activemq-tomcat.war src/main/webapp/
+----
=== Configuration
The ActiveMQ broker is configured in the
-`+src/main/resources/broker.xml+` file. And the Camel application in the
-`+src/main/resources/camel-context.xml+` file.
+`src/main/resources/broker.xml` file. The Camel application is configured in the
+`src/main/resources/camel-context.xml` file.
=== Help and contributions
diff --git a/examples/camel-example-activemq-tomcat/pom.xml b/examples/activemq-tomcat/pom.xml
similarity index 100%
rename from examples/camel-example-activemq-tomcat/pom.xml
rename to examples/activemq-tomcat/pom.xml
diff --git a/examples/camel-example-as2/src/main/resources/META-INF/LICENSE.txt b/examples/activemq-tomcat/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-as2/src/main/resources/META-INF/LICENSE.txt
rename to examples/activemq-tomcat/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-as2/src/main/resources/META-INF/NOTICE.txt b/examples/activemq-tomcat/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-as2/src/main/resources/META-INF/NOTICE.txt
rename to examples/activemq-tomcat/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-activemq-tomcat/src/main/resources/broker.xml b/examples/activemq-tomcat/src/main/resources/broker.xml
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/resources/broker.xml
rename to examples/activemq-tomcat/src/main/resources/broker.xml
diff --git a/examples/camel-example-activemq-tomcat/src/main/resources/camel-config.xml b/examples/activemq-tomcat/src/main/resources/camel-config.xml
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/resources/camel-config.xml
rename to examples/activemq-tomcat/src/main/resources/camel-config.xml
diff --git a/examples/camel-example-artemis/src/main/resources/log4j2.properties b/examples/activemq-tomcat/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-artemis/src/main/resources/log4j2.properties
rename to examples/activemq-tomcat/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-activemq-tomcat/src/main/webapp/WEB-INF/web.xml b/examples/activemq-tomcat/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/webapp/WEB-INF/web.xml
rename to examples/activemq-tomcat/src/main/webapp/WEB-INF/web.xml
diff --git a/examples/camel-example-aggregate-dist/README.adoc b/examples/aggregate-dist/README.adoc
similarity index 91%
rename from examples/camel-example-aggregate-dist/README.adoc
rename to examples/aggregate-dist/README.adoc
index 05ba456..d59c203 100644
--- a/examples/camel-example-aggregate-dist/README.adoc
+++ b/examples/aggregate-dist/README.adoc
@@ -9,9 +9,10 @@ in a distributed environment (multiple independent Camel Contexts).
You can build and run the example with this simple command:
-....
-mvn clean compile exec:java
-....
+[source,sh]
+----
+$ mvn clean compile exec:java
+----
=== Help and contributions
diff --git a/examples/camel-example-aggregate-dist/pom.xml b/examples/aggregate-dist/pom.xml
similarity index 100%
rename from examples/camel-example-aggregate-dist/pom.xml
rename to examples/aggregate-dist/pom.xml
diff --git a/examples/camel-example-aggregate-dist/src/main/java/org/apache/camel/example/Application.java b/examples/aggregate-dist/src/main/java/org/apache/camel/example/Application.java
similarity index 84%
rename from examples/camel-example-aggregate-dist/src/main/java/org/apache/camel/example/Application.java
rename to examples/aggregate-dist/src/main/java/org/apache/camel/example/Application.java
index 1bcd18c..9b75194 100644
--- a/examples/camel-example-aggregate-dist/src/main/java/org/apache/camel/example/Application.java
+++ b/examples/aggregate-dist/src/main/java/org/apache/camel/example/Application.java
@@ -22,17 +22,16 @@ import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.LoggingLevel;
import org.apache.camel.ProducerTemplate;
-import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
import org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository;
import org.apache.camel.spi.AggregationRepository;
-import org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.SingleConnectionDataSource;
+import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
@@ -58,18 +57,19 @@ public class Application {
private static final String DB_USER = "admin";
private static final String DB_PASS = "admin";
- private static String CORRELATION_ID, EXPECTED_RESULT;
- private static Queue<Integer> INPUT_QUEUE;
- private static CountDownLatch LATCH;
+ private static String correlationId;
+ private static String expectedResult;
+ private static Queue<Integer> inputQueue;
+ private static CountDownLatch latch;
public static void main(String[] args) throws Exception {
// init
- CORRELATION_ID = UUID.randomUUID().toString();
- EXPECTED_RESULT = IntStream.rangeClosed(1, END)
+ correlationId = UUID.randomUUID().toString();
+ expectedResult = IntStream.rangeClosed(1, END)
.mapToObj(Integer::toString).collect(Collectors.joining("."));
- INPUT_QUEUE = new ConcurrentLinkedQueue<>();
- IntStream.rangeClosed(1, END).forEach(INPUT_QUEUE::add);
- LATCH = new CountDownLatch(THREADS);
+ inputQueue = new ConcurrentLinkedQueue<>();
+ IntStream.rangeClosed(1, END).forEach(inputQueue::add);
+ latch = new CountDownLatch(THREADS);
// test
ExecutorService executor = Executors.newFixedThreadPool(THREADS);
@@ -78,7 +78,7 @@ public class Application {
}
// wait
- LATCH.await();
+ latch.await();
stop(executor);
}
@@ -105,7 +105,7 @@ public class Application {
camel.start();
LOG.debug("Camel started");
- LATCH.await();
+ latch.await();
camel.stop();
LOG.debug("Camel stopped");
} catch (Exception e) {
@@ -140,7 +140,7 @@ public class Application {
JdbcAggregationRepository repo = new JdbcAggregationRepository(txManager, "aggregation", ds);
repo.setUseRecovery(false);
repo.setStoreBodyAsText(false);
- return (AggregationRepository) repo;
+ return repo;
}
private static Exchange aggregationStrategy(Exchange oldExchange, Exchange newExchange) {
@@ -150,7 +150,7 @@ public class Application {
String body = oldExchange.getIn().getBody(String.class) + "."
+ newExchange.getIn().getBody(String.class);
oldExchange.getIn().setBody(body);
- LOG.trace("Queue: {}", INPUT_QUEUE);
+ LOG.trace("Queue: {}", inputQueue);
LOG.trace("Aggregation: {}", oldExchange.getIn().getBody());
return oldExchange;
}
@@ -160,7 +160,7 @@ public class Application {
final String body = exchange.getIn().getBody(String.class);
if (body != null && !body.isEmpty()) {
String[] a1 = body.split("\\.");
- String[] a2 = EXPECTED_RESULT.split("\\.");
+ String[] a2 = expectedResult.split("\\.");
if (a1.length == a2.length) {
Arrays.sort(a1);
Arrays.sort(a2);
@@ -188,17 +188,20 @@ public class Application {
}
static class MyProducerBean {
- public void run(Exchange exchange) throws Exception {
+ public void run(Exchange exchange) {
CamelContext context = exchange.getContext();
- ProducerTemplate template = context.createProducerTemplate();
- template.setThreadedAsyncMode(false);
- Endpoint endpoint = context.getEndpoint("direct:aggregator");
- Integer item = null;
- while ((item = INPUT_QUEUE.poll()) != null) {
- template.sendBodyAndHeader(endpoint, item, CID_HEADER, CORRELATION_ID);
+ try (ProducerTemplate template = context.createProducerTemplate()) {
+ template.setThreadedAsyncMode(false);
+ Endpoint endpoint = context.getEndpoint("direct:aggregator");
+ Integer item;
+ while ((item = inputQueue.poll()) != null) {
+ template.sendBodyAndHeader(endpoint, item, CID_HEADER, correlationId);
+ }
+ template.stop();
+ } catch (IOException e) {
+ LOG.error("Error during execution");
}
- template.stop();
- LATCH.countDown();
+ latch.countDown();
}
}
diff --git a/examples/camel-example-aggregate-dist/src/main/resources/log4j2.properties b/examples/aggregate-dist/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-aggregate-dist/src/main/resources/log4j2.properties
rename to examples/aggregate-dist/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-aggregate/.gitignore b/examples/aggregate/.gitignore
similarity index 100%
rename from examples/camel-example-aggregate/.gitignore
rename to examples/aggregate/.gitignore
diff --git a/examples/camel-example-aggregate/README.adoc b/examples/aggregate/README.adoc
similarity index 68%
rename from examples/camel-example-aggregate/README.adoc
rename to examples/aggregate/README.adoc
index 2d3a579..c48f601 100644
--- a/examples/camel-example-aggregate/README.adoc
+++ b/examples/aggregate/README.adoc
@@ -7,23 +7,23 @@ Camel 2.3) database persistence.
It's an interactive example where you can type in some numbers which
then are aggregated (summed, per this sample's aggregation strategy)
-whenever the user types `+STOP+`. +
+whenever the user types `STOP`.
The user can then enter more numbers to do another aggregation.
==== How it works
-The example is an interactive example where it prompt on the console for
-you to enter a number and press `+ENTER+`. The numbers you enter will
+The example is an interactive example where it prompts on the console for
+you to enter a number and press `ENTER`. The numbers you enter will
then be aggregated and persisted. That means you can at any time hit
-`+ctrl + c+` to shutdown Camel.
+`ctrl + c` to shut down Camel.
Then you should be able to start the example again and resume where you
-left. When you want to complete the aggregation you can enter `+STOP+`
+left. When you want to complete the aggregation you can enter `STOP`
as input and Camel will show you the result, which is the sum of all the
numbers entered.
-The persistent datastore is located in the `+data/hawtdb.dat+` file. Its
-automatic created the first time.
+The persistent datastore is located in the `data/hawtdb.dat` file. Its
+automatically created the first time.
==== Camel component used in this example
@@ -37,19 +37,21 @@ The example is run using Maven.
First compile the example by entering:
-....
-mvn compile
-....
+[source,sh]
+----
+$ mvn compile
+----
=== Run
To run the example type:
-....
-mvn camel:run
-....
+[source,sh]
+----
+$ mvn camel:run
+----
-To stop the example hit ctrl+c. If you restart it and resume entering
+To stop the example hit `ctrl + c`. If you restart it and resume entering
numbers you should see that it remembered previously entered values, as
it uses a persistent store.
diff --git a/examples/camel-example-aggregate/pom.xml b/examples/aggregate/pom.xml
similarity index 100%
rename from examples/camel-example-aggregate/pom.xml
rename to examples/aggregate/pom.xml
diff --git a/examples/camel-example-aggregate/src/main/java/org/apache/camel/example/NumberAggregationStrategy.java b/examples/aggregate/src/main/java/org/apache/camel/example/NumberAggregationStrategy.java
similarity index 100%
rename from examples/camel-example-aggregate/src/main/java/org/apache/camel/example/NumberAggregationStrategy.java
rename to examples/aggregate/src/main/java/org/apache/camel/example/NumberAggregationStrategy.java
diff --git a/examples/camel-example-artemis/src/main/resources/META-INF/LICENSE.txt b/examples/aggregate/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-artemis/src/main/resources/META-INF/LICENSE.txt
rename to examples/aggregate/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-artemis/src/main/resources/META-INF/NOTICE.txt b/examples/aggregate/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-artemis/src/main/resources/META-INF/NOTICE.txt
rename to examples/aggregate/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml b/examples/aggregate/src/main/resources/META-INF/spring/camel-context.xml
similarity index 100%
rename from examples/camel-example-aggregate/src/main/resources/META-INF/spring/camel-context.xml
rename to examples/aggregate/src/main/resources/META-INF/spring/camel-context.xml
diff --git a/examples/camel-example-basic/src/main/resources/log4j2.properties b/examples/aggregate/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-basic/src/main/resources/log4j2.properties
rename to examples/aggregate/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-any23/README.adoc b/examples/any23/README.adoc
similarity index 75%
rename from examples/camel-example-any23/README.adoc
rename to examples/any23/README.adoc
index a0bc955..58c7b95 100644
--- a/examples/camel-example-any23/README.adoc
+++ b/examples/any23/README.adoc
@@ -1,24 +1,29 @@
== Apache Any23 Example
-This example shows how to extract data from a page with RDF content using Apache Any23. In this example the Dbpedia webpage of a country (Ecuador) is processed with the camel-any23 dataformat as a RDF4J Model.
-The extracted information is filtered in order to select the URIS of the country's leaders through the Dbpedia property http://dbpedia.org/ontology/leader .
+=== Introduction
+
+This example shows how to extract data from a page with RDF content using Apache Any23. In this example the Dbpedia webpage of a country (Ecuador) is processed with the camel-any23 data format as a RDF4J Model.
+The extracted information is filtered in order to select the URIS of the country's leaders through the Dbpedia property http://dbpedia.org/ontology/leader.
Afterwards, the information of each leader is requested and presented in JSON-LD format.
-== How to run
+=== How to run
You can run this example using
- mvn compile exec:java
+[source,sh]
+----
+$ mvn compile exec:java
+----
-== More information about the camel-any23 Dataformat.
+=== More information about the camel-any23 data format.
You can find more information about camel-any23 at the website: https://github.com/apache/camel/blob/master/components/camel-any23/src/main/docs/any23-dataformat.adoc
-== More information about Apache Any23
+=== More information about Apache Any23
You can find more information about Apache Any23 at the website: https://any23.apache.org
-== More information about Apache Camel
+=== More information about Apache Camel
You can find more information about Apache Camel at the website: http://camel.apache.org/
diff --git a/examples/camel-example-any23/pom.xml b/examples/any23/pom.xml
similarity index 100%
rename from examples/camel-example-any23/pom.xml
rename to examples/any23/pom.xml
diff --git a/examples/any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java b/examples/any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java
new file mode 100644
index 0000000..3f82d58
--- /dev/null
+++ b/examples/any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java
@@ -0,0 +1,75 @@
+/*
+ * 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.example.any23;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.dataformat.Any23Type;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Model;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.ValueFactory;
+import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class Any23RouteBuilder extends RouteBuilder {
+
+ private static final String BASEURI = "http://mock.foo/bar";
+
+ @Override
+ public void configure() {
+
+ from("direct:start")
+ .log("Querying dbpedia:Ecuador ")
+ .to("http://dbpedia.org/page/Ecuador")
+ .unmarshal().any23(BASEURI)
+ .process(exchange -> {
+ ValueFactory vf = SimpleValueFactory.getInstance();
+ Model model = exchange.getIn().getBody(Model.class);
+
+ // Selecting the leaders of Ecuador
+ IRI propertyLeader = vf.createIRI("http://dbpedia.org/ontology/leader");
+ Set<Value> leadersResources = model.filter(null, propertyLeader, null).objects();
+ List<String> leadersList = new ArrayList<>();
+ for (Value leader : leadersResources) {
+ // Transform the leader resource (URI) into an browsable URL.
+ // For instance:
+ // http://dbpedia.org/resource/Oswaldo_Guayasam%C3%ADn -->
+ // http://dbpedia.org/page/Oswaldo_Guayasam%C3%ADn
+ String aLeader = leader.stringValue().replace("resource", "page");
+ leadersList.add(aLeader);
+ }
+ exchange.getIn().setBody(leadersList);
+
+ })
+ .log(" Content: ${body} ")
+ // Process each leader in a separate route.
+ // In order to extract more information.
+ .split(simple("${body}"))
+ .to("direct:extractMoreData");
+
+ from("direct:extractMoreData")
+ .log("Split ${body}")
+ .toD("${body}").unmarshal()
+ // Extract RDF data of the leaders as JSONLD
+ .any23(BASEURI, Any23Type.JSONLD)
+ .log(" Result : ${body} ")
+ .to("log:result");
+ }
+}
diff --git a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java b/examples/any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
similarity index 79%
rename from examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
rename to examples/any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
index 683f992..55db52b 100644
--- a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
+++ b/examples/any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
@@ -20,12 +20,16 @@ import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.StartupListener;
+import java.io.IOException;
+
public class Any23StartupMessage implements StartupListener {
@Override
- public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception {
- ProducerTemplate template = context.createProducerTemplate();
- template.sendBody("direct:start", "This is a test message to run the example");
+ public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) {
+ try (ProducerTemplate template = context.createProducerTemplate()) {
+ template.sendBody("direct:start", "This is a test message to run the example");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
-
}
diff --git a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java b/examples/any23/src/main/java/org/apache/camel/example/any23/Application.java
similarity index 82%
rename from examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
rename to examples/any23/src/main/java/org/apache/camel/example/any23/Application.java
index 7d5e3c0..317ba08 100644
--- a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
+++ b/examples/any23/src/main/java/org/apache/camel/example/any23/Application.java
@@ -25,10 +25,10 @@ public final class Application {
}
public static void main(String[] args) throws Exception {
- CamelContext context = new DefaultCamelContext();
- context.addRoutes(new Any23RouteBuilder());
- context.start();
- context.addStartupListener(new Any23StartupMessage());
+ try (CamelContext context = new DefaultCamelContext()) {
+ context.addRoutes(new Any23RouteBuilder());
+ context.start();
+ context.addStartupListener(new Any23StartupMessage());
+ }
}
-
}
diff --git a/examples/camel-example-artemis-large-messages/src/main/resources/META-INF/LICENSE.txt b/examples/any23/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-artemis-large-messages/src/main/resources/META-INF/LICENSE.txt
rename to examples/any23/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-artemis-large-messages/src/main/resources/META-INF/NOTICE.txt b/examples/any23/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-artemis-large-messages/src/main/resources/META-INF/NOTICE.txt
rename to examples/any23/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-any23/src/main/resources/log4j2.properties b/examples/any23/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-any23/src/main/resources/log4j2.properties
rename to examples/any23/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-artemis-large-messages/README.adoc b/examples/artemis-large-messages/README.adoc
similarity index 78%
rename from examples/camel-example-artemis-large-messages/README.adoc
rename to examples/artemis-large-messages/README.adoc
index 7e41de3..18433f2 100644
--- a/examples/camel-example-artemis-large-messages/README.adoc
+++ b/examples/artemis-large-messages/README.adoc
@@ -11,7 +11,7 @@ such as 256/512mb etc, and still be able to send messages in GB of sizes
between them.
This works by spool big messages to disk. Artemis spool large messages
-to its `+data/large-messages+` directory, and Camel uses stream caching
+to its `data/large-messages` directory, and Camel uses stream caching
to spool to a temporary directory during routing.
=== Build
@@ -20,9 +20,10 @@ The example is run using Maven.
First compile the example by entering:
-....
-mvn compile
-....
+[source,sh]
+----
+$ mvn compile
+----
=== Install ActiveMQ Artemis
@@ -31,44 +32,48 @@ Artemis with latest defined version a special profile is added. It's
necessary to run following Maven command for do this during example
install:
-....
-mvn install -P artemis
-....
+[source,sh]
+----
+$ mvn install -P artemis
+----
=== Run ActiveMQ Artemis
To start configured ActiveMQ Artemis instance in a shell use:
-....
+[source,sh]
+----
$ target/artemis-instance/bin/artemis run
-....
+----
Which startup ActiveMQ Artemis in the foreground and keeps it running
-until you hit ctrl+c to shutdown ActiveMQ Artemis.
+until you hit `ctrl+c` to shut down ActiveMQ Artemis.
=== Run Camel
Before running this example, then ensure the JVM has limited memory by
-executing
+executing the following command in a new shell:
-....
-export MAVEN_OPTS="-Xmx256m"
-....
+[source,sh]
+----
+$ export MAVEN_OPTS="-Xmx256m"
+----
And then start the Camel application:
-....
-mvn camel:run
-....
+[source,sh]
+----
+$ mvn camel:run
+----
-You can then copy files to `+target/inbox+` folder which is send to
+You can then copy files to `target/inbox` folder which is send to
Artemis, and then back again to Camel and written to the
-`+target/outbox+` folder.
+`target/outbox` folder.
This should work for small and big files such as files with sizes of GB.
The JVM should not run out of memory.
-To stop the example hit ctrl+c. If you restart it and resume entering
+To stop the example hit `ctrl+c`. If you restart it and resume entering
numbers you should see that it remembered previously entered values, as
it uses a persistent store.
diff --git a/examples/camel-example-artemis-large-messages/pom.xml b/examples/artemis-large-messages/pom.xml
similarity index 100%
rename from examples/camel-example-artemis-large-messages/pom.xml
rename to examples/artemis-large-messages/pom.xml
diff --git a/examples/camel-example-any23/src/main/resources/META-INF/LICENSE.txt b/examples/artemis-large-messages/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-any23/src/main/resources/META-INF/LICENSE.txt
rename to examples/artemis-large-messages/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-any23/src/main/resources/META-INF/NOTICE.txt b/examples/artemis-large-messages/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-any23/src/main/resources/META-INF/NOTICE.txt
rename to examples/artemis-large-messages/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-artemis-large-messages/src/main/resources/META-INF/spring/camel-context.xml b/examples/artemis-large-messages/src/main/resources/META-INF/spring/camel-context.xml
similarity index 100%
rename from examples/camel-example-artemis-large-messages/src/main/resources/META-INF/spring/camel-context.xml
rename to examples/artemis-large-messages/src/main/resources/META-INF/spring/camel-context.xml
diff --git a/examples/camel-example-artemis-large-messages/src/main/resources/log4j2.properties b/examples/artemis-large-messages/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-artemis-large-messages/src/main/resources/log4j2.properties
rename to examples/artemis-large-messages/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-artemis/README.adoc b/examples/artemis/README.adoc
similarity index 63%
rename from examples/camel-example-artemis/README.adoc
rename to examples/artemis/README.adoc
index 356ac96..7badb2a 100644
--- a/examples/camel-example-artemis/README.adoc
+++ b/examples/artemis/README.adoc
@@ -24,57 +24,62 @@ _application server_ but just a plain old _Java Main_.
You will need to build this example first:
-....
-mvn install
-....
+[source,sh]
+----
+$ mvn package
+----
=== Install ActiveMQ Artemis
To automate downloading, unpacking and configuration of Apache ActiveMQ
Artemis with latest defined version a special profile is added. It's
-necessary to run following Maven command for do this during example
+necessary to run the following Maven command for this during example
install:
-....
-mvn install -P artemis
-....
+[source,sh]
+----
+$ mvn install -P artemis
+----
=== Run ActiveMQ Artemis
To start configured ActiveMQ Artemis instance in a shell use:
-....
+[source,sh]
+----
$ target/artemis-instance/bin/artemis run
-....
+----
Which startup ActiveMQ Artemis in the foreground and keeps it running
-until you hit ctrl+c to shutdown ActiveMQ Artemis.
+until you hit `ctrl+c` to shut down ActiveMQ Artemis.
=== Run Camel
The Camel application connects to the message broker on url:
-`+tcp://localhost:61616+`. The url can be changed in the
-`+ArtemisMain.java+` source code.
+`tcp://localhost:61616`. The url can be changed in the
+`ArtemisMain.java` source code.
When the ActiveMQ Artemis broker is running, then you can run this
-example using:
+example using the following command in a new shell:
-....
-mvn compile exec:java
-....
+[source,sh]
+----
+$ mvn compile exec:java
+----
When the Camel application runs, you should see 2 orders being processed
and logged to the console, with an output similar to:
-....
-2019-04-26 11:04:27,154 [sumer[newOrder]] INFO gadget - Exchange[ExchangePattern: InOnly, BodyType: String, Body: ...<order> <customerId>456</customerId> <product>gadget</product> <amount>3</amount></order>]
-2019-04-26 11:04:27,162 [sumer[newOrder]] INFO widget - Exchange[ExchangePattern: InOnly, BodyType: String, Body: ...<order> <customerId>123</customerId> <product>widget</product> <amount>2</amount></order>]
-....
+[source,sh]
+----
+$ 2019-04-26 11:04:27,154 [sumer[newOrder]] INFO gadget - Exchange[ExchangePattern: InOnly, BodyType: String, Body: ...<order> <customerId>456</customerId> <product>gadget</product> <amount>3</amount></order>]
+$ 2019-04-26 11:04:27,162 [sumer[newOrder]] INFO widget - Exchange[ExchangePattern: InOnly, BodyType: String, Body: ...<order> <customerId>123</customerId> <product>widget</product> <amount>2</amount></order>]
+----
You can access the ActiveMQ Artemis web console using
-http://localhost:8161/console and then browse the queues. The user name
-and password for accessing the console are setup when creating the
-broker instance and are, in this example, set to `+admin+` and `+admin+`
+http://localhost:8161/console and then browse the queues. The username
+and password for accessing the console are set up when creating the
+broker instance and are, in this example, set to `admin` and `admin`
respectively.
You should see the three queues:
@@ -83,12 +88,12 @@ You should see the three queues:
* widget
* gadget
-The Camel application can be stopped pressing ctrl+c in the shell.
+The Camel application can be stopped pressing `ctrl+c` in the shell.
=== Configuration
The Camel application is configured in the
-`+src/main/java/org/apache/camel/example/ArtemisMain.java+` file.
+`src/main/java/org/apache/camel/example/ArtemisMain.java` file.
=== Help and contributions
diff --git a/examples/camel-example-artemis/pom.xml b/examples/artemis/pom.xml
similarity index 100%
rename from examples/camel-example-artemis/pom.xml
rename to examples/artemis/pom.xml
diff --git a/examples/camel-example-artemis/src/data/order1.xml b/examples/artemis/src/data/order1.xml
similarity index 100%
rename from examples/camel-example-artemis/src/data/order1.xml
rename to examples/artemis/src/data/order1.xml
diff --git a/examples/camel-example-artemis/src/data/order2.xml b/examples/artemis/src/data/order2.xml
similarity index 100%
rename from examples/camel-example-artemis/src/data/order2.xml
rename to examples/artemis/src/data/order2.xml
diff --git a/examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/ArtemisMain.java b/examples/artemis/src/main/java/org/apache/camel/example/artemis/ArtemisMain.java
similarity index 100%
rename from examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/ArtemisMain.java
rename to examples/artemis/src/main/java/org/apache/camel/example/artemis/ArtemisMain.java
diff --git a/examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/CreateOrderRoute.java b/examples/artemis/src/main/java/org/apache/camel/example/artemis/CreateOrderRoute.java
similarity index 100%
rename from examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/CreateOrderRoute.java
rename to examples/artemis/src/main/java/org/apache/camel/example/artemis/CreateOrderRoute.java
diff --git a/examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/WidgetGadgetRoute.java b/examples/artemis/src/main/java/org/apache/camel/example/artemis/WidgetGadgetRoute.java
similarity index 100%
rename from examples/camel-example-artemis/src/main/java/org/apache/camel/example/artemis/WidgetGadgetRoute.java
rename to examples/artemis/src/main/java/org/apache/camel/example/artemis/WidgetGadgetRoute.java
diff --git a/examples/camel-example-aggregate/src/main/resources/META-INF/LICENSE.txt b/examples/artemis/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-aggregate/src/main/resources/META-INF/LICENSE.txt
rename to examples/artemis/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-aggregate/src/main/resources/META-INF/NOTICE.txt b/examples/artemis/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-aggregate/src/main/resources/META-INF/NOTICE.txt
rename to examples/artemis/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-activemq-tomcat/src/main/resources/log4j2.properties b/examples/artemis/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/resources/log4j2.properties
rename to examples/artemis/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-as2/README.adoc b/examples/as2/README.adoc
similarity index 89%
rename from examples/camel-example-as2/README.adoc
rename to examples/as2/README.adoc
index 6bddd76..5de7976 100644
--- a/examples/camel-example-as2/README.adoc
+++ b/examples/as2/README.adoc
@@ -12,17 +12,19 @@ producing AS2 messages over HTTP request.
You will need to compile this example first:
-....
-mvn compile
-....
+[source,sh]
+----
+$ mvn compile
+----
=== Run
To run the example type
-....
-mvn camel:run
-....
+[source,sh]
+----
+$ mvn camel:run
+----
=== Help and contributions
diff --git a/examples/camel-example-as2/pom.xml b/examples/as2/pom.xml
similarity index 100%
rename from examples/camel-example-as2/pom.xml
rename to examples/as2/pom.xml
diff --git a/examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ExamineAS2ServerEndpointExchange.java b/examples/as2/src/main/java/org/apache/camel/example/as2/ExamineAS2ServerEndpointExchange.java
similarity index 100%
rename from examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ExamineAS2ServerEndpointExchange.java
rename to examples/as2/src/main/java/org/apache/camel/example/as2/ExamineAS2ServerEndpointExchange.java
diff --git a/examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ProvisionAS2ComponentCrypto.java b/examples/as2/src/main/java/org/apache/camel/example/as2/ProvisionAS2ComponentCrypto.java
similarity index 100%
rename from examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ProvisionAS2ComponentCrypto.java
rename to examples/as2/src/main/java/org/apache/camel/example/as2/ProvisionAS2ComponentCrypto.java
diff --git a/examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ProvisionExchangeMessageCrypto.java b/examples/as2/src/main/java/org/apache/camel/example/as2/ProvisionExchangeMessageCrypto.java
similarity index 100%
rename from examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/ProvisionExchangeMessageCrypto.java
rename to examples/as2/src/main/java/org/apache/camel/example/as2/ProvisionExchangeMessageCrypto.java
diff --git a/examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/Utils.java b/examples/as2/src/main/java/org/apache/camel/example/as2/Utils.java
similarity index 98%
rename from examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/Utils.java
rename to examples/as2/src/main/java/org/apache/camel/example/as2/Utils.java
index 33307e1..f516944 100644
--- a/examples/camel-example-as2/src/main/java/org/apache/camel/example/as2/Utils.java
+++ b/examples/as2/src/main/java/org/apache/camel/example/as2/Utils.java
@@ -46,14 +46,14 @@ public final class Utils {
private Utils() {
}
- public static AuthorityKeyIdentifier createAuthorityKeyId(PublicKey pub) throws IOException {
+ public static AuthorityKeyIdentifier createAuthorityKeyId(PublicKey pub) {
SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(pub.getEncoded());
BcX509ExtensionUtils utils = new BcX509ExtensionUtils();
return utils.createAuthorityKeyIdentifier(info);
}
- public static SubjectKeyIdentifier createSubjectKeyId(PublicKey pub) throws IOException {
+ public static SubjectKeyIdentifier createSubjectKeyId(PublicKey pub) {
SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(pub.getEncoded());
return new BcX509ExtensionUtils().createSubjectKeyIdentifier(info);
diff --git a/examples/camel-example-activemq-tomcat/src/main/resources/META-INF/LICENSE.txt b/examples/as2/src/main/resources/META-INF/LICENSE.txt
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/resources/META-INF/LICENSE.txt
rename to examples/as2/src/main/resources/META-INF/LICENSE.txt
diff --git a/examples/camel-example-activemq-tomcat/src/main/resources/META-INF/NOTICE.txt b/examples/as2/src/main/resources/META-INF/NOTICE.txt
similarity index 100%
rename from examples/camel-example-activemq-tomcat/src/main/resources/META-INF/NOTICE.txt
rename to examples/as2/src/main/resources/META-INF/NOTICE.txt
diff --git a/examples/camel-example-as2/src/main/resources/META-INF/spring/camel-context.xml b/examples/as2/src/main/resources/META-INF/spring/camel-context.xml
similarity index 100%
rename from examples/camel-example-as2/src/main/resources/META-INF/spring/camel-context.xml
rename to examples/as2/src/main/resources/META-INF/spring/camel-context.xml
diff --git a/examples/camel-example-as2/src/main/resources/log4j.properties b/examples/as2/src/main/resources/log4j.properties
similarity index 100%
rename from examples/camel-example-as2/src/main/resources/log4j.properties
rename to examples/as2/src/main/resources/log4j.properties
diff --git a/examples/camel-example-azure-storage-blob/README.adoc b/examples/azure-storage-blob/README.adoc
similarity index 74%
rename from examples/camel-example-azure-storage-blob/README.adoc
rename to examples/azure-storage-blob/README.adoc
index 7986864..7efef1e 100644
--- a/examples/camel-example-azure-storage-blob/README.adoc
+++ b/examples/azure-storage-blob/README.adoc
@@ -16,25 +16,21 @@ Set `ACCOUNT` & `ACCESS_KEY` & `BLOB_CONTAINER_NAME` for start example.
You will need to compile this example first:
-....
-mvn compile
-....
+[source,sh]
+----
+$ mvn compile
+----
=== Run
To run the example type
-....
-mvn camel:run
-....
+[source,sh]
+----
+$ mvn camel:run
+----
-The
-
-To stop the example hit ctrl+c
-
-You can also run the example from your editor such as Eclipse, IDEA etc,
-by opening the org.apache.camel.example.basic.CamelBasic class
-and then right click, and chose run java application.
+To stop the example hit `ctrl+c`
=== Help and contributions
diff --git a/examples/camel-example-azure-storage-blob/pom.xml b/examples/azure-storage-blob/pom.xml
similarity index 100%
rename from examples/camel-example-azure-storage-blob/pom.xml
rename to examples/azure-storage-blob/pom.xml
diff --git a/examples/camel-example-azure-storage-blob/src/main/java/org/apache/camel/example/azurestorageblob/Application.java b/examples/azure-storage-blob/src/main/java/org/apache/camel/example/azurestorageblob/Application.java
similarity index 100%
rename from examples/camel-example-azure-storage-blob/src/main/java/org/apache/camel/example/azurestorageblob/Application.java
rename to examples/azure-storage-blob/src/main/java/org/apache/camel/example/azurestorageblob/Application.java
diff --git a/examples/camel-example-azure-storage-blob/src/main/resources/log4j2.properties b/examples/azure-storage-blob/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-azure-storage-blob/src/main/resources/log4j2.properties
rename to examples/azure-storage-blob/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-basic/README.adoc b/examples/basic/README.adoc
similarity index 64%
rename from examples/camel-example-basic/README.adoc
rename to examples/basic/README.adoc
index 24495ea..53ce924 100644
--- a/examples/camel-example-basic/README.adoc
+++ b/examples/basic/README.adoc
@@ -7,31 +7,31 @@ This is a very basic example that shows how to get started with Camel.
This example shows you that Camel can be used in standalone mode
as a _public static void main_ application.
-The example has only 1 java file in the `CamelBasic.java` located in the src folder.
+The example has only 1 java file in the link:../basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java[`CamelBasic.java`] located in the src folder.
There is code comments explaining in more details.
=== Build
You will need to compile this example first:
-....
-mvn compile
-....
+[source,sh]
+----
+$ mvn compile
+----
=== Run
To run the example type
-....
-mvn camel:run
-....
+[source,sh]
+----
+$ mvn camel:run
+----
-The
-
-To stop the example hit ctrl+c
+To stop the example hit `ctrl+c`
You can also run the example from your editor such as Eclipse, IDEA etc,
-by opening the org.apache.camel.example.basic.CamelBasic class
+by opening the class link:../basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java[org.apache.camel.example.basic.CamelBasic.java]
and then right click, and chose run java application.
=== Help and contributions
diff --git a/examples/camel-example-basic/pom.xml b/examples/basic/pom.xml
similarity index 100%
rename from examples/camel-example-basic/pom.xml
rename to examples/basic/pom.xml
diff --git a/examples/camel-example-basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java b/examples/basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java
similarity index 64%
rename from examples/camel-example-basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java
rename to examples/basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java
index 528b9cd..da79cc9 100644
--- a/examples/camel-example-basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java
+++ b/examples/basic/src/main/java/org/apache/camel/example/basic/CamelBasic.java
@@ -27,25 +27,26 @@ public final class CamelBasic {
public static void main(String[] args) throws Exception {
// create a CamelContext
- CamelContext camel = new DefaultCamelContext();
+ try (CamelContext camel = new DefaultCamelContext()) {
- // add routes which can be inlined as anonymous inner class
- // (to keep all code in a single java file for this basic example)
- camel.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("timer:foo")
- .log("Hello Camel");
- }
- });
+ // add routes which can be inlined as anonymous inner class
+ // (to keep all code in a single java file for this basic example)
+ camel.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("timer:foo")
+ .log("Hello Camel");
+ }
+ });
- // start is not blocking
- camel.start();
+ // start is not blocking
+ camel.start();
- // so run for 10 seconds
- Thread.sleep(10_000);
+ // so run for 10 seconds
+ Thread.sleep(10_000);
- // and then stop nicely
- camel.stop();
+ // and then stop nicely
+ camel.stop();
+ }
}
}
diff --git a/examples/camel-example-aggregate/src/main/resources/log4j2.properties b/examples/basic/src/main/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-aggregate/src/main/resources/log4j2.properties
rename to examples/basic/src/main/resources/log4j2.properties
diff --git a/examples/camel-example-bigxml-split/README.adoc b/examples/bigxml-split/README.adoc
similarity index 78%
rename from examples/camel-example-bigxml-split/README.adoc
rename to examples/bigxml-split/README.adoc
index cfa5c06..e087f44 100644
--- a/examples/camel-example-bigxml-split/README.adoc
+++ b/examples/bigxml-split/README.adoc
@@ -5,19 +5,19 @@
This example shows how to deal with big XML files in Camel.
The XPath tokenizer will load the entire XML content into memory, so
-it's not well suited for very big XML payloads. +
-Instead you can use the StAX or XML tokenizers to efficiently iterate
-the XML payload in a streamed fashion. +
+it's not well suited for very big XML payloads.
+Instead, you can use the StAX or XML tokenizers to efficiently iterate
+the XML payload in a streamed fashion.
For more information please read the
http://camel.apache.org/splitter.html[official documentation].
There are 2 tests:
[arabic]
-. `+StaxTokenizerTest+` : requires using JAXB and process messages using
+. `StaxTokenizerTest` : requires using JAXB and process messages using
a SAX ContentHandler
-. `+XmlTokenizerTest+` : easier to use but can't handle complex XML
-structures (i.e. nested naming clash)
+. `XmlTokenizerTest` : easier to use but can't handle complex XML
+structures (i.e. nested naming clash)
The test XML contains a simple collection of records.
@@ -35,7 +35,7 @@ The test XML contains a simple collection of records.
You can customize numOfRecords and maxWaitTime to do performance tests
with different payloads. +
Max JVM heap is restricted to 20 MB to show that it works with a very
-limited amount of memory (see `+pom.xml+`).
+limited amount of memory (see `pom.xml`).
There are also a number of optional runtime settings: - no cache enabled
- no parallel processing - no mock endpoints with in-memory exchange
@@ -44,11 +44,11 @@ instrumentation
=== Build and run
-The test XML file is built once beforehand using `+@BeforeClass+`.
+The test XML file is built once beforehand using `@BeforeClass`.
[source,sh]
----
-mvn clean test -DskipTests=false
+$ mvn test
----
=== Test results
diff --git a/examples/camel-example-bigxml-split/pom.xml b/examples/bigxml-split/pom.xml
similarity index 100%
rename from examples/camel-example-bigxml-split/pom.xml
rename to examples/bigxml-split/pom.xml
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/Record.java b/examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/Record.java
similarity index 100%
rename from examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/Record.java
rename to examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/Record.java
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java b/examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
similarity index 100%
rename from examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
rename to examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java b/examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
similarity index 100%
rename from examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
rename to examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java b/examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
similarity index 100%
rename from examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
rename to examples/bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
diff --git a/examples/camel-example-bigxml-split/src/test/resources/log4j2.properties b/examples/bigxml-split/src/test/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-bigxml-split/src/test/resources/log4j2.properties
rename to examples/bigxml-split/src/test/resources/log4j2.properties
diff --git a/examples/camel-example-billboard-aggr/README.adoc b/examples/billboard-aggregate/README.adoc
similarity index 87%
rename from examples/camel-example-billboard-aggr/README.adoc
rename to examples/billboard-aggregate/README.adoc
index 51a4b4c..b4845e3 100644
--- a/examples/camel-example-billboard-aggr/README.adoc
+++ b/examples/billboard-aggregate/README.adoc
@@ -2,10 +2,10 @@
=== Introduction
-The `+billboard_lyrics_1964-2015+` CSV dataset contains the TOP100 songs
-with lyrics for each year. +
+The `billboard_lyrics_1964-2015` CSV dataset contains the TOP100 songs
+with lyrics for each year.
We can compute the TOP20 artists with most songs on Billboard using
-Split and Aggregate EIPs. +
+Split and Aggregate EIPs.
Build statistics is not the Camel core business but, as shown, you can
easily do it!
@@ -42,7 +42,7 @@ Build and run the test with this single command.
[source,sh]
----
-mvn clean test
+$ mvn test
----
=== Help and contributions
diff --git a/examples/camel-example-billboard-aggr/pom.xml b/examples/billboard-aggregate/pom.xml
similarity index 100%
rename from examples/camel-example-billboard-aggr/pom.xml
rename to examples/billboard-aggregate/pom.xml
diff --git a/examples/camel-example-billboard-aggr/src/test/data/billboard_lyrics_1964-2015.csv b/examples/billboard-aggregate/src/test/data/billboard_lyrics_1964-2015.csv
similarity index 100%
rename from examples/camel-example-billboard-aggr/src/test/data/billboard_lyrics_1964-2015.csv
rename to examples/billboard-aggregate/src/test/data/billboard_lyrics_1964-2015.csv
diff --git a/examples/camel-example-billboard-aggr/src/test/java/org/apache/camel/example/billboard/BillboardAggrTest.java b/examples/billboard-aggregate/src/test/java/org/apache/camel/example/billboard/BillboardAggrTest.java
similarity index 100%
rename from examples/camel-example-billboard-aggr/src/test/java/org/apache/camel/example/billboard/BillboardAggrTest.java
rename to examples/billboard-aggregate/src/test/java/org/apache/camel/example/billboard/BillboardAggrTest.java
diff --git a/examples/camel-example-billboard-aggr/src/test/java/org/apache/camel/example/billboard/SongRecord.java b/examples/billboard-aggregate/src/test/java/org/apache/camel/example/billboard/SongRecord.java
similarity index 100%
rename from examples/camel-example-billboard-aggr/src/test/java/org/apache/camel/example/billboard/SongRecord.java
rename to examples/billboard-aggregate/src/test/java/org/apache/camel/example/billboard/SongRecord.java
diff --git a/examples/camel-example-billboard-aggr/src/test/resources/log4j2.properties b/examples/billboard-aggregate/src/test/resources/log4j2.properties
similarity index 100%
rename from examples/camel-example-billboard-aggr/src/test/resources/log4j2.properties
rename to examples/billboard-aggregate/src/test/resources/log4j2.properties
diff --git a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java b/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java
deleted file mode 100644
index 9cf3453..0000000
--- a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23RouteBuilder.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.example.any23;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.dataformat.Any23Type;
-import org.eclipse.rdf4j.model.IRI;
-import org.eclipse.rdf4j.model.Model;
-import org.eclipse.rdf4j.model.Value;
-import org.eclipse.rdf4j.model.ValueFactory;
-import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
-
-public class Any23RouteBuilder extends RouteBuilder {
-
- private static final String BASEURI = "http://mock.foo/bar";
-
- @Override
- public void configure() {
-
- from("direct:start").log("Querying dbpedia:Ecuador ").to("http://dbpedia.org/page/Ecuador").unmarshal().any23(BASEURI).process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- ValueFactory vf = SimpleValueFactory.getInstance();
- Model model = exchange.getIn().getBody(Model.class);
-
- // Selecting the leaders of Ecuador
- IRI propertyLeader = vf.createIRI("http://dbpedia.org/ontology/leader");
- Set<Value> leadersResources = model.filter(null, propertyLeader, null).objects();
- List<String> leadersList = new ArrayList<>();
- for (Value leader : leadersResources) {
- // Transform the leader resource (URI) into an broweable
- // URL.
- // For instance:
- // http://dbpedia.org/resource/Oswaldo_Guayasam%C3%ADn -->
- // http://dbpedia.org/page/Oswaldo_Guayasam%C3%ADn
- String aLeader = leader.stringValue().replace("resource", "page");
- leadersList.add(aLeader);
- }
- exchange.getIn().setBody(leadersList);
-
- }
- }).log(" Content: ${body} ")
- // Process each leader in a separate route.
- // In order to extract more information.
- .split(simple("${body}")).to("direct:extractMoreData");
-
- from("direct:extractMoreData").log("Split ${body}").toD("${body}").unmarshal()
- // Extract RDF data of the leaders as JSONLD
- .any23(BASEURI, Any23Type.JSONLD).log(" Result : ${body} ").to("log:result");
- }
-
-}
diff --git a/examples/pom.xml b/examples/pom.xml
index 7da0eb4..9f2381b 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -79,16 +79,17 @@
</distributionManagement>
<modules>
- <module>camel-example-activemq-tomcat</module>
- <module>camel-example-aggregate</module>
- <module>camel-example-aggregate-dist</module>
- <module>camel-example-any23</module>
- <module>camel-example-artemis</module>
- <module>camel-example-artemis-large-messages</module>
- <module>camel-example-as2</module>
- <module>camel-example-basic</module>
- <module>camel-example-billboard-aggr</module>
- <module>camel-example-bigxml-split</module>
+ <module>activemq-tomcat</module>
+ <module>aggregate</module>
+ <module>aggregate-dist</module>
+ <module>any23</module>
+ <module>artemis</module>
+ <module>artemis-large-messages</module>
+ <module>as2</module>
+ <module>azure-storage-blob</module>
+ <module>basic</module>
+ <module>billboard-aggregate</module>
+ <module>bigxml-split</module>
<module>camel-example-cafe</module>
<module>camel-example-cafe-endpointdsl</module>
<module>camel-example-cassandra-kubernetes</module>
@@ -165,7 +166,6 @@
<module>camel-example-widget-gadget-cdi</module>
<module>camel-example-widget-gadget-java</module>
<module>camel-example-widget-gadget-xml</module>
- <module>camel-example-azure-storage-blob</module>
</modules>
<properties>