This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit e1068da68db0f3d95353d01c5a9599f91fa6cddd Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Sat Oct 26 00:56:45 2019 +0200 update to camel-quarkus 0.3.0 --- camel-k-loader-groovy/pom.xml | 15 -- camel-k-loader-java/pom.xml | 5 - camel-k-loader-js/pom.xml | 5 - camel-k-loader-knative/pom.xml | 5 - camel-k-loader-kotlin/pom.xml | 5 - camel-k-loader-xml/pom.xml | 5 - camel-k-loader-yaml/pom.xml | 5 - .../quarkus/deployment/DeploymentProcessor.java | 80 +++++++++- .../deployment/devmode/HotDeploymentProcessor.java | 7 +- camel-k-quarkus/camel-k-quarkus-core/it/pom.xml | 3 +- .../it/src/main/resources/application.properties | 9 +- .../k/core/quarkus/RuntimeListenerAdapter.java | 169 +++++++++++++++++++++ .../camel/k/core/quarkus/RuntimeRecorder.java} | 15 +- .../camel-k-quarkus-loader-js/it/pom.xml | 3 +- .../it/src/main/resources/application.properties | 9 +- .../camel-k-quarkus-loader-xml/deployment/pom.xml | 4 + .../camel-k-quarkus-loader-xml/it/pom.xml | 3 +- .../it/src/main/resources/application.properties | 11 -- .../camel-k-quarkus-loader-xml/runtime/pom.xml | 2 +- .../camel-k-quarkus-loader-yaml/it/pom.xml | 3 +- .../it/src/main/resources/application.properties | 8 +- .../apache/camel/k/quarkus/ApplicationRuntime.java | 105 ------------- .../ApplicationRuntimeConfigSourceProvider.java | 2 +- camel-k-runtime-core/pom.xml | 5 - .../src/main/java/org/apache/camel/k/Runtime.java | 6 +- .../apache/camel/k/support/PropertiesSupport.java | 15 +- .../org/apache/camel/k/support/RuntimeSupport.java | 18 +-- .../apache/camel/k/support/RuntimeSupportTest.java | 20 +-- camel-k-runtime-health/pom.xml | 5 - camel-k-runtime-knative/pom.xml | 6 - camel-k-runtime-main/pom.xml | 5 - .../java/org/apache/camel/k/main/Application.java | 4 +- .../apache/camel/k/main/ApplicationRuntime.java | 77 +++++++--- camel-k-runtime-servlet/pom.xml | 5 - .../knative/spi/CloudEventTypeConverter.java | 2 +- camel-knative/camel-knative-http/pom.xml | 5 - camel-knative/camel-knative/pom.xml | 5 - .../src/main/resources/application.properties | 12 +- .../src/main/resources/application.properties | 7 +- .../camel-k-runtime-example-quarkus-js/pom.xml | 5 +- .../src/main/resources/application.properties | 16 +- .../pom.xml | 5 +- .../src/main/resources/application.properties | 9 +- .../camel-k-runtime-example-quarkus-yaml/pom.xml | 5 +- .../src/main/resources/application.properties | 16 +- .../src/main/resources/application.properties | 14 +- examples/camel-k-runtime-example-yaml/pom.xml | 2 +- .../resources/{ => conf}/application.properties | 7 +- pom.xml | 44 +++++- tooling/camel-k-maven-plugin/pom.xml | 2 +- .../maven/processors/CatalogProcessor3x.java | 2 - 51 files changed, 445 insertions(+), 357 deletions(-) diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml index 2cb5d6f..7e2210a 100644 --- a/camel-k-loader-groovy/pom.xml +++ b/camel-k-loader-groovy/pom.xml @@ -94,21 +94,6 @@ <artifactId>camel-direct</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bean</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-jackson</artifactId> - <scope>test</scope> - </dependency> <!-- ******************************* --> <!-- test deps :: misc --> diff --git a/camel-k-loader-java/pom.xml b/camel-k-loader-java/pom.xml index 11dccea..a20fc92 100644 --- a/camel-k-loader-java/pom.xml +++ b/camel-k-loader-java/pom.xml @@ -88,11 +88,6 @@ <artifactId>camel-direct</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml index 488b7a0..67f3e0a 100644 --- a/camel-k-loader-js/pom.xml +++ b/camel-k-loader-js/pom.xml @@ -84,11 +84,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-main</artifactId> <scope>test</scope> </dependency> diff --git a/camel-k-loader-knative/pom.xml b/camel-k-loader-knative/pom.xml index 00462e0..840d2cb 100644 --- a/camel-k-loader-knative/pom.xml +++ b/camel-k-loader-knative/pom.xml @@ -86,11 +86,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-direct</artifactId> <scope>test</scope> </dependency> diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/pom.xml index 58cafa3..4490b3e 100644 --- a/camel-k-loader-kotlin/pom.xml +++ b/camel-k-loader-kotlin/pom.xml @@ -99,11 +99,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-main</artifactId> <scope>test</scope> </dependency> diff --git a/camel-k-loader-xml/pom.xml b/camel-k-loader-xml/pom.xml index 4f19005..c28e767 100644 --- a/camel-k-loader-xml/pom.xml +++ b/camel-k-loader-xml/pom.xml @@ -82,11 +82,6 @@ <artifactId>camel-direct</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/camel-k-loader-yaml/pom.xml b/camel-k-loader-yaml/pom.xml index 147464d..3da8fbc 100644 --- a/camel-k-loader-yaml/pom.xml +++ b/camel-k-loader-yaml/pom.xml @@ -75,11 +75,6 @@ <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-mock</artifactId> <scope>test</scope> </dependency> diff --git a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java index fb85aca..127fed1 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/DeploymentProcessor.java @@ -16,10 +16,23 @@ */ package org.apache.camel.k.core.quarkus.deployment; +import java.util.ArrayList; +import java.util.List; +import java.util.ServiceLoader; + 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.CombinedIndexBuildItem; +import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.substrate.ServiceProviderBuildItem; +import org.apache.camel.k.Runtime; +import org.apache.camel.k.core.quarkus.RuntimeListenerAdapter; +import org.apache.camel.k.core.quarkus.RuntimeRecorder; +import org.apache.camel.quarkus.core.deployment.CamelMainListenerBuildItem; +import org.apache.camel.spi.HasId; +import org.apache.camel.spi.StreamCachingStrategy; import org.jboss.jandex.IndexView; import static org.apache.camel.k.core.quarkus.deployment.DeploymentSupport.getAllKnownImplementors; @@ -28,12 +41,13 @@ public class DeploymentProcessor { @BuildStep void registerServices( BuildProducer<ServiceProviderBuildItem> serviceProvider, + BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndexBuildItem) { final IndexView view = combinedIndexBuildItem.getIndex(); final String serviceType = "org.apache.camel.k.Runtime$Listener"; - getAllKnownImplementors(view, serviceType).forEach(i-> { + getAllKnownImplementors(view, serviceType).forEach(i -> { serviceProvider.produce( new ServiceProviderBuildItem( serviceType, @@ -41,4 +55,68 @@ public class DeploymentProcessor { ); }); } + + @BuildStep + void registerStreamCachingClasses( + BuildProducer<ReflectiveClassBuildItem> reflectiveClass, + CombinedIndexBuildItem combinedIndexBuildItem) { + + final IndexView view = combinedIndexBuildItem.getIndex(); + + getAllKnownImplementors(view, StreamCachingStrategy.class).forEach(i-> { + reflectiveClass.produce( + new ReflectiveClassBuildItem( + true, + true, + i.name().toString()) + ); + }); + getAllKnownImplementors(view, StreamCachingStrategy.Statistics.class).forEach(i-> { + reflectiveClass.produce( + new ReflectiveClassBuildItem( + true, + true, + i.name().toString()) + ); + }); + getAllKnownImplementors(view, StreamCachingStrategy.SpoolRule.class).forEach(i-> { + reflectiveClass.produce( + new ReflectiveClassBuildItem( + true, + true, + i.name().toString()) + ); + }); + + reflectiveClass.produce( + new ReflectiveClassBuildItem( + true, + true, + StreamCachingStrategy.SpoolRule.class) + ); + } + + @Record(ExecutionTime.RUNTIME_INIT) + @BuildStep + CamelMainListenerBuildItem registerListener(RuntimeRecorder recorder) { + List<Runtime.Listener> listeners = new ArrayList<>(); + ServiceLoader.load(Runtime.Listener.class).forEach(listener -> { + if (listener instanceof HasId) { + String id = ((HasId) listener).getId(); + if (!id.endsWith(".")) { + id = id + "."; + } + + // TODO: this has to be done on quarkus side + //PropertiesSupport.bindProperties(getCamelContext(), listener, id); + } + + listeners.add(listener); + }); + + RuntimeListenerAdapter adapter = new RuntimeListenerAdapter(); + adapter.setListeners(listeners); + + return new CamelMainListenerBuildItem(adapter); + } } diff --git a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/devmode/HotDeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/devmode/HotDeploymentProcessor.java index 5a99894..7bc896a 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/devmode/HotDeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-core/deployment/src/main/java/org/apache/camel/k/core/quarkus/deployment/devmode/HotDeploymentProcessor.java @@ -56,8 +56,11 @@ public class HotDeploymentProcessor { path = source; } - LOGGER.info("Register source for hot deployment: {}", path); - items.add(new HotDeploymentWatchedFileBuildItem(path)); + Path p = Paths.get(path); + if (Files.exists(p)) { + LOGGER.info("Register source for hot deployment: {}", p.toAbsolutePath()); + items.add(new HotDeploymentWatchedFileBuildItem(p.toAbsolutePath().toString())); + } } } diff --git a/camel-k-quarkus/camel-k-quarkus-core/it/pom.xml b/camel-k-quarkus/camel-k-quarkus-core/it/pom.xml index b4ee856..d9182ad 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/it/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-core/it/pom.xml @@ -129,8 +129,7 @@ <goal>native-image</goal> </goals> <configuration> - <dockerBuild>true</dockerBuild> - <containerRuntime>docker</containerRuntime> + <disableReports>true</disableReports> </configuration> </execution> </executions> diff --git a/camel-k-quarkus/camel-k-quarkus-core/it/src/main/resources/application.properties b/camel-k-quarkus/camel-k-quarkus-core/it/src/main/resources/application.properties index 0a49e8e..91d5d75 100644 --- a/camel-k-quarkus/camel-k-quarkus-core/it/src/main/resources/application.properties +++ b/camel-k-quarkus/camel-k-quarkus-core/it/src/main/resources/application.properties @@ -21,17 +21,10 @@ quarkus.log.file.enable = false quarkus.log.console.enable = false # -# Quarkus :: Camel -# -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true - -# # Camel # camel.context.name = camel-k-quarkus-ctx # # Integration -# \ No newline at end of file +# diff --git a/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java new file mode 100644 index 0000000..50662f2 --- /dev/null +++ b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeListenerAdapter.java @@ -0,0 +1,169 @@ +/* + * 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.k.core.quarkus; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.apache.camel.CamelContext; +import org.apache.camel.RoutesBuilder; +import org.apache.camel.k.Runtime; +import org.apache.camel.main.BaseMainSupport; +import org.apache.camel.main.MainListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RuntimeListenerAdapter implements MainListener { + private static final Logger LOGGER = LoggerFactory.getLogger(RuntimeListenerAdapter.class); + + private final List<Runtime.Listener> listeners; + + public RuntimeListenerAdapter() { + this.listeners = new ArrayList<>(); + } + + public void setListeners(List<Runtime.Listener> listeners) { + this.listeners.clear(); + this.listeners.addAll(listeners); + } + + public List<Runtime.Listener> getListeners() { + return Collections.unmodifiableList(listeners); + } + + @Override + public void beforeStart(BaseMainSupport main) { + final Runtime runtime = new Runtime() { + @Override + public CamelContext getCamelContext() { + return main.getCamelContext(); + } + + @Override + public void addRoutes(RoutesBuilder builder) { + try { + // TODO: the before start event is fired in the wrong + // phase in camek-quarkus so routes have to be + // added directly to the registry, eplace with: + // main.addRoutesBuilder(builder) + // when fixed. + main.getCamelContext().addRoutes(builder); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }; + + invokeListeners(runtime, Runtime.Phase.Starting); + invokeListeners(runtime, Runtime.Phase.ConfigureRoutes); + } + + @Override + public void configure(CamelContext context) { + invokeListeners(Runtime.of(context), Runtime.Phase.ConfigureContext); + } + + @Override + public void afterStart(BaseMainSupport main) { + final Runtime runtime = new Runtime() { + @Override + public CamelContext getCamelContext() { + return main.getCamelContext(); + } + + @Override + public void addRoutes(RoutesBuilder builder) { + try { + // TODO: the before start event is fired in the wrong + // phase in camek-quarkus so routes have to be + // added directly to the registry, eplace with: + // main.addRoutesBuilder(builder) + // when fixed. + main.getCamelContext().addRoutes(builder); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }; + + invokeListeners(runtime, Runtime.Phase.Started); + } + + @Override + public void beforeStop(BaseMainSupport main) { + final Runtime runtime = new Runtime() { + @Override + public CamelContext getCamelContext() { + return main.getCamelContext(); + } + + @Override + public void addRoutes(RoutesBuilder builder) { + try { + // TODO: the before start event is fired in the wrong + // phase in camek-quarkus so routes have to be + // added directly to the registry, eplace with: + // main.addRoutesBuilder(builder) + // when fixed. + main.getCamelContext().addRoutes(builder); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }; + + invokeListeners(runtime, Runtime.Phase.Stopping); + } + + @Override + public void afterStop(BaseMainSupport main) { + final Runtime runtime = new Runtime() { + @Override + public CamelContext getCamelContext() { + return main.getCamelContext(); + } + + @Override + public void addRoutes(RoutesBuilder builder) { + try { + // TODO: the before start event is fired in the wrong + // phase in camek-quarkus so routes have to be + // added directly to the registry, eplace with: + // main.addRoutesBuilder(builder) + // when fixed. + main.getCamelContext().addRoutes(builder); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }; + + invokeListeners(runtime, Runtime.Phase.Stopped); + } + + private void invokeListeners(Runtime runtime, Runtime.Phase phase) { + listeners.stream() + .sorted(Comparator.comparingInt(Runtime.Listener::getOrder)) + .forEach(l -> { + if (l.accept(phase, runtime)) { + LOGGER.info("Listener {} executed in phase {}", l, phase); + } + }); + } +} diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/src/main/java/org/apache/camel/k/loader/xml/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java similarity index 59% rename from camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/src/main/java/org/apache/camel/k/loader/xml/quarkus/deployment/DeploymentProcessor.java rename to camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java index 7e041ec..33a2bba 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/src/main/java/org/apache/camel/k/loader/xml/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-core/runtime/src/main/java/org/apache/camel/k/core/quarkus/RuntimeRecorder.java @@ -14,17 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.k.loader.xml.quarkus.deployment; +package org.apache.camel.k.core.quarkus; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; -import org.apache.camel.converter.jaxp.XmlConverter; +import io.quarkus.runtime.annotations.Recorder; -public class DeploymentProcessor { - @BuildStep - void registerReflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { - reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, XmlConverter.class)); - } +@Recorder +public class RuntimeRecorder { } - diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/it/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-js/it/pom.xml index 887bb5e..2d20f79 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/it/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/it/pom.xml @@ -142,8 +142,7 @@ <goal>native-image</goal> </goals> <configuration> - <dockerBuild>true</dockerBuild> - <containerRuntime>docker</containerRuntime> + <disableReports>true</disableReports> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> <enableAllSecurityServices>true</enableAllSecurityServices> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/main/resources/application.properties b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/main/resources/application.properties index 0a49e8e..91d5d75 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/main/resources/application.properties +++ b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/main/resources/application.properties @@ -21,17 +21,10 @@ quarkus.log.file.enable = false quarkus.log.console.enable = false # -# Quarkus :: Camel -# -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true - -# # Camel # camel.context.name = camel-k-quarkus-ctx # # Integration -# \ No newline at end of file +# diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml index 7bd12fa..99b4bf2 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/pom.xml @@ -48,6 +48,10 @@ <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-quarkus-core-deployment</artifactId> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-xml-deployment</artifactId> + </dependency> </dependencies> <build> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/pom.xml index 185d6ee..5a75321 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/pom.xml @@ -142,8 +142,7 @@ <goal>native-image</goal> </goals> <configuration> - <dockerBuild>true</dockerBuild> - <containerRuntime>docker</containerRuntime> + <disableReports>true</disableReports> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> <enableAllSecurityServices>true</enableAllSecurityServices> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/main/resources/application.properties b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/main/resources/application.properties index 35a2894..876ce6b 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/main/resources/application.properties +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/main/resources/application.properties @@ -21,17 +21,6 @@ quarkus.log.file.enable = false quarkus.log.console.enable = false # -# Quarkus :: Camel -# -quarkus.camel.disable-xml = false -quarkus.camel.disable-jaxb = false -quarkus.camel.dump-routes = true - -# # Camel # camel.context.name = camel-k-quarkus-ctx - -# -# Integration -# \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml index cfda4c2..460d8be 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/pom.xml @@ -42,7 +42,7 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-xml-common</artifactId> + <artifactId>camel-quarkus-core-xml</artifactId> </dependency> </dependencies> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/pom.xml b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/pom.xml index 83e6883..bc2cb0f 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/pom.xml +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/pom.xml @@ -142,8 +142,7 @@ <goal>native-image</goal> </goals> <configuration> - <dockerBuild>true</dockerBuild> - <containerRuntime>docker</containerRuntime> + <disableReports>true</disableReports> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> <enableAllSecurityServices>true</enableAllSecurityServices> diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/main/resources/application.properties b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/main/resources/application.properties index 0a49e8e..a8f86e9 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/main/resources/application.properties +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/main/resources/application.properties @@ -20,12 +20,6 @@ quarkus.log.file.enable = false quarkus.log.console.enable = false -# -# Quarkus :: Camel -# -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true # # Camel @@ -34,4 +28,4 @@ camel.context.name = camel-k-quarkus-ctx # # Integration -# \ No newline at end of file +# diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntime.java b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntime.java deleted file mode 100644 index e8a0e7a..0000000 --- a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntime.java +++ /dev/null @@ -1,105 +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.k.quarkus; - -import java.util.ArrayList; -import java.util.List; -import java.util.ServiceLoader; -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.event.Observes; -import javax.inject.Inject; - -import io.quarkus.runtime.StartupEvent; -import org.apache.camel.CamelContext; -import org.apache.camel.k.Runtime; -import org.apache.camel.k.support.PropertiesSupport; -import org.apache.camel.quarkus.core.runtime.CamelRuntime; -import org.apache.camel.quarkus.core.runtime.StartedEvent; -import org.apache.camel.quarkus.core.runtime.StartingEvent; -import org.apache.camel.quarkus.core.runtime.StoppedEvent; -import org.apache.camel.quarkus.core.runtime.StoppingEvent; -import org.apache.camel.spi.HasId; -import org.apache.camel.spi.Registry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@ApplicationScoped -public class ApplicationRuntime implements Runtime { - private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationRuntime.class); - - @Inject - CamelRuntime runtime; - - private List<Listener> listeners = new ArrayList<>(); - - public void startup(@Observes StartupEvent event) { - LOGGER.info("Quarkus startup"); - } - - public void starting(@Observes StartingEvent event) { - LOGGER.info("Camel starting"); - - listeners.clear(); - - // - // Load and configure listeners - // - ServiceLoader.load(Runtime.Listener.class).forEach(l -> { - if (l instanceof HasId) { - String id = ((HasId) l).getId(); - if (!id.endsWith(".")) { - id = id + "."; - } - - PropertiesSupport.bindProperties(getCamelContext(), l, id); - } - - LOGGER.info("Adding listener: {}", l.getClass()); - listeners.add(l); - }); - - listeners.forEach(l -> l.accept(Phase.Starting, this)); - listeners.forEach(l -> l.accept(Phase.ConfigureContext, this)); - listeners.forEach(l -> l.accept(Phase.ConfigureRoutes, this)); - } - - public void started(@Observes StartedEvent event) { - LOGGER.info("Camel started"); - listeners.forEach(l -> l.accept(Phase.Started, this)); - } - - public void stopping(@Observes StoppingEvent event) { - LOGGER.info("Camel stopping"); - listeners.forEach(l -> l.accept(Phase.Stopping, this)); - } - - public void stopped(@Observes StoppedEvent event) { - LOGGER.info("Camel stopped"); - listeners.forEach(l -> l.accept(Phase.Stopped, this)); - } - - @Override - public CamelContext getCamelContext() { - return runtime.getContext(); - } - - @Override - public Registry getRegistry() { - return runtime.getRegistry(); - } - -} diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntimeConfigSourceProvider.java b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntimeConfigSourceProvider.java index 56f747e..dbe80cd 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntimeConfigSourceProvider.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/ApplicationRuntimeConfigSourceProvider.java @@ -39,7 +39,7 @@ public class ApplicationRuntimeConfigSourceProvider implements ConfigSourceProvi final List<ConfigSource> sources = new ArrayList<>(); try { - for (String location : PropertiesSupport.resolvePropertiesLocation(conf, confd)) { + for (String location : PropertiesSupport.resolvePropertiesLocations(conf, confd)) { LOGGER.info("Register properties location: {}", location); sources.add( diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml index 72eeea9..a8d11b8 100644 --- a/camel-k-runtime-core/pom.xml +++ b/camel-k-runtime-core/pom.xml @@ -46,11 +46,6 @@ <artifactId>camel-core-engine</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>provided</scope> - </dependency> <dependency> <groupId>org.apache.commons</groupId> diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java index c90fb5c..3097bb7 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java @@ -23,7 +23,6 @@ import org.apache.camel.CamelContext; import org.apache.camel.Ordered; import org.apache.camel.RoutesBuilder; import org.apache.camel.RuntimeCamelException; -import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.spi.HasCamelContext; import org.apache.camel.spi.Registry; @@ -36,10 +35,7 @@ public interface Runtime extends HasCamelContext { } default void setProperties(Properties properties) { - PropertiesComponent pc = new PropertiesComponent(); - pc.setOverrideProperties(properties); - - getRegistry().bind("properties", pc); + getCamelContext().getPropertiesComponent().setOverrideProperties(properties); } default void setProperties(Map<String, String> properties) { diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java index a75c851..2e94ead 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java @@ -33,8 +33,8 @@ import java.util.Properties; import java.util.Set; import org.apache.camel.CamelContext; -import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.k.Constants; +import org.apache.camel.spi.PropertiesComponent; import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.util.ObjectHelper; import org.apache.commons.io.FilenameUtils; @@ -45,7 +45,7 @@ public final class PropertiesSupport { @SuppressWarnings("unchecked") public static boolean bindProperties(CamelContext context, Object target, String prefix) { - final PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); + final PropertiesComponent component = context.getPropertiesComponent(); final Properties properties = component.loadProperties(k -> k.startsWith(prefix)); return PropertyBindingSupport.build() @@ -66,7 +66,7 @@ public final class PropertiesSupport { public static Properties loadProperties(String conf, String confd) { final Properties properties = new Properties(); - final Collection<String> locations = resolvePropertiesLocation(conf, confd); + final Collection<String> locations = resolvePropertiesLocations(conf, confd); try { for (String location: locations) { @@ -81,7 +81,14 @@ public final class PropertiesSupport { return properties; } - public static Collection<String> resolvePropertiesLocation(String conf, String confd) { + public static Collection<String> resolvePropertiesLocations() { + return resolvePropertiesLocations( + System.getProperty(Constants.PROPERTY_CAMEL_K_CONF, System.getenv(Constants.ENV_CAMEL_K_CONF)), + System.getProperty(Constants.PROPERTY_CAMEL_K_CONF_D, System.getenv(Constants.ENV_CAMEL_K_CONF_D)) + ); + } + + public static Collection<String> resolvePropertiesLocations(String conf, String confd) { final Set<String> locations = new LinkedHashSet<>(); // Main location diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java index 3bf5be1..52012ce 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java @@ -29,7 +29,6 @@ import java.util.regex.Pattern; import org.apache.camel.CamelContext; import org.apache.camel.ExtendedCamelContext; import org.apache.camel.NoFactoryAvailableException; -import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.k.Constants; import org.apache.camel.k.ContextCustomizer; import org.apache.camel.k.RoutesLoader; @@ -71,9 +70,7 @@ public final class RuntimeSupport { public static Map<String, ContextCustomizer> lookupCustomizers(CamelContext context) { Map<String, ContextCustomizer> customizers = new ConcurrentHashMap<>(); - - PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); - Properties properties = component.loadProperties(); + Properties properties = context.getPropertiesComponent().loadProperties(n -> n.startsWith("customizer.")); if (properties != null) { // @@ -118,7 +115,7 @@ public final class RuntimeSupport { .newInstance(customizerId, ContextCustomizer.class) .orElseThrow(() -> new RuntimeException("Error creating instance for customizer: " + customizerId)); - LOGGER.info("Found customizer {} with id {} rom service definition", customizer, customizerId); + LOGGER.info("Found customizer {} with id {} from service definition", customizer, customizerId); } catch (NoFactoryAvailableException e) { throw new RuntimeException(e); } @@ -134,12 +131,11 @@ public final class RuntimeSupport { String customizerIDs = System.getenv().getOrDefault(Constants.ENV_CAMEL_K_CUSTOMIZERS, ""); if (ObjectHelper.isEmpty(customizerIDs)) { - PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); - Properties properties = component.getInitialProperties(); - - if (properties != null) { - customizerIDs = properties.getProperty(Constants.PROPERTY_CAMEL_K_CUSTOMIZER, ""); - } + // TODO: getPropertiesComponent().resolveProperty() throws exception instead + // of returning abd empty optional + customizerIDs = context.getPropertiesComponent() + .loadProperties(Constants.PROPERTY_CAMEL_K_CUSTOMIZER::equals) + .getProperty(Constants.PROPERTY_CAMEL_K_CUSTOMIZER, ""); } if (ObjectHelper.isNotEmpty(customizerIDs)) { diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java index ace7e8f..bb424a2 100644 --- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java +++ b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java @@ -21,7 +21,6 @@ import java.util.Properties; import org.apache.camel.CamelContext; import org.apache.camel.Ordered; -import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy; import org.apache.camel.k.Constants; @@ -34,9 +33,7 @@ public class RuntimeSupportTest { @Test public void testLoadCustomizersWithPropertiesFlags() { - PropertiesComponent pc = new PropertiesComponent(); CamelContext context = new DefaultCamelContext(); - context.addComponent("properties", pc); NameCustomizer customizer = new NameCustomizer("from-registry"); context.getRegistry().bind("name", customizer); @@ -48,7 +45,7 @@ public class RuntimeSupportTest { Properties properties = new Properties(); properties.setProperty("customizer.name.enabled", "true"); - pc.setInitialProperties(properties); + context.getPropertiesComponent().setInitialProperties(properties); customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("from-registry"); @@ -57,9 +54,7 @@ public class RuntimeSupportTest { @Test public void testLoadCustomizersWithList() { - PropertiesComponent pc = new PropertiesComponent(); CamelContext context = new DefaultCamelContext(); - context.addComponent("properties", pc); NameCustomizer customizer = new NameCustomizer("from-registry"); context.getRegistry().bind("name", customizer); @@ -71,7 +66,7 @@ public class RuntimeSupportTest { Properties properties = new Properties(); properties.setProperty(Constants.PROPERTY_CAMEL_K_CUSTOMIZER, "name"); - pc.setInitialProperties(properties); + context.getPropertiesComponent().setInitialProperties(properties); customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("from-registry"); @@ -80,9 +75,7 @@ public class RuntimeSupportTest { @Test public void testLoadCustomizers() { - PropertiesComponent pc = new PropertiesComponent(); CamelContext context = new DefaultCamelContext(); - context.addComponent("properties", pc); context.getRegistry().bind("converters", (ContextCustomizer) (camelContext) -> camelContext.setLoadTypeConverters(false)); List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); @@ -93,14 +86,14 @@ public class RuntimeSupportTest { Properties properties = new Properties(); properties.setProperty("customizer.name.enabled", "true"); - pc.setInitialProperties(properties); + context.getPropertiesComponent().setInitialProperties(properties); customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("default"); assertThat(customizers).hasSize(1); properties.setProperty("customizer.converters.enabled", "true"); - pc.setInitialProperties(properties); + context.getPropertiesComponent().setInitialProperties(properties); customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("default"); @@ -110,10 +103,8 @@ public class RuntimeSupportTest { @Test public void testLoadCustomizerOrder() { - PropertiesComponent pc = new PropertiesComponent(); DefaultCamelContext context = new DefaultCamelContext(); context.setName("camel"); - context.addComponent("properties", pc); context.getRegistry().bind("c1", new ContextCustomizer() { @Override public int getOrder() { @@ -147,7 +138,8 @@ public class RuntimeSupportTest { properties.setProperty("customizer.c1.enabled", "true"); properties.setProperty("customizer.c2.enabled", "true"); properties.setProperty("customizer.c3.enabled", "true"); - pc.setInitialProperties(properties); + + context.getPropertiesComponent().setInitialProperties(properties); List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(customizers).hasSize(3); diff --git a/camel-k-runtime-health/pom.xml b/camel-k-runtime-health/pom.xml index 0c0d359..34ffae4 100644 --- a/camel-k-runtime-health/pom.xml +++ b/camel-k-runtime-health/pom.xml @@ -60,11 +60,6 @@ <artifactId>camel-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/camel-k-runtime-knative/pom.xml b/camel-k-runtime-knative/pom.xml index fb248d8..30f886f 100644 --- a/camel-k-runtime-knative/pom.xml +++ b/camel-k-runtime-knative/pom.xml @@ -60,12 +60,6 @@ <!-- ****************************** --> <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - - <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>${junit.version}</version> diff --git a/camel-k-runtime-main/pom.xml b/camel-k-runtime-main/pom.xml index b5649b3..0151c58 100644 --- a/camel-k-runtime-main/pom.xml +++ b/camel-k-runtime-main/pom.xml @@ -101,11 +101,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-endpointdsl</artifactId> <scope>test</scope> </dependency> diff --git a/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/Application.java b/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/Application.java index f5cc571..8d6aebe 100644 --- a/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/Application.java +++ b/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/Application.java @@ -19,7 +19,6 @@ package org.apache.camel.k.main; import java.util.ServiceLoader; import org.apache.camel.k.Runtime; -import org.apache.camel.k.support.PropertiesSupport; public final class Application { static { @@ -27,7 +26,7 @@ public final class Application { // Configure the logging subsystem log4j2 using a subset of spring boot // conventions: // - // logging.level.${nane} = OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE|ALL + // logging.level.${name} = OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE|ALL // // We now support setting the logging level only // @@ -39,7 +38,6 @@ public final class Application { public static void main(String[] args) throws Exception { ApplicationRuntime runtime = new ApplicationRuntime(); - runtime.setProperties(PropertiesSupport.loadProperties()); runtime.addListeners(ServiceLoader.load(Runtime.Listener.class)); runtime.run(); } diff --git a/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java b/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java index 43830aa..b91f7d5 100644 --- a/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java +++ b/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java @@ -20,15 +20,16 @@ import java.util.Comparator; import java.util.LinkedHashSet; import java.util.Properties; import java.util.Set; +import java.util.stream.Collectors; import org.apache.camel.CamelContext; +import org.apache.camel.ProducerTemplate; import org.apache.camel.RoutesBuilder; import org.apache.camel.RuntimeCamelException; -import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.Runtime; import org.apache.camel.k.support.PropertiesSupport; -import org.apache.camel.main.Main; +import org.apache.camel.main.BaseMainSupport; import org.apache.camel.main.MainSupport; import org.apache.camel.spi.HasId; import org.apache.camel.util.function.ThrowingConsumer; @@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory; public final class ApplicationRuntime implements Runtime { private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationRuntime.class); - private final Main main; + private final MainSupport main; private final DefaultCamelContext context; private final Set<Runtime.Listener> listeners; @@ -49,7 +50,15 @@ public final class ApplicationRuntime implements Runtime { this.context.setName("camel-k"); this.main = new MainAdapter(); + this.main.configure().setXmlRoutes("false"); + this.main.configure().setXmlRests("false"); this.main.addMainListener(new MainListenerAdapter()); + + this.main.setPropertyPlaceholderLocations( + PropertiesSupport.resolvePropertiesLocations().stream() + .map(location -> "file:" + location) + .collect(Collectors.joining(",")) + ); } @Override @@ -57,15 +66,6 @@ public final class ApplicationRuntime implements Runtime { return this.context; } - @Override - public void addRoutes(RoutesBuilder builder) { - if (builder instanceof RouteBuilder) { - this.main.addRouteBuilder((RouteBuilder) builder); - } else { - Runtime.super.addRoutes(builder); - } - } - public void run() throws Exception { this.main.run(); } @@ -75,6 +75,11 @@ public final class ApplicationRuntime implements Runtime { } @Override + public void addRoutes(RoutesBuilder builder) { + this.main.addRoutesBuilder(builder); + } + + @Override public void setProperties(Properties properties) { this.main.setOverrideProperties(properties); } @@ -115,7 +120,7 @@ public final class ApplicationRuntime implements Runtime { private final class MainListenerAdapter implements org.apache.camel.main.MainListener { @Override - public void beforeStart(MainSupport main) { + public void beforeStart(BaseMainSupport main) { invokeListeners(Phase.Starting); invokeListeners(Phase.ConfigureRoutes); } @@ -126,17 +131,17 @@ public final class ApplicationRuntime implements Runtime { } @Override - public void afterStart(MainSupport main) { + public void afterStart(BaseMainSupport main) { invokeListeners(Phase.Started); } @Override - public void beforeStop(MainSupport main) { + public void beforeStop(BaseMainSupport main) { invokeListeners(Phase.Stopping); } @Override - public void afterStop(MainSupport main) { + public void afterStop(BaseMainSupport main) { invokeListeners(Phase.Stopped); } @@ -151,11 +156,49 @@ public final class ApplicationRuntime implements Runtime { } } - private final class MainAdapter extends Main { + private final class MainAdapter extends MainSupport { @Override protected CamelContext createCamelContext() { return ApplicationRuntime.this.context; } + + @Override + protected void doInit() throws Exception { + super.doInit(); + initCamelContext(); + } + + @Override + protected void doStart() throws Exception { + super.doStart(); + if (getCamelContext() != null) { + try { + // if we were veto started then mark as completed + getCamelContext().start(); + } finally { + if (getCamelContext().isVetoStarted()) { + completed(); + } + } + } + } + + @Override + protected void doStop() throws Exception { + super.doStop(); + if (getCamelContext() != null) { + getCamelContext().stop(); + } + } + + @Override + protected ProducerTemplate findOrCreateCamelTemplate() { + if (getCamelContext() != null) { + return getCamelContext().createProducerTemplate(); + } else { + return null; + } + } } } diff --git a/camel-k-runtime-servlet/pom.xml b/camel-k-runtime-servlet/pom.xml index 6b13ddb..870cd8e 100644 --- a/camel-k-runtime-servlet/pom.xml +++ b/camel-k-runtime-servlet/pom.xml @@ -76,11 +76,6 @@ <artifactId>camel-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> <dependency> <groupId>org.junit.jupiter</groupId> diff --git a/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/CloudEventTypeConverter.java b/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/CloudEventTypeConverter.java index f0234b3..4477c52 100644 --- a/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/CloudEventTypeConverter.java +++ b/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/CloudEventTypeConverter.java @@ -18,7 +18,7 @@ package org.apache.camel.component.knative.spi; import org.apache.camel.Converter; -@Converter(loader = true) +@Converter(generateLoader = true) public final class CloudEventTypeConverter { private CloudEventTypeConverter() { } diff --git a/camel-knative/camel-knative-http/pom.xml b/camel-knative/camel-knative-http/pom.xml index e70584d..1b45fa1 100644 --- a/camel-knative/camel-knative-http/pom.xml +++ b/camel-knative/camel-knative-http/pom.xml @@ -100,11 +100,6 @@ <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-mock</artifactId> <scope>test</scope> </dependency> diff --git a/camel-knative/camel-knative/pom.xml b/camel-knative/camel-knative/pom.xml index c731e6d..4b0b493 100644 --- a/camel-knative/camel-knative/pom.xml +++ b/camel-knative/camel-knative/pom.xml @@ -131,11 +131,6 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-undertow</artifactId> <scope>test</scope> </dependency> diff --git a/examples/camel-k-runtime-example-health/src/main/resources/application.properties b/examples/camel-k-runtime-example-health/src/main/resources/application.properties index 48f8c28..2e302fb 100644 --- a/examples/camel-k-runtime-example-health/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-health/src/main/resources/application.properties @@ -14,10 +14,18 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + +# +# Logging +# +logging.level.org.apache.camel.k = DEBUG + # -# Camel +# camel - main # -camel.context.streamCaching = true +camel.main.name = camel-k +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k # # Camel K diff --git a/examples/camel-k-runtime-example-knative/src/main/resources/application.properties b/examples/camel-k-runtime-example-knative/src/main/resources/application.properties index 4682185..85a8fe9 100644 --- a/examples/camel-k-runtime-example-knative/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-knative/src/main/resources/application.properties @@ -14,15 +14,18 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + # # Logging # logging.level.org.apache.camel.k = DEBUG # -# Camel +# camel - main # -camel.context.stream-caching = true +camel.main.name = camel-k +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k # # Camel - components diff --git a/examples/camel-k-runtime-example-quarkus-js/pom.xml b/examples/camel-k-runtime-example-quarkus-js/pom.xml index 5853de1..df63941 100644 --- a/examples/camel-k-runtime-example-quarkus-js/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-js/pom.xml @@ -123,10 +123,6 @@ <name>native</name> </property> </activation> - <properties> - <native-image.container-runtime>docker</native-image.container-runtime> - <native-image.docker-build>true</native-image.docker-build> - </properties> <build> <plugins> <plugin> @@ -142,6 +138,7 @@ <finalName>${project.artifactId}</finalName> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> + <disableReports>true</disableReports> <additionalBuildArgs> <additionalBuildArg>--language:js</additionalBuildArg> </additionalBuildArgs> diff --git a/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties index 271e69b..c543799 100644 --- a/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-js/src/main/resources/application.properties @@ -24,16 +24,8 @@ quarkus.log.level = INFO quarkus.log.category."org.apache.camel".level = INFO # -# camel - quarkus +# camel - main # -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true - - -# -# camel -# -camel.context.name = camel-q -camel.context.stream-caching = true -camel.context.stream-caching-strategy.spool-directory = ${java.io.tmpdir}/camel-q +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q diff --git a/examples/camel-k-runtime-example-quarkus-knative/pom.xml b/examples/camel-k-runtime-example-quarkus-knative/pom.xml index 2cbd59b..650d64d 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-knative/pom.xml @@ -125,10 +125,6 @@ <name>native</name> </property> </activation> - <properties> - <native-image.container-runtime>docker</native-image.container-runtime> - <native-image.docker-build>true</native-image.docker-build> - </properties> <build> <plugins> <plugin> @@ -144,6 +140,7 @@ <finalName>${project.artifactId}</finalName> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> + <disableReports>true</disableReports> </configuration> </execution> </executions> diff --git a/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties index 52a1e29..8ddef31 100644 --- a/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-knative/src/main/resources/application.properties @@ -26,9 +26,10 @@ quarkus.log.console.level = INFO quarkus.log.category."org.apache.camel.quarkus".level = DEBUG # -# camel - quarkus +# camel - main # -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q + diff --git a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml index 6baef94..46154f6 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml @@ -132,10 +132,6 @@ <name>native</name> </property> </activation> - <properties> - <native-image.container-runtime>docker</native-image.container-runtime> - <native-image.docker-build>true</native-image.docker-build> - </properties> <build> <plugins> <plugin> @@ -151,6 +147,7 @@ <finalName>${project.artifactId}</finalName> <enableHttpUrlHandler>true</enableHttpUrlHandler> <enableJni>true</enableJni> + <disableReports>true</disableReports> </configuration> </execution> </executions> diff --git a/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties index 271e69b..6e9048b 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-quarkus-yaml/src/main/resources/application.properties @@ -24,16 +24,8 @@ quarkus.log.level = INFO quarkus.log.category."org.apache.camel".level = INFO # -# camel - quarkus +# camel - main # -quarkus.camel.disable-xml = true -quarkus.camel.disable-jaxb = true -quarkus.camel.dump-routes = true - - -# -# camel -# -camel.context.name = camel-q -camel.context.stream-caching = true -camel.context.stream-caching-strategy.spool-directory = ${java.io.tmpdir}/camel-q +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q \ No newline at end of file diff --git a/examples/camel-k-runtime-example-servlet/src/main/resources/application.properties b/examples/camel-k-runtime-example-servlet/src/main/resources/application.properties index e7daa91..08f0a0c 100644 --- a/examples/camel-k-runtime-example-servlet/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-servlet/src/main/resources/application.properties @@ -14,14 +14,22 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + +# +# Logging +# +logging.level.org.apache.camel.k = DEBUG + # -# Camel +# camel - main # -camel.context.streamCaching = true +camel.main.name = camel-k +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k # # Camel K # customizer.servletregistration.enabled = true customizer.servletregistration.path = /mypath/* -customizer.servlet.enabled = true \ No newline at end of file +customizer.servlet.enabled = true diff --git a/examples/camel-k-runtime-example-yaml/pom.xml b/examples/camel-k-runtime-example-yaml/pom.xml index ace2810..e0cfd1c 100644 --- a/examples/camel-k-runtime-example-yaml/pom.xml +++ b/examples/camel-k-runtime-example-yaml/pom.xml @@ -93,7 +93,7 @@ <systemProperties> <systemProperty> <key>camel.k.conf</key> - <value>${project.basedir}/src/main/resources/application.properties</value> + <value>${project.basedir}/src/main/resources/conf/application.properties</value> </systemProperty> <systemProperty> <key>camel.k.routes</key> diff --git a/examples/camel-k-runtime-example-yaml/src/main/resources/application.properties b/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties similarity index 86% rename from examples/camel-k-runtime-example-yaml/src/main/resources/application.properties rename to examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties index 1d38fc2..7209cae 100644 --- a/examples/camel-k-runtime-example-yaml/src/main/resources/application.properties +++ b/examples/camel-k-runtime-example-yaml/src/main/resources/conf/application.properties @@ -14,15 +14,18 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + # # Logging # logging.level.org.apache.camel.k = DEBUG # -# Camel +# camel - main # -camel.context.stream-caching = true +camel.main.name = camel-k +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-k # # Camel REST diff --git a/pom.xml b/pom.xml index 0f300ba..29d5638 100644 --- a/pom.xml +++ b/pom.xml @@ -35,10 +35,9 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <camel.version>3.0.0-RC1</camel.version> - <camel-quarkus.version>0.2.0</camel-quarkus.version> + <camel.version>3.0.0-RC3</camel.version> + <camel-quarkus.version>0.3.0</camel-quarkus.version> <catalog.version>${camel.version}</catalog.version> - <quarkus.catalog.version>0.2.1-SNAPSHOT</quarkus.catalog.version> <junit.version>5.5.2</junit.version> <joor.version>0.9.12</joor.version> <commons-io.version>2.6</commons-io.version> @@ -59,8 +58,8 @@ <semver4j.version>3.1.0</semver4j.version> <undertow.version>1.4.26.Final</undertow.version> <vertx.version>3.8.1</vertx.version> - <graalvm.version>19.1.1</graalvm.version> - <quarkus.version>0.21.2</quarkus.version> + <graalvm.version>19.2.0.1</graalvm.version> + <quarkus.version>0.26.1</quarkus.version> <jandex.version>2.1.1.Final</jandex.version> <javapoet.version>1.11.1</javapoet.version> <auto-service.version>1.0-rc6</auto-service.version> @@ -239,6 +238,18 @@ <enabled>false</enabled> </releases> </repository> + + <repository> + <id>apache.staging</id> + <url>https://repository.apache.org/content/repositories/orgapachecamel-1159</url> + <name>Apache Snapshot Repo</name> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + </releases> + </repository> </repositories> <pluginRepositories> @@ -252,6 +263,17 @@ <enabled>false</enabled> </releases> </pluginRepository> + <pluginRepository> + <id>apache.staging</id> + <url>https://repository.apache.org/content/repositories/orgapachecamel-1159</url> + <name>Apache Snapshot Repo</name> + <snapshots> + <enabled>false</enabled> + </snapshots> + <releases> + <enabled>true</enabled> + </releases> + </pluginRepository> </pluginRepositories> <dependencyManagement> @@ -645,5 +667,17 @@ </plugins> </build> </profile> + <profile> + <id>docker</id> + <activation> + <property> + <name>docker</name> + </property> + </activation> + <properties> + <native-image.container-runtime>docker</native-image.container-runtime> + <native-image.docker-build>true</native-image.docker-build> + </properties> + </profile> </profiles> </project> diff --git a/tooling/camel-k-maven-plugin/pom.xml b/tooling/camel-k-maven-plugin/pom.xml index 37aa2f0..e65e55a 100644 --- a/tooling/camel-k-maven-plugin/pom.xml +++ b/tooling/camel-k-maven-plugin/pom.xml @@ -99,7 +99,7 @@ <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-catalog-quarkus</artifactId> - <version>${quarkus.catalog.version}</version> + <version>${camel-quarkus.version}</version> <scope>provided</scope> </dependency> <dependency> diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java index 05d4b87..3d26b5d 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java @@ -59,7 +59,6 @@ public class CatalogProcessor3x implements CatalogProcessor { "language", "log", "mock", - "properties", "ref", "seda", "stub", @@ -94,7 +93,6 @@ public class CatalogProcessor3x implements CatalogProcessor { artifact.setArtifactId("camel-k-runtime-main"); artifact.addDependency("org.apache.camel", "camel-core-engine"); artifact.addDependency("org.apache.camel", "camel-main"); - artifact.addDependency("org.apache.camel", "camel-properties"); artifacts.put(artifact.getArtifactId(), artifact); }