You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/01/25 17:37:11 UTC

[camel] branch CAMEL-18977/make-native-mode-compatible created (now 2aa3e81f477)

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a change to branch CAMEL-18977/make-native-mode-compatible
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 2aa3e81f477 CAMEL-18977: camel-joor - Make the code more flexible for native mode

This branch includes the following new commits:

     new 2aa3e81f477 CAMEL-18977: camel-joor - Make the code more flexible for native mode

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/01: CAMEL-18977: camel-joor - Make the code more flexible for native mode

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-18977/make-native-mode-compatible
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2aa3e81f47798d205472a88b61f0b17e4667997b
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Wed Jan 25 18:36:43 2023 +0100

    CAMEL-18977: camel-joor - Make the code more flexible for native mode
---
 .../apache/camel/language/joor/JoorCompiler.java    |  2 +-
 .../apache/camel/language/joor/JoorLanguage.java    | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorCompiler.java b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorCompiler.java
index cd90a944249..3a4a17a74ec 100644
--- a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorCompiler.java
+++ b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorCompiler.java
@@ -116,7 +116,7 @@ public class JoorCompiler extends ServiceSupport implements StaticService {
         return answer;
     }
 
-    private String evalCode(CamelContext camelContext, String fqn, String script, boolean singleQuotes) {
+    public String evalCode(CamelContext camelContext, String fqn, String script, boolean singleQuotes) {
         String qn = fqn.substring(0, fqn.lastIndexOf('.'));
         String name = fqn.substring(fqn.lastIndexOf('.') + 1);
 
diff --git a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorLanguage.java b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorLanguage.java
index 6093c4a1e57..329e56d7c9f 100644
--- a/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorLanguage.java
+++ b/components/camel-joor/src/main/java/org/apache/camel/language/joor/JoorLanguage.java
@@ -41,8 +41,8 @@ public class JoorLanguage extends TypedLanguageSupport implements ScriptingLangu
     private static final Logger LOG = LoggerFactory.getLogger(JoorLanguage.class);
 
     private static Boolean java8;
-    private final JoorCompiler compiler = new JoorCompiler();
-    private final JoorScriptingCompiler scriptingCompiler = new JoorScriptingCompiler();
+    private final JoorCompiler compiler;
+    private final JoorScriptingCompiler scriptingCompiler;
     private final Set<String> imports = new TreeSet<>();
     private final Map<String, String> aliases = new HashMap<>();
 
@@ -50,6 +50,23 @@ public class JoorLanguage extends TypedLanguageSupport implements ScriptingLangu
     private boolean preCompile = true;
     private boolean singleQuotes = true;
 
+    public JoorLanguage() {
+        this(new JoorCompiler(), new JoorScriptingCompiler());
+    }
+
+    public JoorLanguage(JoorCompiler compiler, JoorScriptingCompiler scriptingCompiler) {
+        this.compiler = compiler;
+        this.scriptingCompiler = scriptingCompiler;
+    }
+
+    public JoorCompiler getCompiler() {
+        return compiler;
+    }
+
+    public JoorScriptingCompiler getScriptingCompiler() {
+        return scriptingCompiler;
+    }
+
     public String getConfigResource() {
         return configResource;
     }