diff --git a/camel-k-loader-xml/pom.xml b/camel-k-loader-xml/pom.xml index 71fa5a698..29b938a47 100644 --- a/camel-k-loader-xml/pom.xml +++ b/camel-k-loader-xml/pom.xml @@ -46,23 +46,7 @@ org.apache.camel - camel-xml-jaxb - - - - javax.xml.bind - jaxb-api - ${jaxb-api.version} - - - com.sun.xml.bind - jaxb-core - ${jaxb-core.version} - - - com.sun.xml.bind - jaxb-impl - ${jaxb-api.version} + camel-xml-io diff --git a/camel-k-loader-xml/src/main/java/org/apache/camel/k/loader/xml/XmlSourceLoader.java b/camel-k-loader-xml/src/main/java/org/apache/camel/k/loader/xml/XmlSourceLoader.java index 60aee2fd9..a2d3f8f6b 100644 --- a/camel-k-loader-xml/src/main/java/org/apache/camel/k/loader/xml/XmlSourceLoader.java +++ b/camel-k-loader-xml/src/main/java/org/apache/camel/k/loader/xml/XmlSourceLoader.java @@ -20,8 +20,6 @@ import java.util.Collections; import java.util.List; -import javax.xml.bind.UnmarshalException; - import org.apache.camel.ExtendedCamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.k.Runtime; @@ -31,6 +29,7 @@ import org.apache.camel.model.RoutesDefinition; import org.apache.camel.model.rest.RestsDefinition; import org.apache.camel.spi.XMLRoutesDefinitionLoader; +import org.apache.camel.xml.io.XmlPullParserException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +60,7 @@ public void configure() throws Exception { } } catch (IllegalArgumentException e) { // ignore - } catch (UnmarshalException e) { + } catch (XmlPullParserException e) { LOGGER.debug("Unable to load RoutesDefinition: {}", e.getMessage()); } } @@ -76,7 +75,7 @@ public void configure() throws Exception { } } catch (IllegalArgumentException e) { // ignore - } catch (UnmarshalException e) { + } catch (XmlPullParserException e) { LOGGER.debug("Unable to load RestsDefinition: {}", e.getMessage()); } } 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 9f7481b4a..fb2e27847 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,10 +48,6 @@ org.apache.camel.k camel-k-quarkus-core-deployment - - org.apache.camel.quarkus - camel-quarkus-core-xml-deployment - 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-loader-xml/deployment/src/main/java/org/apache/camel/k/loader/xml/quarkus/deployment/DeploymentProcessor.java new file mode 100644 index 000000000..6d5a339b2 --- /dev/null +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/deployment/src/main/java/org/apache/camel/k/loader/xml/quarkus/deployment/DeploymentProcessor.java @@ -0,0 +1,37 @@ +/* + * 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.loader.xml.quarkus.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import org.apache.camel.k.loader.xml.quarkus.XmlLoaderRecorder; +import org.apache.camel.quarkus.core.deployment.CamelRoutesLoaderBuildItems; + +public class DeploymentProcessor { + @BuildStep + @Record(value = ExecutionTime.STATIC_INIT, optional = true) + CamelRoutesLoaderBuildItems.Xml xmlLoader(XmlLoaderRecorder recorder) { + return new CamelRoutesLoaderBuildItems.Xml(recorder.newXMLIORoutesDefinitionLoader()); + } + + @BuildStep + @Record(value = ExecutionTime.STATIC_INIT) + void initXmlReifiers(XmlLoaderRecorder recorder) { + recorder.initXmlReifiers(); + } +} 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 137aecdb3..a5db024e8 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 @@ -32,10 +32,6 @@ org.apache.camel.k camel-k-quarkus-core - - org.apache.camel.quarkus - camel-quarkus-core-xml - org.apache.camel.k camel-k-loader-xml diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/src/main/java/org/apache/camel/k/loader/xml/quarkus/XmlLoaderRecorder.java b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/src/main/java/org/apache/camel/k/loader/xml/quarkus/XmlLoaderRecorder.java new file mode 100644 index 000000000..e7b141add --- /dev/null +++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/runtime/src/main/java/org/apache/camel/k/loader/xml/quarkus/XmlLoaderRecorder.java @@ -0,0 +1,40 @@ +/* + * 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.loader.xml.quarkus; + +import io.quarkus.runtime.RuntimeValue; +import io.quarkus.runtime.annotations.Recorder; +import org.apache.camel.model.ValidateDefinition; +import org.apache.camel.model.validator.PredicateValidatorDefinition; +import org.apache.camel.reifier.ProcessorReifier; +import org.apache.camel.reifier.ValidateReifier; +import org.apache.camel.reifier.validator.PredicateValidatorReifier; +import org.apache.camel.reifier.validator.ValidatorReifier; +import org.apache.camel.spi.XMLRoutesDefinitionLoader; +import org.apache.camel.xml.in.ModelParserXMLRoutesDefinitionLoader; + +@Recorder +public class XmlLoaderRecorder { + public RuntimeValue newXMLIORoutesDefinitionLoader() { + return new RuntimeValue<>(new ModelParserXMLRoutesDefinitionLoader()); + } + + public void initXmlReifiers() { + ProcessorReifier.registerReifier(ValidateDefinition.class, ValidateReifier::new); + ValidatorReifier.registerReifier(PredicateValidatorDefinition.class, PredicateValidatorReifier::new); + } +} diff --git a/examples/camel-k-runtime-example-quarkus-xml/data/application.properties b/examples/camel-k-runtime-example-quarkus-xml/data/application.properties new file mode 100644 index 000000000..48757ed28 --- /dev/null +++ b/examples/camel-k-runtime-example-quarkus-xml/data/application.properties @@ -0,0 +1,29 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# +# camel - main +# +camel.main.name = camel-q +camel.main.stream-caching-enabled = true +camel.main.stream-caching-spool-directory = ${java.io.tmpdir}/camel-q + +# +# Integration +# +period = 1s +message = test-app diff --git a/examples/camel-k-runtime-example-quarkus-xml/data/routes.xml b/examples/camel-k-runtime-example-quarkus-xml/data/routes.xml new file mode 100644 index 000000000..c4f08c486 --- /dev/null +++ b/examples/camel-k-runtime-example-quarkus-xml/data/routes.xml @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/camel-k-runtime-example-quarkus-xml/pom.xml b/examples/camel-k-runtime-example-quarkus-xml/pom.xml new file mode 100644 index 000000000..7ddaeaefe --- /dev/null +++ b/examples/camel-k-runtime-example-quarkus-xml/pom.xml @@ -0,0 +1,172 @@ + + + + + + org.apache.camel.k + camel-k-runtime-examples + 1.1.1-SNAPSHOT + + + 4.0.0 + camel-k-runtime-example-quarkus-xml + + + true + false + + + + + + org.apache.camel.quarkus + camel-quarkus-bom + ${camel-quarkus.version} + pom + import + + + + + + + org.apache.camel.k + camel-k-runtime-quarkus + + + org.apache.camel.k + camel-k-quarkus-loader-xml + + + + org.apache.camel.quarkus + camel-quarkus-log + + + org.apache.camel.quarkus + camel-quarkus-timer + + + + + + + io.quarkus + quarkus-bootstrap-maven-plugin + ${quarkus.version} + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + build + + build + + + ${project.artifactId} + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + exec + + + + + java + ${project.basedir} + + -jar + ${project.build.directory}/${project.artifactId}-runner.jar + + + ${project.basedir}/data/application.properties + file:${project.basedir}/data/routes.xml + + + + + + + + + native + + false + + native + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + native-image + + + ${project.artifactId} + true + true + true + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + exec + + + + + ${project.build.directory}/${project.artifactId}-runner + ${project.basedir} + + ${project.basedir}/data/application.properties + file:${project.basedir}/data/routes.xml + + + + + + + + + diff --git a/examples/camel-k-runtime-example-quarkus-xml/src/main/resources/application.properties b/examples/camel-k-runtime-example-quarkus-xml/src/main/resources/application.properties new file mode 100644 index 000000000..88c3528b4 --- /dev/null +++ b/examples/camel-k-runtime-example-quarkus-xml/src/main/resources/application.properties @@ -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. +## --------------------------------------------------------------------------- +# +# quarkus - log +# +quarkus.log.file.enable = false +quarkus.log.console.enable = true + +quarkus.log.level = INFO +quarkus.log.category."org.apache.camel".level = INFO diff --git a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml index 9f2ca1afe..26a6e3ef5 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml +++ b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml @@ -67,6 +67,22 @@ org.apache.camel.quarkus camel-quarkus-timer + + + + io.quarkus + quarkus-vertx-core + ${quarkus.version} + diff --git a/examples/pom.xml b/examples/pom.xml index 5eab6e6b3..61fcdbbea 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -42,6 +42,7 @@ camel-k-runtime-example-quarkus-knative camel-k-runtime-example-quarkus-groovy camel-k-runtime-example-quarkus-java + camel-k-runtime-example-quarkus-xml