This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit efa8238a73b5a2c0c2ca679d428db02446c3b392 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue May 25 15:24:17 2021 +0200 Removed Groovy code that was refactored/moved to Camel Core in Camel 3.10 --- camel-k-loader-groovy/deployment/pom.xml | 63 ------------- .../deployment/GroovySourceLoaderFeature.java | 29 ------ .../deployment/GroovySourceLoaderProcessor.java | 36 -------- camel-k-loader-groovy/pom.xml | 36 -------- camel-k-loader-groovy/runtime/pom.xml | 86 ----------------- .../groovy/quarkus/GroovySourceLoaderRecorder.java | 102 --------------------- 6 files changed, 352 deletions(-) diff --git a/camel-k-loader-groovy/deployment/pom.xml b/camel-k-loader-groovy/deployment/pom.xml deleted file mode 100644 index a07ae08..0000000 --- a/camel-k-loader-groovy/deployment/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-loader-groovy-parent</artifactId> - <version>1.8.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>camel-k-loader-groovy-deployment</artifactId> - - <dependencies> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-loader-groovy</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-core-deployment</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-groovy-dsl-deployment</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/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderFeature.java b/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderFeature.java deleted file mode 100644 index 7d8d6d4..0000000 --- a/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderFeature.java +++ /dev/null @@ -1,29 +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.loader.groovy.quarkus.deployment; - -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.FeatureBuildItem; - -public class GroovySourceLoaderFeature { - private static final String FEATURE = "camel-k-loader-groovy"; - - @BuildStep - FeatureBuildItem feature() { - return new FeatureBuildItem(FEATURE); - } -} diff --git a/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderProcessor.java b/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderProcessor.java deleted file mode 100644 index 89b0cf0..0000000 --- a/camel-k-loader-groovy/deployment/src/main/java/org/apache/camel/k/loader/groovy/quarkus/deployment/GroovySourceLoaderProcessor.java +++ /dev/null @@ -1,36 +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.loader.groovy.quarkus.deployment; - -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; -import org.apache.camel.impl.engine.DefaultRoutesLoader; -import org.apache.camel.k.loader.groovy.quarkus.GroovySourceLoaderRecorder; -import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeBeanBuildItem; - -public class GroovySourceLoaderProcessor { - - @Record(ExecutionTime.RUNTIME_INIT) - @BuildStep - CamelRuntimeBeanBuildItem groovyLoader(GroovySourceLoaderRecorder recorder) { - return new CamelRuntimeBeanBuildItem( - DefaultRoutesLoader.ROUTES_LOADER_KEY_PREFIX + "groovy", - "org.apache.camel.spi.RoutesBuilderLoader", - recorder.createLoader()); - } -} diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml deleted file mode 100644 index aa964bf..0000000 --- a/camel-k-loader-groovy/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-runtime-project</artifactId> - <version>1.8.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>pom</packaging> - - <artifactId>camel-k-loader-groovy-parent</artifactId> - - <modules> - <module>runtime</module> - <module>deployment</module> - </modules> - -</project> diff --git a/camel-k-loader-groovy/runtime/pom.xml b/camel-k-loader-groovy/runtime/pom.xml deleted file mode 100644 index e9e25f7..0000000 --- a/camel-k-loader-groovy/runtime/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ -<?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"> - <parent> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-loader-groovy-parent</artifactId> - <version>1.8.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>camel-k-loader-groovy</artifactId> - - <dependencies> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-groovy-dsl</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-bootstrap-maven-plugin</artifactId> - <version>${quarkus-version}</version> - <executions> - <execution> - <goals> - <goal>extension-descriptor</goal> - </goals> - <configuration> - <deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment> - </configuration> - </execution> - </executions> - </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> - <plugin> - <groupId>org.jboss.jandex</groupId> - <artifactId>jandex-maven-plugin</artifactId> - <executions> - <execution> - <id>make-index</id> - <goals> - <goal>jandex</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/camel-k-loader-groovy/runtime/src/main/java/org/apache/camel/k/loader/groovy/quarkus/GroovySourceLoaderRecorder.java b/camel-k-loader-groovy/runtime/src/main/java/org/apache/camel/k/loader/groovy/quarkus/GroovySourceLoaderRecorder.java deleted file mode 100644 index bf72e5f..0000000 --- a/camel-k-loader-groovy/runtime/src/main/java/org/apache/camel/k/loader/groovy/quarkus/GroovySourceLoaderRecorder.java +++ /dev/null @@ -1,102 +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.loader.groovy.quarkus; - -import java.io.Reader; - -import groovy.lang.Binding; -import groovy.lang.GroovyShell; -import groovy.util.DelegatingScript; -import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.annotations.Recorder; -import org.apache.camel.ExtendedCamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.StartupStep; -import org.apache.camel.api.management.ManagedAttribute; -import org.apache.camel.builder.endpoint.EndpointRouteBuilder; -import org.apache.camel.dsl.groovy.GroovyDSL; -import org.apache.camel.dsl.groovy.GroovyRoutesBuilderLoader; -import org.apache.camel.spi.Resource; -import org.apache.camel.spi.RoutesBuilderLoader; -import org.apache.camel.spi.StartupStepRecorder; -import org.codehaus.groovy.control.CompilerConfiguration; -import org.codehaus.groovy.control.customizers.ImportCustomizer; - -@Recorder -public class GroovySourceLoaderRecorder { - public RuntimeValue<RoutesBuilderLoader> createLoader() { - return new RuntimeValue<>(new Loader()); - } - - public static class Loader extends GroovyRoutesBuilderLoader { - public static final String EXTENSION = "groovy"; - - private StartupStepRecorder recorder; - - @Override - protected void doBuild() throws Exception { - super.doBuild(); - - if (getCamelContext() != null) { - this.recorder = getCamelContext().adapt(ExtendedCamelContext.class).getStartupStepRecorder(); - } - } - - @ManagedAttribute(description = "Supported file extension") - @Override - public String getSupportedExtension() { - return EXTENSION; - } - - - @Override - public RoutesBuilder loadRoutesBuilder(Resource resource) throws Exception { - StartupStep step = recorder != null - ? recorder.beginStep(GroovyRoutesBuilderLoader.class, resource.getLocation(), "Compiling RouteBuilder") - : null; - - try { - return EndpointRouteBuilder.loadEndpointRoutesBuilder(resource, this::load); - } finally { - if (recorder != null) { - recorder.endStep(step); - } - } - } - - private void load(Reader reader, EndpointRouteBuilder builder) { - ImportCustomizer ic = new ImportCustomizer(); - ic.addStarImports("org.apache.camel"); - ic.addStarImports("org.apache.camel.spi"); - - CompilerConfiguration cc = new CompilerConfiguration(); - cc.addCompilationCustomizers(ic); - cc.setScriptBaseClass(DelegatingScript.class.getName()); - - ClassLoader cl = builder.getContext().getApplicationContextClassLoader() != null - ? builder.getContext().getApplicationContextClassLoader() - : Thread.currentThread().getContextClassLoader(); - - GroovyShell sh = new GroovyShell(cl, new Binding(), cc); - DelegatingScript script = (DelegatingScript) sh.parse(reader); - - // set the delegate target - script.setDelegate(new GroovyDSL(builder)); - script.run(); - } - } -}
