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/17 14:17:42 UTC
[camel-quarkus] 01/01: Ref #4413: JavaShell DSL support
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch 4413/jsh-dsl-support
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit d2d62044ca3634f69a253c8f3b3520ff0a161c88
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Jan 17 15:17:16 2023 +0100
Ref #4413: JavaShell DSL support
---
catalog/pom.xml | 13 ++
docs/modules/ROOT/examples/others/jsh-dsl.yml | 13 ++
docs/modules/ROOT/nav.adoc | 1 +
.../ROOT/pages/reference/extensions/jsh-dsl.adoc | 45 +++++
extensions/jsh-dsl/deployment/pom.xml | 63 ++++++
.../dsl/jsh/deployment/JshDslProcessor.java | 220 +++++++++++++++++++++
.../jsh/deployment/JshGeneratedClassBuildItem.java | 38 ++++
extensions/jsh-dsl/pom.xml | 39 ++++
extensions/jsh-dsl/runtime/pom.xml | 101 ++++++++++
.../camel/quarkus/dsl/jsh/runtime/Configurer.java | 36 ++++
.../quarkus/dsl/jsh/runtime/JshDslRecorder.java | 51 +++++
.../graal/SubstituteJshRoutesBuilderLoader.java | 33 ++++
.../main/resources/META-INF/quarkus-extension.yaml | 31 +++
extensions/pom.xml | 1 +
integration-tests/jsh-dsl/pom.xml | 129 ++++++++++++
.../camel/quarkus/dsl/jsh/JshDslResource.java | 82 ++++++++
.../src/main/resources/application.properties | 21 ++
.../jsh-dsl/src/main/resources/routes/MyRoute.jsh | 20 ++
.../org/apache/camel/quarkus/dsl/jsh/JshDslIT.java | 24 +++
.../apache/camel/quarkus/dsl/jsh/JshDslTest.java | 59 ++++++
integration-tests/pom.xml | 1 +
poms/bom/pom.xml | 15 ++
poms/bom/src/main/generated/flattened-full-pom.xml | 15 ++
.../src/main/generated/flattened-reduced-pom.xml | 15 ++
.../generated/flattened-reduced-verbose-pom.xml | 15 ++
tooling/scripts/test-categories.yaml | 1 +
26 files changed, 1082 insertions(+)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 64b71cd9ad..5b741c77b4 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -2190,6 +2190,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jslt</artifactId>
diff --git a/docs/modules/ROOT/examples/others/jsh-dsl.yml b/docs/modules/ROOT/examples/others/jsh-dsl.yml
new file mode 100644
index 0000000000..7c5fd07803
--- /dev/null
+++ b/docs/modules/ROOT/examples/others/jsh-dsl.yml
@@ -0,0 +1,13 @@
+# Do not edit directly!
+# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+cqArtifactId: camel-quarkus-jsh-dsl
+cqArtifactIdBase: jsh-dsl
+cqNativeSupported: true
+cqStatus: Stable
+cqDeprecated: false
+cqJvmSince: 2.16.0
+cqNativeSince: 2.16.0
+cqCamelPartName: jsh-dsl
+cqCamelPartTitle: JavaShell DSL
+cqCamelPartDescription: Camel DSL with JavaShell
+cqExtensionPageTitle: JavaShell DSL
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 6f65282373..067639ebce 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -185,6 +185,7 @@
*** xref:reference/extensions/jasypt.adoc[Jasypt]
*** xref:reference/extensions/java-joor-dsl.adoc[Java jOOR DSL]
*** xref:reference/extensions/js-dsl.adoc[JavaScript DSL]
+*** xref:reference/extensions/jsh-dsl.adoc[JavaShell DSL]
*** xref:reference/extensions/jfr.adoc[Jfr]
*** xref:reference/extensions/jira.adoc[Jira]
*** xref:reference/extensions/johnzon.adoc[Johnzon]
diff --git a/docs/modules/ROOT/pages/reference/extensions/jsh-dsl.adoc b/docs/modules/ROOT/pages/reference/extensions/jsh-dsl.adoc
new file mode 100644
index 0000000000..34346168a1
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/jsh-dsl.adoc
@@ -0,0 +1,45 @@
+// Do not edit directly!
+// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+[id="extensions-jsh-dsl"]
+= JavaShell DSL
+:linkattrs:
+:cq-artifact-id: camel-quarkus-jsh-dsl
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
+:cq-description: Camel DSL with JavaShell
+:cq-deprecated: false
+:cq-jvm-since: 2.16.0
+:cq-native-since: 2.16.0
+
+ifeval::[{doc-show-badges} == true]
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##2.16.0## [.badge-key]##Native since##[.badge-supported]##2.16.0##
+endif::[]
+
+Camel DSL with JavaShell
+
+[id="extensions-jsh-dsl-whats-inside"]
+== What's inside
+
+* xref:{cq-camel-components}:others:jsh-dsl.adoc[JavaShell DSL]
+
+Please refer to the above link for usage and configuration details.
+
+[id="extensions-jsh-dsl-maven-coordinates"]
+== Maven coordinates
+
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-jsh-dsl[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]
+
+Or add the coordinates to your existing project:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+</dependency>
+----
+ifeval::[{doc-show-user-guide-link} == true]
+Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
+endif::[]
diff --git a/extensions/jsh-dsl/deployment/pom.xml b/extensions/jsh-dsl/deployment/pom.xml
new file mode 100644
index 0000000000..d2e29e590e
--- /dev/null
+++ b/extensions/jsh-dsl/deployment/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl-parent</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId>
+ <name>Camel Quarkus :: JavaShell DSL :: Deployment</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshDslProcessor.java b/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshDslProcessor.java
new file mode 100644
index 0000000000..a1d9a8fc77
--- /dev/null
+++ b/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshDslProcessor.java
@@ -0,0 +1,220 @@
+/*
+ * 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.quarkus.dsl.jsh.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.GeneratedClassBuildItem;
+import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.dev.CompilationProvider;
+import io.quarkus.deployment.dev.JavaCompilationProvider;
+import io.quarkus.deployment.pkg.builditem.BuildSystemTargetBuildItem;
+import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.paths.PathCollection;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.CamelContext;
+import org.apache.camel.quarkus.core.deployment.main.CamelMainHelper;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem;
+import org.apache.camel.quarkus.dsl.jsh.runtime.Configurer;
+import org.apache.camel.quarkus.dsl.jsh.runtime.JshDslRecorder;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.IOHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class JshDslProcessor {
+ private static final Logger LOG = LoggerFactory.getLogger(JshDslProcessor.class);
+ private static final String PACKAGE_NAME = "org.apache.camel.quarkus.dsl.jsh.generated";
+ private static final Pattern IMPORT_PATTERN = Pattern.compile("import .*");
+ private static final String FILE_FORMAT = "package %s;\n" +
+ "%s\n" +
+ "public class %s extends %s { \n" +
+ " public %s(EndpointRouteBuilder builder, CamelContext context) {\n" +
+ " super(builder, context);\n" +
+ " }\n" +
+ " public void configure() { \n" +
+ " %s\n" +
+ " }\n" +
+ "}";
+ private static final String FEATURE = "camel-jsh-dsl";
+ public static final String CLASS_EXT = ".class";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep(onlyIf = NativeBuild.class)
+ void compileScriptsAOT(BuildProducer<GeneratedClassBuildItem> generatedClass,
+ BuildProducer<GeneratedResourceBuildItem> generatedResource,
+ BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ BuildProducer<JshGeneratedClassBuildItem> generatedJavaClass,
+ BuildSystemTargetBuildItem buildSystemTargetBuildItem,
+ CurateOutcomeBuildItem curateOutcomeBuildItem) throws Exception {
+ LOG.debug("Loading .jsh resources");
+ final Path projectDir = Paths.get(".").toAbsolutePath().normalize();
+ Path outputDirectory = buildSystemTargetBuildItem.getOutputDirectory();
+ final Path generatedSourceDir = outputDirectory.resolve("jsh-dsl/generated-sources");
+ Files.createDirectories(generatedSourceDir);
+ final Path generatedSourceHomeDir = generatedSourceDir.resolve(PACKAGE_NAME.replace('.', File.separatorChar));
+ Files.createDirectories(generatedSourceHomeDir);
+ Map<String, Resource> nameToResource = new HashMap<>();
+ Set<File> filesToCompile = new HashSet<>();
+ CamelMainHelper.forEachMatchingResource(
+ resource -> {
+ if (!resource.getLocation().endsWith(".jsh")) {
+ return;
+ }
+ String name = determineName(resource);
+ try (InputStream is = resource.getInputStream()) {
+ String content = toJavaClass(name, IOHelper.loadText(is));
+ LOG.debug("Generated Java source content:\n {}", content);
+ final Path sourceFile = generatedSourceHomeDir.resolve(String.format("%s.java", name));
+ Files.write(sourceFile, content.getBytes(StandardCharsets.UTF_8));
+ filesToCompile.add(sourceFile.toFile());
+ nameToResource.put(String.format("%s.%s", PACKAGE_NAME, name), resource);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ if (filesToCompile.isEmpty()) {
+ return;
+ }
+ final Path classesDir = outputDirectory.resolve("jsh-dsl/generated-classes");
+ Files.createDirectories(classesDir);
+ CompilationProvider.Context context = new CompilationProvider.Context(
+ FEATURE,
+ curateOutcomeBuildItem.getApplicationModel().getDependencies().stream()
+ .map(ResolvedDependency::getResolvedPaths)
+ .flatMap(PathCollection::stream)
+ .map(Path::toFile)
+ .filter(f -> f.getName().endsWith(".jar"))
+ .collect(Collectors.toSet()),
+ Set.of(),
+ projectDir.toFile(),
+ generatedSourceDir.toFile(),
+ classesDir.toFile(),
+ StandardCharsets.UTF_8.name(),
+ Map.of(),
+ null,
+ null,
+ null,
+ List.of(),
+ List.of());
+ try (JavaCompilationProvider compiler = new JavaCompilationProvider()) {
+ compiler.compile(filesToCompile, context);
+ }
+
+ try (Stream<Path> classFiles = Files.walk(classesDir)) {
+ classFiles
+ .filter(Files::isRegularFile)
+ .forEach(p -> {
+ String relativePath = classesDir.relativize(p).toString();
+ String className = relativePath.replace(File.separatorChar, '.').substring(0,
+ relativePath.length() - CLASS_EXT.length());
+ try {
+ generatedClass.produce(new GeneratedClassBuildItem(true, className, Files.readAllBytes(p)));
+ if (nameToResource.containsKey(className)) {
+ reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, className));
+ generatedJavaClass
+ .produce(new JshGeneratedClassBuildItem(className,
+ nameToResource.get(className).getLocation()));
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("Could not read " + p);
+ }
+ });
+ }
+ }
+
+ @BuildStep(onlyIf = NativeBuild.class)
+ @Record(value = ExecutionTime.STATIC_INIT)
+ void registerRoutesBuilder(List<JshGeneratedClassBuildItem> classes,
+ CamelContextBuildItem context,
+ JshDslRecorder recorder) throws Exception {
+ RuntimeValue<CamelContext> camelContext = context.getCamelContext();
+ for (JshGeneratedClassBuildItem clazz : classes) {
+ recorder.registerRoutesBuilder(camelContext, clazz.getName(), clazz.getLocation());
+ }
+ }
+
+ private static String determineName(Resource resource) {
+ String str = FileUtil.onlyName(resource.getLocation(), true);
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0, length = str.length(); i < length; i++) {
+ char c = str.charAt(i);
+ if ((i == 0 && Character.isJavaIdentifierStart(c)) || (i > 0 && Character.isJavaIdentifierPart(c))) {
+ sb.append(c);
+ } else {
+ sb.append((int) c);
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Convert a JShell script into a Java class to be able to compile it.
+ *
+ * @param name the name of the Java class
+ * @param contentResource the content of the JShell script
+ * @return the content of the corresponding Java class.
+ */
+ private static String toJavaClass(String name, String contentResource) {
+ List<String> imports = new ArrayList<>();
+ imports.add("import org.apache.camel.*;");
+ imports.add("import org.apache.camel.spi.*;");
+ imports.add("import org.apache.camel.builder.endpoint.EndpointRouteBuilder;");
+ Matcher m = IMPORT_PATTERN.matcher(contentResource);
+ int beginIndex = 0;
+ while (m.find()) {
+ imports.add(m.group());
+ beginIndex = m.end();
+ }
+ if (beginIndex > 0) {
+ contentResource = contentResource.substring(beginIndex);
+ }
+ return String.format(
+ FILE_FORMAT, PACKAGE_NAME, String.join("\n", imports), name,
+ Configurer.class.getName(), name, contentResource);
+ }
+}
diff --git a/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshGeneratedClassBuildItem.java b/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshGeneratedClassBuildItem.java
new file mode 100644
index 0000000000..bc66962015
--- /dev/null
+++ b/extensions/jsh-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/jsh/deployment/JshGeneratedClassBuildItem.java
@@ -0,0 +1,38 @@
+/*
+ * 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.quarkus.dsl.jsh.deployment;
+
+import io.quarkus.builder.item.MultiBuildItem;
+
+public final class JshGeneratedClassBuildItem extends MultiBuildItem {
+
+ final String name;
+ final String location;
+
+ public JshGeneratedClassBuildItem(String name, String location) {
+ this.name = name;
+ this.location = location;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+}
diff --git a/extensions/jsh-dsl/pom.xml b/extensions/jsh-dsl/pom.xml
new file mode 100644
index 0000000000..15161ab7d2
--- /dev/null
+++ b/extensions/jsh-dsl/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-extensions</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-jsh-dsl-parent</artifactId>
+ <name>Camel Quarkus :: JavaShell DSL</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/jsh-dsl/runtime/pom.xml b/extensions/jsh-dsl/runtime/pom.xml
new file mode 100644
index 0000000000..0d3ea74493
--- /dev/null
+++ b/extensions/jsh-dsl/runtime/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl-parent</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ <name>Camel Quarkus :: JavaShell DSL :: Runtime</name>
+ <description>Camel DSL with JavaShell</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>2.16.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>2.16.0</camel.quarkus.nativeSince>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jsh-dsl</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>full</id>
+ <activation>
+ <property>
+ <name>!quickly</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>update-extension-doc-page</id>
+ <goals>
+ <goal>update-extension-doc-page</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/Configurer.java b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/Configurer.java
new file mode 100644
index 0000000000..f9eaee2664
--- /dev/null
+++ b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/Configurer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.quarkus.dsl.jsh.runtime;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.apache.camel.spi.Registry;
+
+public abstract class Configurer {
+
+ protected final EndpointRouteBuilder builder;
+ protected final CamelContext context;
+ protected final Registry registry;
+
+ protected Configurer(EndpointRouteBuilder builder, CamelContext context) {
+ this.builder = builder;
+ this.context = context;
+ this.registry = context.getRegistry();
+ }
+
+ public abstract void configure();
+}
diff --git a/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/JshDslRecorder.java b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/JshDslRecorder.java
new file mode 100644
index 0000000000..36c4cfb625
--- /dev/null
+++ b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/JshDslRecorder.java
@@ -0,0 +1,51 @@
+/*
+ * 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.quarkus.dsl.jsh.runtime;
+
+import java.lang.reflect.Constructor;
+
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.apache.camel.support.ResourceHelper;
+
+@Recorder
+public class JshDslRecorder {
+
+ public void registerRoutesBuilder(RuntimeValue<CamelContext> camelContext, String className, String location)
+ throws Exception {
+ Constructor<? extends Configurer> constructor = (Constructor<? extends Configurer>) Class.forName(className)
+ .getDeclaredConstructor(EndpointRouteBuilder.class, CamelContext.class);
+ CamelContext context = camelContext.getValue();
+ context.addRoutes(
+ new EndpointRouteBuilder() {
+
+ @Override
+ public void configure() throws Exception {
+ setCamelContext(context);
+ setResource(ResourceHelper.fromString(location, ""));
+ try {
+ constructor.newInstance(this, context).configure();
+ } catch (Exception e) {
+ throw new RuntimeCamelException("Cannot create instance of class: " + className, e);
+ }
+ }
+ });
+ }
+}
diff --git a/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/graal/SubstituteJshRoutesBuilderLoader.java b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/graal/SubstituteJshRoutesBuilderLoader.java
new file mode 100644
index 0000000000..3e86c68075
--- /dev/null
+++ b/extensions/jsh-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/jsh/runtime/graal/SubstituteJshRoutesBuilderLoader.java
@@ -0,0 +1,33 @@
+/*
+ * 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.quarkus.dsl.jsh.runtime.graal;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.dsl.jsh.JshRoutesBuilderLoader;
+import org.apache.camel.spi.Resource;
+
+@TargetClass(JshRoutesBuilderLoader.class)
+final class SubstituteJshRoutesBuilderLoader {
+
+ @Substitute
+ public RoutesBuilder loadRoutesBuilder(Resource resource) {
+ // Do nothing
+ return null;
+ }
+}
diff --git a/extensions/jsh-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jsh-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..ff66d83cbe
--- /dev/null
+++ b/extensions/jsh-dsl/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+# This is a generated file. Do not edit directly!
+# To re-generate, run the following command from the top level directory:
+#
+# mvn -N cq:update-quarkus-metadata
+#
+---
+name: "Camel JavaShell DSL"
+description: "Camel DSL with JavaShell"
+metadata:
+ guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/jsh-dsl.html"
+ categories:
+ - "integration"
+ status:
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index bf56945982..8fd63b6774 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -144,6 +144,7 @@
<module>jq</module>
<module>js-dsl</module>
<module>jsch</module>
+ <module>jsh-dsl</module>
<module>jslt</module>
<module>json-validator</module>
<module>jsonata</module>
diff --git a/integration-tests/jsh-dsl/pom.xml b/integration-tests/jsh-dsl/pom.xml
new file mode 100644
index 0000000000..3ca9c6ff20
--- /dev/null
+++ b/integration-tests/jsh-dsl/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-jsh-dsl</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: JavaShell DSL</name>
+ <description>Integration tests for Camel Quarkus JavaShell DSL extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>virtualDependencies</id>
+ <activation>
+ <property>
+ <name>!noVirtualDependencies</name>
+ </property>
+ </activation>
+ <dependencies>
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/jsh-dsl/src/main/java/org/apache/camel/quarkus/dsl/jsh/JshDslResource.java b/integration-tests/jsh-dsl/src/main/java/org/apache/camel/quarkus/dsl/jsh/JshDslResource.java
new file mode 100644
index 0000000000..57a9c42d13
--- /dev/null
+++ b/integration-tests/jsh-dsl/src/main/java/org/apache/camel/quarkus/dsl/jsh/JshDslResource.java
@@ -0,0 +1,82 @@
+/*
+ * 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.quarkus.dsl.jsh;
+
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.Route;
+import org.apache.camel.dsl.jsh.JshRoutesBuilderLoader;
+import org.apache.camel.quarkus.main.CamelMain;
+import org.apache.camel.spi.RoutesBuilderLoader;
+
+@Path("/jsh-dsl")
+@ApplicationScoped
+public class JshDslResource {
+ @Inject
+ CamelMain main;
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/main/jshRoutesBuilderLoader")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String jshRoutesBuilder() {
+ final ExtendedCamelContext camelContext = main.getCamelContext().adapt(ExtendedCamelContext.class);
+ return camelContext.getBootstrapFactoryFinder(RoutesBuilderLoader.FACTORY_PATH)
+ .findClass(JshRoutesBuilderLoader.EXTENSION).get().getName();
+ }
+
+ @Path("/main/routeBuilders")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String routeBuilders() {
+ return main.configure().getRoutesBuilders().stream()
+ .map(rb -> rb.getClass().getSimpleName())
+ .sorted()
+ .collect(Collectors.joining(","));
+ }
+
+ @Path("/main/routes")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String routes() {
+ return main.getCamelContext().getRoutes().stream()
+ .map(Route::getId)
+ .sorted()
+ .collect(Collectors.joining(","));
+ }
+
+ @POST
+ @Path("/hello")
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String hello(String message) {
+ return producerTemplate.requestBody("direct:jshHello", message, String.class);
+ }
+}
diff --git a/integration-tests/jsh-dsl/src/main/resources/application.properties b/integration-tests/jsh-dsl/src/main/resources/application.properties
new file mode 100644
index 0000000000..d102a9146d
--- /dev/null
+++ b/integration-tests/jsh-dsl/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# Main
+#
+camel.main.routes-include-pattern = classpath:routes/*.jsh
diff --git a/integration-tests/jsh-dsl/src/main/resources/routes/MyRoute.jsh b/integration-tests/jsh-dsl/src/main/resources/routes/MyRoute.jsh
new file mode 100644
index 0000000000..37f4efeb06
--- /dev/null
+++ b/integration-tests/jsh-dsl/src/main/resources/routes/MyRoute.jsh
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+builder.from("direct:jshHello")
+ .id("my-jsh-route")
+ .setBody(exchange -> "Hello " + exchange.getMessage().getBody() + " from JShell!");
\ No newline at end of file
diff --git a/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslIT.java b/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslIT.java
new file mode 100644
index 0000000000..347cc48db6
--- /dev/null
+++ b/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.dsl.jsh;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class JshDslIT extends JshDslTest {
+
+}
diff --git a/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslTest.java b/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslTest.java
new file mode 100644
index 0000000000..62a3c27b91
--- /dev/null
+++ b/integration-tests/jsh-dsl/src/test/java/org/apache/camel/quarkus/dsl/jsh/JshDslTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.quarkus.dsl.jsh;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.dsl.jsh.JshRoutesBuilderLoader;
+import org.hamcrest.CoreMatchers;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+class JshDslTest {
+
+ @Test
+ void jshHello() {
+ RestAssured.given()
+ .body("Brad Smith")
+ .post("/jsh-dsl/hello")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.is("Hello Brad Smith from JShell!"));
+ }
+
+ @Test
+ void testMainInstanceWithJavaRoutes() {
+ RestAssured.given()
+ .get("/jsh-dsl/main/jshRoutesBuilderLoader")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.is(JshRoutesBuilderLoader.class.getName()));
+
+ RestAssured.given()
+ .get("/jsh-dsl/main/routeBuilders")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.is(""));
+
+ RestAssured.given()
+ .get("/jsh-dsl/main/routes")
+ .then()
+ .statusCode(200)
+ .body(CoreMatchers.is("my-jsh-route"));
+ }
+
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 043063a5b4..864ac6c0d1 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -127,6 +127,7 @@
<module>jq</module>
<module>js-dsl</module>
<module>jsch</module>
+ <module>jsh-dsl</module>
<module>jslt</module>
<module>json-validator</module>
<module>jsonata</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 997ed315ff..542a81110c 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -3648,6 +3648,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jsh-dsl</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jslt</artifactId>
@@ -7779,6 +7784,16 @@
<artifactId>camel-quarkus-jsch-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jslt</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml
index 9776aefcb0..096c201ec0 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -3587,6 +3587,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-jsh-dsl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.20.1</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-jslt</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -7716,6 +7721,16 @@
<artifactId>camel-quarkus-jsch-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-jsh-dsl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-quarkus-jslt</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml
index 1f29d5ad79..51817c5864 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -3582,6 +3582,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jsh-dsl</artifactId>
+ <version>3.20.1</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jslt</artifactId>
@@ -7711,6 +7716,16 @@
<artifactId>camel-quarkus-jsch-deployment</artifactId>
<version>2.16.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId>
+ <version>2.16.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jslt</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
index 2d312f9b17..33b6ac767c 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -3582,6 +3582,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-jsh-dsl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>3.20.1</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-jslt</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
@@ -7711,6 +7716,16 @@
<artifactId>camel-quarkus-jsch-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-jsh-dsl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <artifactId>camel-quarkus-jsh-dsl-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ <version>2.16.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
<artifactId>camel-quarkus-jslt</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 023abb356b..304ace2eed 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -208,6 +208,7 @@ group-13:
- jira
- java-joor-dsl
- js-dsl
+ - jsh-dsl
- kotlin-dsl
- kubernetes
- salesforce