camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] branch master updated: Fixed CS for camel-any23-example
Date Thu, 29 Aug 2019 07:33:47 GMT
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 72574a7  Fixed CS for camel-any23-example
72574a7 is described below

commit 72574a7fa56012f7e42e98268c4ef3d24efb0959
Author: Andrea Cosentino <ancosen@gmail.com>
AuthorDate: Thu Aug 29 09:31:47 2019 +0200

    Fixed CS for camel-any23-example
---
 .../camel/example/any23/Any23RouteBuilder.java     | 54 +++++++++-------------
 .../camel/example/any23/Any23StartupMessage.java   | 10 ++--
 .../apache/camel/example/any23/Application.java    | 17 ++++---
 3 files changed, 37 insertions(+), 44 deletions(-)

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
index 3275e31..98ee77c 100644
--- 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
@@ -31,50 +31,40 @@ import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
 
 public class Any23RouteBuilder extends RouteBuilder {
 
-  private static final String BASEURI = "http://mock.foo/bar";
+    private static final String BASEURI = "http://mock.foo/bar";
 
-  @Override
-  public void configure() {
+    @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 {
+        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
+                // 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);
+                    // 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");
+            }
+        }).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");
-  }
+        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/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
index b82f623..683f992 100644
--- a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
+++ b/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Any23StartupMessage.java
@@ -22,10 +22,10 @@ import org.apache.camel.StartupListener;
 
 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");
-  }
+    @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");
+    }
 
 }
diff --git a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
b/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
index 729b0b7..7d5e3c0 100644
--- a/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
+++ b/examples/camel-example-any23/src/main/java/org/apache/camel/example/any23/Application.java
@@ -19,13 +19,16 @@ package org.apache.camel.example.any23;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
 
-public class Application {
+public final class Application {
+    
+    private Application() {
+    }
 
-  public static void main(String[] args) throws Exception {
-    CamelContext context = new DefaultCamelContext();
-    context.addRoutes(new Any23RouteBuilder());
-    context.start();
-    context.addStartupListener(new Any23StartupMessage());
-  }
+    public static void main(String[] args) throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        context.addRoutes(new Any23RouteBuilder());
+        context.start();
+        context.addStartupListener(new Any23StartupMessage());
+    }
 
 }


Mime
View raw message