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

commit 0282cebf704f4eb965c8845386ce0e199a89dbb2
Author: Jim MacInnes <[email protected]>
AuthorDate: Fri Jul 10 08:33:56 2020 -0700

    Various clean-up recommendations from oscerd.
---
 components/camel-jsonata/pom.xml                   |  6 ++---
 .../src/main/docs/jsonata-component.adoc           |  6 ++---
 .../camel/component/jsonata/JsonataConstants.java  |  4 ++--
 .../camel/component/jsonata/JsonataEndpoint.java   | 26 +++++++++-------------
 .../{jolt => jsonata}/JsonataFirstSampleTest.java  |  5 ++---
 components/pom.xml                                 |  1 +
 parent/pom.xml                                     |  6 +++++
 7 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/components/camel-jsonata/pom.xml b/components/camel-jsonata/pom.xml
index 4123334..7514cf6 100644
--- a/components/camel-jsonata/pom.xml
+++ b/components/camel-jsonata/pom.xml
@@ -21,9 +21,9 @@
 
     <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <artifactId>components</artifactId>
+     <parent>
         <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
         <version>3.5.0-SNAPSHOT</version>
     </parent>
 
@@ -54,7 +54,7 @@
         <dependency>
             <groupId>com.ibm.jsonata4java</groupId>
             <artifactId>JSONata4Java</artifactId>
-            <version>1.0.0</version>
+            <version>${jsonata4java-version}</version>
         </dependency>
 
         <!-- logging -->
diff --git a/components/camel-jsonata/src/main/docs/jsonata-component.adoc 
b/components/camel-jsonata/src/main/docs/jsonata-component.adoc
index f0f88fc..b3fa011 100644
--- a/components/camel-jsonata/src/main/docs/jsonata-component.adoc
+++ b/components/camel-jsonata/src/main/docs/jsonata-component.adoc
@@ -3,7 +3,7 @@
 :docTitle: JSONATA
 :artifactId: camel-jsonata
 :description: JSON to JSON transformation using JSONATA.
-:since: 3.4
+:since: 3.5
 :supportLevel: Preview
 :component-header: Only producer is supported
 
@@ -89,9 +89,9 @@ with the following path and query parameters:
 | Name | Description | Default | Type
 | *allowContextMapAll* (producer) | Sets whether the context map should allow 
access to all details. By default only the message body and headers can be 
accessed. This option can be enabled for full access to the current Exchange 
and CamelContext. Doing so impose a potential security risk as this opens 
access to the full power of CamelContext API. | false | boolean
 | *contentCache* (producer) | Sets whether to use resource content cache or 
not | false | boolean
-| *inputType* (producer) | Specifies if the input is hydrated JSON or a JSON 
String. The value can be one of: Jackson, JsonString | Jackson | 
JsonataInputOutputType
+| *inputType* (producer) | Specifies if the output should be Jackson JsonNode 
or a JSON String. The value can be one of: Jackson, JsonString | Jackson | 
JsonataInputOutputType
 | *lazyStartProducer* (producer) | Whether the producer should be started lazy 
(on the first message). By starting lazy you can use this to allow CamelContext 
and routes to startup in situations where a producer may otherwise fail during 
starting and cause the route to fail being started. By deferring this startup 
to be lazy then the startup failure can be handled during routing messages via 
Camel's routing error handlers. Beware that when the first message is processed 
then creating and [...]
-| *outputType* (producer) | Specifies if the output should be hydrated JSON or 
a JSON String. The value can be one of: Jackson, JsonString | Jackson | 
JsonataInputOutputType
+| *outputType* (producer) | Specifies if the output should be Jackson JsonNode 
or a JSON String. The value can be one of: Jackson, JsonString | Jackson | 
JsonataInputOutputType
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
 | *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
 |===
diff --git 
a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataConstants.java
 
b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataConstants.java
index 07547d7c..88f1b69 100644
--- 
a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataConstants.java
+++ 
b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataConstants.java
@@ -21,9 +21,9 @@ package org.apache.camel.component.jsonata;
  */
 public final class JsonataConstants {
 
-    public static final String Jsonata_RESOURCE_URI = 
"CamelJsonataResourceUri";
+    public static final String JSONATA_RESOURCE_URI = 
"CamelJsonataResourceUri";
 
-    public static final String Jsonata_CONTEXT = "CamelJsonataContext";
+    public static final String JSONATA_CONTEXT = "CamelJsonataContext";
 
     private JsonataConstants() {
         // Utility class
diff --git 
a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataEndpoint.java
 
b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataEndpoint.java
index 4d61695..ad2b6d5 100644
--- 
a/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataEndpoint.java
+++ 
b/components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataEndpoint.java
@@ -16,12 +16,15 @@
  */
 package org.apache.camel.component.jsonata;
 
-import java.io.InputStream;
 import java.io.BufferedReader;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
 import java.util.stream.Collectors;
-import java.util.Map;
+
+import com.api.jsonata4java.expressions.Expressions;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.camel.Category;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -30,21 +33,14 @@ import org.apache.camel.component.ResourceEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
-import com.api.jsonata4java.expressions.EvaluateException;
-import com.api.jsonata4java.expressions.EvaluateRuntimeException;
-import com.api.jsonata4java.expressions.Expressions;
-import com.api.jsonata4java.expressions.ParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
  * JSON to JSON transformation using JSONATA.
  */
-@UriEndpoint(firstVersion = "3.4.0", scheme = "jsonata", title = "JSONATA", 
syntax = "jsonata:resourceUri", producerOnly = true, category = 
{Category.TRANSFORMATION})
+@UriEndpoint(firstVersion = "3.5.0", scheme = "jsonata", title = "JSONATA", 
syntax = "jsonata:resourceUri", producerOnly = true, category = 
{Category.TRANSFORMATION})
 public class JsonataEndpoint extends ResourceEndpoint {
 
-    private Expressions expressions = null;
+    private Expressions expressions;
 
     @UriParam(defaultValue = "Jackson")
     private JsonataInputOutputType outputType;
@@ -74,7 +70,7 @@ public class JsonataEndpoint extends ResourceEndpoint {
     }
 
     /**
-     * Specifies if the output should be Jackson JsNode or a JSON String.
+     * Specifies if the output should be Jackson JsonNode or a JSON String.
      */
     public void setOutputType(JsonataInputOutputType outputType) {
         this.outputType = outputType;
@@ -85,7 +81,7 @@ public class JsonataEndpoint extends ResourceEndpoint {
     }
 
     /**
-     * Specifies if the input is hydrated JSON or a JSON String.
+     * Specifies if the output should be Jackson JsonNode or a JSON String.
      */
     public void setInputType(JsonataInputOutputType inputType) {
         this.inputType = inputType;
@@ -104,8 +100,8 @@ public class JsonataEndpoint extends ResourceEndpoint {
             input = (JsonNode)exchange.getIn().getBody();
         }
 
-        JsonNode output=null;
-        if(expressions == null) {
+        JsonNode output = null;
+        if (expressions == null) {
             String spec = new BufferedReader(
                       new InputStreamReader(getResourceAsInputStream(), 
StandardCharsets.UTF_8))
                 .lines()
diff --git 
a/components/camel-jsonata/src/test/java/org/apache/camel/component/jolt/JsonataFirstSampleTest.java
 
b/components/camel-jsonata/src/test/java/org/apache/camel/component/jsonata/JsonataFirstSampleTest.java
similarity index 92%
rename from 
components/camel-jsonata/src/test/java/org/apache/camel/component/jolt/JsonataFirstSampleTest.java
rename to 
components/camel-jsonata/src/test/java/org/apache/camel/component/jsonata/JsonataFirstSampleTest.java
index aa0ec70..8447c3d 100644
--- 
a/components/camel-jsonata/src/test/java/org/apache/camel/component/jolt/JsonataFirstSampleTest.java
+++ 
b/components/camel-jsonata/src/test/java/org/apache/camel/component/jsonata/JsonataFirstSampleTest.java
@@ -34,7 +34,6 @@ public class JsonataFirstSampleTest extends CamelTestSupport {
 
     @Test
     public void testFirstSampleJsonata() throws Exception {
-        //getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
         getMockEndpoint("mock:result").expectedBodiesReceived(
             IOHelper.loadText(
                 ResourceHelper.resolveMandatoryResourceAsInputStream(
@@ -56,13 +55,13 @@ public class JsonataFirstSampleTest extends 
CamelTestSupport {
                 Map<String, String> contextMap = new HashMap<>();
                 contextMap.put("contextB", "bb");
 
-                exchange.getIn().setHeader(JsonataConstants.Jsonata_CONTEXT, 
contextMap);
+                exchange.getIn().setHeader(JsonataConstants.JSONATA_CONTEXT, 
contextMap);
             }
         };
 
         return new RouteBuilder() {
             public void configure() {
-                JsonataComponent Jsonata = context.getComponent("jsonata", 
JsonataComponent.class);
+                JsonataComponent jsonata = context.getComponent("jsonata", 
JsonataComponent.class);
 
                 from("direct://start")
                         .process(processor)
diff --git a/components/pom.xml b/components/pom.xml
index 90e1496..adc36b0 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -249,6 +249,7 @@
         <module>camel-jslt</module>
         <module>camel-json-validator</module>
         <module>camel-jsonapi</module>
+        <module>camel-jsonata</module>
         <module>camel-jsonpath</module>
         <module>camel-jt400</module>
         <module>camel-jta</module>
diff --git a/parent/pom.xml b/parent/pom.xml
index 7863476..749303c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -348,6 +348,7 @@
         <json-path-version>2.4.0</json-path-version>
         <json-simple-version>1.1.1</json-simple-version>
         <json-smart-version>2.3</json-smart-version>
+        <jsonata4java-version>1.0.0</jsonata4java-version>
         <jsoup-version>1.13.1</jsoup-version>
         <jt400-version>10.3</jt400-version>
         <junit-toolbox-version>2.3</junit-toolbox-version>
@@ -1694,6 +1695,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-jsonata</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-jsonpath</artifactId>
         <version>${project.version}</version>
       </dependency>

Reply via email to