This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit ea8fd08a2f13cb5e5fe0b6950ebbbc6eb55e218f Author: Luca Burgazzoli <lburgazz...@gmail.com> AuthorDate: Thu Apr 8 15:13:26 2021 +0200 dsl(groovy): use java to implement the route buiolder loader instead of groovy --- bom/camel-bom/pom.xml | 5 + .../camel-groovy-dsl-common/pom.xml | 99 ++++++++++++ .../camel/dsl/groovy/common}/GroovyDSL.groovy | 10 +- .../extensions/CamelContextExtensions.groovy | 2 +- .../extensions/ExpressionClauseExtensions.groovy | 2 +- .../ProcessorDefinitionExtensions.groovy | 2 +- .../groovy/common}/model/BeanConfiguration.groovy | 2 +- .../groovy/common}/model/BeansConfiguration.groovy | 2 +- .../groovy/common}/model/CamelConfiguration.groovy | 2 +- .../dsl/groovy/common}/model/Components.groovy | 2 +- .../common}/model/ComponentsConfiguration.groovy | 2 +- .../common}/model/DataFormatsConfiguration.groovy | 2 +- .../common}/model/LanguagesConfiguration.groovy | 2 +- .../groovy/common}/model/RestConfiguration.groovy | 2 +- .../common}/model/RestVerbConfiguration.groovy | 2 +- .../org.codehaus.groovy.runtime.ExtensionModule | 6 +- .../src/main/resources/integration.gdsl | 2 +- .../{ => camel-groovy-dsl-test}/pom.xml | 40 +---- .../dsl/groovy/GroovyRouteBuilderLoaderTest.groovy | 0 .../apache/camel/dsl/groovy/support/MyBean.groovy | 0 .../src/test/resources/log4j2-test.properties | 0 .../test/resources/routes/issues/github-529.groovy | 0 .../test/resources/routes/routes-with-beans.groovy | 0 ...ith-component-wrong-method-configuration.groovy | 0 ...h-component-wrong-property-configuration.groovy | 0 .../routes-with-components-configuration.groovy | 0 .../routes-with-dataformats-configuration.groovy | 0 .../test/resources/routes/routes-with-eip.groovy | 0 .../routes/routes-with-endpoint-dsl.groovy | 0 .../routes/routes-with-error-handler.groovy | 0 .../routes-with-languages-configuration.groovy | 0 .../test/resources/routes/routes-with-rest.groovy | 0 .../src/test/resources/routes/routes.groovy | 0 dsl/camel-groovy-dsl/camel-groovy-dsl/pom.xml | 78 +++++++++ .../services/org/apache/camel/routes-loader/groovy | 0 .../src/main/docs/groovy-dsl.adoc | 0 .../dsl/groovy/GroovyRoutesBuilderLoader.java} | 48 +++--- .../dsl/groovy/GroovyRoutesBuilderSupport.java | 53 ++++++ dsl/camel-groovy-dsl/pom.xml | 178 ++------------------- .../dsl/groovy/GroovyRoutesBuilderSupport.groovy | 44 ----- parent/pom.xml | 5 + 41 files changed, 302 insertions(+), 290 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 4a52281..5dadc0e 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -839,6 +839,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-groovy-dsl-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-grpc</artifactId> <version>${project.version}</version> </dependency> diff --git a/dsl/camel-groovy-dsl/camel-groovy-dsl-common/pom.xml b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/pom.xml new file mode 100644 index 0000000..1170df7 --- /dev/null +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/pom.xml @@ -0,0 +1,99 @@ +<?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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>camel-groovy-dsl-parent</artifactId> + <version>3.10.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-groovy-dsl-common</artifactId> + <packaging>jar</packaging> + <name>Camel :: Groovy DSL :: Common</name> + <description>Camel DSL with Groovy (Common)</description> + + <properties> + <sourcecheckExcludes> + **/resources/**/My*.java + </sourcecheckExcludes> + <sourcecheckExcludesComma> + ${sourcecheckExcludes}, + </sourcecheckExcludesComma> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-model</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-endpointdsl</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.gmavenplus</groupId> + <artifactId>gmavenplus-plugin</artifactId> + <version>${gmavenplus-plugin-version}</version> + <executions> + <execution> + <goals> + <goal>addSources</goal> + <goal>addTestSources</goal> + <goal>compile</goal> + <goal>compileTests</goal> + </goals> + </execution> + </executions> + <configuration> + <invokeDynamic>true</invokeDynamic> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-spi</id> + <goals> + <goal>generate-spi</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyDSL.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/GroovyDSL.groovy similarity index 93% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyDSL.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/GroovyDSL.groovy index 81fba6c..171fea4 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyDSL.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/GroovyDSL.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy +package org.apache.camel.dsl.groovy.common import org.apache.camel.Exchange import org.apache.camel.Predicate @@ -24,10 +24,10 @@ import org.apache.camel.builder.EndpointConsumerBuilder import org.apache.camel.builder.ErrorHandlerBuilder import org.apache.camel.builder.endpoint.EndpointBuilderFactory import org.apache.camel.builder.endpoint.EndpointRouteBuilder -import org.apache.camel.dsl.groovy.model.BeansConfiguration -import org.apache.camel.dsl.groovy.model.CamelConfiguration -import org.apache.camel.dsl.groovy.model.Components -import org.apache.camel.dsl.groovy.model.RestConfiguration +import org.apache.camel.dsl.groovy.common.model.BeansConfiguration +import org.apache.camel.dsl.groovy.common.model.CamelConfiguration +import org.apache.camel.dsl.groovy.common.model.Components +import org.apache.camel.dsl.groovy.common.model.RestConfiguration import org.apache.camel.model.InterceptDefinition import org.apache.camel.model.InterceptFromDefinition import org.apache.camel.model.InterceptSendToEndpointDefinition diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/CamelContextExtensions.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/CamelContextExtensions.groovy similarity index 96% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/CamelContextExtensions.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/CamelContextExtensions.groovy index 39065e1..6387950 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/CamelContextExtensions.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/CamelContextExtensions.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.extensions +package org.apache.camel.dsl.groovy.common.extensions import groovy.transform.CompileStatic import org.apache.camel.CamelContext diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ExpressionClauseExtensions.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ExpressionClauseExtensions.groovy similarity index 97% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ExpressionClauseExtensions.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ExpressionClauseExtensions.groovy index 9257f13..0696af4 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ExpressionClauseExtensions.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ExpressionClauseExtensions.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.extensions +package org.apache.camel.dsl.groovy.common.extensions import groovy.transform.CompileStatic import org.apache.camel.Message diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ProcessorDefinitionExtensions.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ProcessorDefinitionExtensions.groovy similarity index 97% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ProcessorDefinitionExtensions.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ProcessorDefinitionExtensions.groovy index d23d97f..38f7300 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/extensions/ProcessorDefinitionExtensions.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/extensions/ProcessorDefinitionExtensions.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.extensions +package org.apache.camel.dsl.groovy.common.extensions import groovy.transform.CompileStatic import org.apache.camel.Exchange diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeanConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeanConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeanConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeanConfiguration.groovy index ecf5756..018e9c9 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeanConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeanConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.ExtendedCamelContext diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeansConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeansConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeansConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeansConfiguration.groovy index 8676217..fed4ea4 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/BeansConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/BeansConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.Exchange diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/CamelConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/CamelConfiguration.groovy similarity index 97% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/CamelConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/CamelConfiguration.groovy index ae9c732..51c2f29 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/CamelConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/CamelConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/Components.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/Components.groovy similarity index 96% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/Components.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/Components.groovy index b2af1b8..c63d9b7 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/Components.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/Components.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.Component diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/ComponentsConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/ComponentsConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/ComponentsConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/ComponentsConfiguration.groovy index 2d5cff1..3fd738c 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/ComponentsConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/ComponentsConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.Component diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/DataFormatsConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/DataFormatsConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/DataFormatsConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/DataFormatsConfiguration.groovy index 237d352..9c68712 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/DataFormatsConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/DataFormatsConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.spi.DataFormat diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/LanguagesConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/LanguagesConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/LanguagesConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/LanguagesConfiguration.groovy index a34dc17..ce23df9 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/LanguagesConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/LanguagesConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.CamelContext import org.apache.camel.spi.Language diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestConfiguration.groovy similarity index 96% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestConfiguration.groovy index ccaae28..fc974ea 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.builder.RouteBuilder import org.apache.camel.model.rest.RestConfigurationDefinition diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestVerbConfiguration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestVerbConfiguration.groovy similarity index 98% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestVerbConfiguration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestVerbConfiguration.groovy index ec76e5f..a833702 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/model/RestVerbConfiguration.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/groovy/org/apache/camel/dsl/groovy/common/model/RestVerbConfiguration.groovy @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy.model +package org.apache.camel.dsl.groovy.common.model import org.apache.camel.builder.RouteBuilder import org.apache.camel.model.rest.RestDefinition diff --git a/dsl/camel-groovy-dsl/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule similarity index 78% rename from dsl/camel-groovy-dsl/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule index 1202b5b..f55cd66 100644 --- a/dsl/camel-groovy-dsl/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule @@ -18,6 +18,6 @@ moduleName=camel-k-loader-groovy moduleVersion=1.0.0 extensionClasses=\ - org.apache.camel.dsl.groovy.extensions.ExpressionClauseExtensions,\ - org.apache.camel.dsl.groovy.extensions.ProcessorDefinitionExtensions,\ - org.apache.camel.dsl.groovy.extensions.CamelContextExtensions + org.apache.camel.dsl.groovy.common.extensions.ExpressionClauseExtensions,\ + org.apache.camel.dsl.groovy.common.extensions.ProcessorDefinitionExtensions,\ + org.apache.camel.dsl.groovy.common.extensions.CamelContextExtensions diff --git a/dsl/camel-groovy-dsl/src/main/resources/integration.gdsl b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/integration.gdsl similarity index 91% rename from dsl/camel-groovy-dsl/src/main/resources/integration.gdsl rename to dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/integration.gdsl index 05aff0e..408cf3d 100644 --- a/dsl/camel-groovy-dsl/src/main/resources/integration.gdsl +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-common/src/main/resources/integration.gdsl @@ -17,5 +17,5 @@ def ctx = context(scope: scriptScope()) contributor(ctx) { - delegatesTo(findClass('org.apache.camel.dsl.groovy.GroovyDSL')) + delegatesTo(findClass('org.apache.camel.dsl.groovy.common.GroovyDSL')) } \ No newline at end of file diff --git a/dsl/camel-groovy-dsl/pom.xml b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/pom.xml similarity index 82% copy from dsl/camel-groovy-dsl/pom.xml copy to dsl/camel-groovy-dsl/camel-groovy-dsl-test/pom.xml index dd73859..2e0d129 100644 --- a/dsl/camel-groovy-dsl/pom.xml +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/pom.xml @@ -24,19 +24,18 @@ <parent> <groupId>org.apache.camel</groupId> - <artifactId>dsl</artifactId> + <artifactId>camel-groovy-dsl-parent</artifactId> <version>3.10.0-SNAPSHOT</version> </parent> - <artifactId>camel-groovy-dsl</artifactId> + <artifactId>camel-groovy-dsl-test</artifactId> <packaging>jar</packaging> - <name>Camel :: Groovy DSL</name> - <description>Camel DSL with Groovy</description> + <name>Camel :: Groovy DSL :: Test</name> + <description>Camel DSL with Groovy (Test)</description> <properties> - <firstVersion>3.9.0</firstVersion> <sourcecheckExcludes> - **/resources/**/My*.java + **/resources/**/*.groovy </sourcecheckExcludes> <sourcecheckExcludesComma> ${sourcecheckExcludes}, @@ -46,24 +45,11 @@ <dependencies> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-support</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-model</artifactId> + <artifactId>camel-groovy-dsl</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-endpointdsl</artifactId> - </dependency> - - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.camel</groupId> <artifactId>camel-main</artifactId> <scope>test</scope> </dependency> @@ -182,18 +168,6 @@ <invokeDynamic>true</invokeDynamic> </configuration> </plugin> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-package-maven-plugin</artifactId> - <executions> - <execution> - <id>generate-spi</id> - <goals> - <goal>generate-spi</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> </build> diff --git a/dsl/camel-groovy-dsl/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/GroovyRouteBuilderLoaderTest.groovy diff --git a/dsl/camel-groovy-dsl/src/test/groovy/org/apache/camel/dsl/groovy/support/MyBean.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/support/MyBean.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/groovy/org/apache/camel/dsl/groovy/support/MyBean.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/groovy/org/apache/camel/dsl/groovy/support/MyBean.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/log4j2-test.properties b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/log4j2-test.properties similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/log4j2-test.properties rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/log4j2-test.properties diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/issues/github-529.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/issues/github-529.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/issues/github-529.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/issues/github-529.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-beans.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-beans.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-beans.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-beans.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-component-wrong-method-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-component-wrong-method-configuration.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-component-wrong-method-configuration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-component-wrong-method-configuration.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-component-wrong-property-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-component-wrong-property-configuration.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-component-wrong-property-configuration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-component-wrong-property-configuration.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-components-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-components-configuration.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-components-configuration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-components-configuration.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-dataformats-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-dataformats-configuration.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-dataformats-configuration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-dataformats-configuration.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-eip.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-eip.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-eip.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-eip.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-endpoint-dsl.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-endpoint-dsl.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-endpoint-dsl.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-endpoint-dsl.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-error-handler.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-error-handler.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-error-handler.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-error-handler.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-languages-configuration.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-languages-configuration.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-languages-configuration.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-rest.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-rest.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes-with-rest.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes-with-rest.groovy diff --git a/dsl/camel-groovy-dsl/src/test/resources/routes/routes.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes.groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/test/resources/routes/routes.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl-test/src/test/resources/routes/routes.groovy diff --git a/dsl/camel-groovy-dsl/camel-groovy-dsl/pom.xml b/dsl/camel-groovy-dsl/camel-groovy-dsl/pom.xml new file mode 100644 index 0000000..fba542c --- /dev/null +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl/pom.xml @@ -0,0 +1,78 @@ +<?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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.camel</groupId> + <artifactId>camel-groovy-dsl-parent</artifactId> + <version>3.10.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-groovy-dsl</artifactId> + <packaging>jar</packaging> + <name>Camel :: Groovy DSL</name> + <description>Camel DSL with Groovy</description> + + <properties> + <firstVersion>3.9.0</firstVersion> + <sourcecheckExcludes> + **/resources/**/My*.java + </sourcecheckExcludes> + <sourcecheckExcludesComma> + ${sourcecheckExcludes}, + </sourcecheckExcludesComma> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-model</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-groovy-dsl-common</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-spi</id> + <goals> + <goal>generate-spi</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/dsl/camel-groovy-dsl/src/generated/resources/META-INF/services/org/apache/camel/routes-loader/groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/generated/resources/META-INF/services/org/apache/camel/routes-loader/groovy similarity index 100% rename from dsl/camel-groovy-dsl/src/generated/resources/META-INF/services/org/apache/camel/routes-loader/groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl/src/generated/resources/META-INF/services/org/apache/camel/routes-loader/groovy diff --git a/dsl/camel-groovy-dsl/src/main/docs/groovy-dsl.adoc b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/docs/groovy-dsl.adoc similarity index 100% rename from dsl/camel-groovy-dsl/src/main/docs/groovy-dsl.adoc rename to dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/docs/groovy-dsl.adoc diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.groovy b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.java similarity index 57% rename from dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.groovy rename to dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.java index 2ad2a05..470d928 100644 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.groovy +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderLoader.java @@ -14,54 +14,54 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.groovy +package org.apache.camel.dsl.groovy; -import org.apache.camel.Experimental -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.api.management.ManagedResource -import org.apache.camel.builder.endpoint.EndpointRouteBuilder -import org.apache.camel.spi.Resource -import org.apache.camel.spi.StartupStepRecorder -import org.apache.camel.spi.annotations.RoutesLoader -import org.apache.camel.support.RoutesBuilderLoaderSupport +import org.apache.camel.Experimental; +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.api.management.ManagedResource; +import org.apache.camel.builder.endpoint.EndpointRouteBuilder; +import org.apache.camel.spi.Resource; +import org.apache.camel.spi.StartupStepRecorder; +import org.apache.camel.spi.annotations.RoutesLoader; +import org.apache.camel.support.RoutesBuilderLoaderSupport; @Experimental @ManagedResource(description = "Managed GroovyRoutesBuilderLoader") -@RoutesLoader(EXTENSION) -class GroovyRoutesBuilderLoader extends RoutesBuilderLoaderSupport { - public static final String EXTENSION = "groovy" +@RoutesLoader(GroovyRoutesBuilderLoader.EXTENSION) +public class GroovyRoutesBuilderLoader extends RoutesBuilderLoaderSupport { + public static final String EXTENSION = "groovy"; - private StartupStepRecorder recorder + private StartupStepRecorder recorder; @Override protected void doBuild() throws Exception { - super.doBuild() + super.doBuild(); if (getCamelContext() != null) { - this.recorder = getCamelContext().adapt(ExtendedCamelContext.class).getStartupStepRecorder() + this.recorder = getCamelContext().adapt(ExtendedCamelContext.class).getStartupStepRecorder(); } } @ManagedAttribute(description = "Supported file extension") @Override - String getSupportedExtension() { - return EXTENSION + public String getSupportedExtension() { + return EXTENSION; } @Override - RoutesBuilder loadRoutesBuilder(Resource resource) throws Exception { + public RoutesBuilder loadRoutesBuilder(Resource resource) throws Exception { StartupStep step = recorder != null ? recorder.beginStep(GroovyRoutesBuilderLoader.class, resource.getLocation(), "Compiling RouteBuilder") - : null + : null; try { - return EndpointRouteBuilder.loadEndpointRoutesBuilder(resource, GroovyRoutesBuilderSupport::load) + return EndpointRouteBuilder.loadEndpointRoutesBuilder(resource, GroovyRoutesBuilderSupport::load); } finally { if (recorder != null) { - recorder.endStep(step) + recorder.endStep(step); } } } diff --git a/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.java b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.java new file mode 100644 index 0000000..a28ed79 --- /dev/null +++ b/dsl/camel-groovy-dsl/camel-groovy-dsl/src/main/java/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.java @@ -0,0 +1,53 @@ +/* + * 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.dsl.groovy; + +import java.io.Reader; + +import groovy.lang.Binding; +import groovy.lang.GroovyShell; +import groovy.util.DelegatingScript; +import org.apache.camel.builder.endpoint.EndpointRouteBuilder; +import org.apache.camel.dsl.groovy.common.GroovyDSL; +import org.codehaus.groovy.control.CompilerConfiguration; +import org.codehaus.groovy.control.customizers.ImportCustomizer; + +public final class GroovyRoutesBuilderSupport { + private GroovyRoutesBuilderSupport() { + } + + static 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(); + } +} diff --git a/dsl/camel-groovy-dsl/pom.xml b/dsl/camel-groovy-dsl/pom.xml index dd73859..e0dc529 100644 --- a/dsl/camel-groovy-dsl/pom.xml +++ b/dsl/camel-groovy-dsl/pom.xml @@ -28,173 +28,15 @@ <version>3.10.0-SNAPSHOT</version> </parent> - <artifactId>camel-groovy-dsl</artifactId> - <packaging>jar</packaging> - <name>Camel :: Groovy DSL</name> - <description>Camel DSL with Groovy</description> - - <properties> - <firstVersion>3.9.0</firstVersion> - <sourcecheckExcludes> - **/resources/**/My*.java - </sourcecheckExcludes> - <sourcecheckExcludesComma> - ${sourcecheckExcludes}, - </sourcecheckExcludesComma> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-support</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-model</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-endpointdsl</artifactId> - </dependency> - - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-main</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-direct</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-rest</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-mock</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-languages</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-log</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-telegram</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-seda</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-jackson</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-timer</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.spockframework</groupId> - <artifactId>spock-core</artifactId> - <version>${spock-version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.codehaus.groovy</groupId> - <artifactId>*</artifactId> - </exclusion> - <exclusion> - <groupId>junit</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-jcl</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <version>${gmavenplus-plugin-version}</version> - <executions> - <execution> - <goals> - <goal>addSources</goal> - <goal>addTestSources</goal> - <goal>compile</goal> - <goal>compileTests</goal> - </goals> - </execution> - </executions> - <configuration> - <invokeDynamic>true</invokeDynamic> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-package-maven-plugin</artifactId> - <executions> - <execution> - <id>generate-spi</id> - <goals> - <goal>generate-spi</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <artifactId>camel-groovy-dsl-parent</artifactId> + <packaging>pom</packaging> + <name>Camel :: Groovy DSL :: Parent</name> + <description>Camel DSL with Groovy (Parent)</description> + + <modules> + <module>camel-groovy-dsl-common</module> + <module>camel-groovy-dsl</module> + <module>camel-groovy-dsl-test</module> + </modules> </project> \ No newline at end of file diff --git a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.groovy b/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.groovy deleted file mode 100644 index b4e8a4a..0000000 --- a/dsl/camel-groovy-dsl/src/main/groovy/org/apache/camel/dsl/groovy/GroovyRoutesBuilderSupport.groovy +++ /dev/null @@ -1,44 +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.dsl.groovy - -import org.apache.camel.builder.endpoint.EndpointRouteBuilder -import org.codehaus.groovy.control.CompilerConfiguration -import org.codehaus.groovy.control.customizers.ImportCustomizer - -class GroovyRoutesBuilderSupport { - private GroovyRoutesBuilderSupport() { - } - - static void load(Reader reader, EndpointRouteBuilder builder) { - def ic = new ImportCustomizer() - ic.addStarImports('org.apache.camel') - ic.addStarImports('org.apache.camel.spi') - - def cc = new CompilerConfiguration() - cc.addCompilationCustomizers(ic) - cc.setScriptBaseClass(DelegatingScript.class.getName()) - - def cl = builder.context.applicationContextClassLoader ?: Thread.currentThread().getContextClassLoader() - def sh = new GroovyShell(cl, new Binding(), cc) - def script = (DelegatingScript) sh.parse(reader) - - // set the delegate target - script.setDelegate(new GroovyDSL(builder)) - script.run() - } -} diff --git a/parent/pom.xml b/parent/pom.xml index 6ffa3dc..0373a3f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -2726,6 +2726,11 @@ <artifactId>camel-groovy-dsl</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-groovy-dsl-common</artifactId> + <version>${project.version}</version> + </dependency> <!-- camel catalog --> <dependency>