This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch aws2-s3 in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit fbb70123c2203dc49f054cbf063b971d188c7f6c Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Apr 14 15:51:44 2020 +0200 Added an AWS2-S3 native extension --- .../pages/list-of-camel-quarkus-extensions.adoc | 6 +- extensions/aws2-s3/deployment/pom.xml | 83 +++++++++++++++ .../aws2/s3/deployment/Aws2S3Processor.java | 111 +++++++++++++++++++++ extensions/aws2-s3/pom.xml | 39 ++++++++ extensions/aws2-s3/runtime/pom.xml | 91 +++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 28 ++++++ extensions/pom.xml | 1 + integration-tests/aws2/pom.xml | 4 + .../component/{aws => aws2}/CamelRoute.java | 10 +- .../aws2/src/main/resources/application.properties | 10 +- poms/bom-deployment/pom.xml | 5 + poms/bom/pom.xml | 16 +++ 12 files changed, 398 insertions(+), 6 deletions(-) diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc index 5618de2..5f801af 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list: == Camel Components // components: START -Number of Camel components: 147 in 112 JAR artifacts (0 deprecated) +Number of Camel components: 148 in 113 JAR artifacts (0 deprecated) [width="100%",cols="4,1,1,5",options="header"] |=== @@ -157,6 +157,10 @@ Level | Since | Description `aws-translate:label` | Native + Stable | 1.0.0-M3 | The aws-translate component is used for managing Amazon Translate +| link:https://camel.apache.org/components/latest/aws2-s3-component.html[AWS2 S3 Storage Service] (camel-quarkus-aws2-s3) + +`aws2-s3://bucketNameOrArn` | Native + + Stable | 1.0.0-M7 | The aws2-s3 component is used for storing and retrieving object from Amazon S3 Storage Service. + | link:https://camel.apache.org/components/latest/azure-blob-component.html[Azure Storage Blob Service] (camel-quarkus-azure) + `azure-blob:containerOrBlobUri` | Native + Stable | 1.0.0-M4 | The azure-blob component is used for storing and retrieving blobs from Azure Storage Blob Service. diff --git a/extensions/aws2-s3/deployment/pom.xml b/extensions/aws2-s3/deployment/pom.xml new file mode 100644 index 0000000..a5f70d8 --- /dev/null +++ b/extensions/aws2-s3/deployment/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-s3-deployment</artifactId> + <name>Camel Quarkus :: AWS2 S3 Storage Service :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-xml-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-commons-logging-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/extensions/aws2-s3/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/s3/deployment/Aws2S3Processor.java b/extensions/aws2-s3/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/s3/deployment/Aws2S3Processor.java new file mode 100644 index 0000000..9081951 --- /dev/null +++ b/extensions/aws2-s3/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/s3/deployment/Aws2S3Processor.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.aws2.s3.deployment; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import javax.enterprise.inject.spi.DeploymentException; + +import io.quarkus.arc.deployment.AdditionalBeanBuildItem; +import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem; +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; +import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; +import org.jboss.jandex.DotName; +import software.amazon.awssdk.core.interceptor.ExecutionInterceptor; +import software.amazon.awssdk.http.SdkHttpService; + +class Aws2S3Processor { + + private static final String FEATURE = "camel-aws2-s3"; + + public static final String AWS_SDK_APPLICATION_ARCHIVE_MARKERS = "software/amazon/awssdk"; + + private static final String APACHE_HTTP_SERVICE = "software.amazon.awssdk.http.apache.ApacheSdkHttpService"; + + private static final List<String> INTERCEPTOR_PATHS = Arrays.asList( + "software/amazon/awssdk/global/handlers/execution.interceptors", + "software/amazon/awssdk/services/s3/execution.interceptors"); + + private static final DotName EXECUTION_INTERCEPTOR_NAME = DotName.createSimple(ExecutionInterceptor.class.getName()); + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + @BuildStep + ExtensionSslNativeSupportBuildItem activateSslNativeSupport() { + return new ExtensionSslNativeSupportBuildItem(FEATURE); + } + + @BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS }) + void process(CombinedIndexBuildItem combinedIndexBuildItem, + BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport, + BuildProducer<ReflectiveClassBuildItem> reflectiveClasses, + BuildProducer<FeatureBuildItem> feature, + BuildProducer<AdditionalBeanBuildItem> additionalBeans, + BuildProducer<NativeImageResourceBuildItem> resource) { + + INTERCEPTOR_PATHS.forEach(path -> resource.produce(new NativeImageResourceBuildItem(path))); + + List<String> knownInterceptorImpls = combinedIndexBuildItem.getIndex() + .getAllKnownImplementors(EXECUTION_INTERCEPTOR_NAME) + .stream() + .map(c -> c.name().toString()).collect(Collectors.toList()); + + reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, + knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()]))); + + reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, + String.class.getCanonicalName())); + } + + @BuildStep(loadsApplicationClasses = true) + void client(BeanRegistrationPhaseBuildItem beanRegistrationPhase, + BuildProducer<ServiceProviderBuildItem> serviceProvider, + BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinition) { + checkClasspath(APACHE_HTTP_SERVICE, "apache-client"); + + //Register Apache client as sync client + proxyDefinition.produce( + new NativeImageProxyDefinitionBuildItem("org.apache.http.conn.HttpClientConnectionManager", + "org.apache.http.pool.ConnPoolControl", + "software.amazon.awssdk.http.apache.internal.conn.Wrapped")); + + serviceProvider.produce(new ServiceProviderBuildItem(SdkHttpService.class.getName(), APACHE_HTTP_SERVICE)); + + } + + private void checkClasspath(String className, String dependencyName) { + try { + Class.forName(className, true, Thread.currentThread().getContextClassLoader()); + } catch (ClassNotFoundException e) { + throw new DeploymentException( + "Missing 'software.amazon.awssdk:" + dependencyName + "' dependency on the classpath"); + } + } + +} diff --git a/extensions/aws2-s3/pom.xml b/extensions/aws2-s3/pom.xml new file mode 100644 index 0000000..e9c58d9 --- /dev/null +++ b/extensions/aws2-s3/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-s3-parent</artifactId> + <name>Camel Quarkus :: AWS2 S3 Storage Service</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions/aws2-s3/runtime/pom.xml b/extensions/aws2-s3/runtime/pom.xml new file mode 100644 index 0000000..e891247 --- /dev/null +++ b/extensions/aws2-s3/runtime/pom.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-s3</artifactId> + <name>Camel Quarkus :: AWS2 S3 Storage Service :: Runtime</name> + <description>The aws2-s3 component is used for storing and retrieving object from Amazon S3 Storage Service.</description> + + <properties> + <firstVersion>1.0.0-M7</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws2-s3</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-xml</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-commons-logging</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions/aws2-s3/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/aws2-s3/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..e8a9058 --- /dev/null +++ b/extensions/aws2-s3/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,28 @@ +# +# 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. +# + +--- +name: "AWS2 S3 Storage Service" +description: "The aws2-s3 component is used for storing and retrieving object from Amazon S3 Storage Service." +metadata: + keywords: + - "camel" + - "aws" + - "cloud" + guide: "https://quarkus.io/guides/camel" + categories: + - "integration" diff --git a/extensions/pom.xml b/extensions/pom.xml index 163f32d..2554d57 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -51,6 +51,7 @@ <module>aws-sqs</module> <module>aws-swf</module> <module>aws-translate</module> + <module>aws2-s3</module> <module>aws2-sqs</module> <module>azure</module> <module>base64</module> diff --git a/integration-tests/aws2/pom.xml b/integration-tests/aws2/pom.xml index 1ac1e06..45e17c7 100644 --- a/integration-tests/aws2/pom.xml +++ b/integration-tests/aws2/pom.xml @@ -54,6 +54,10 @@ <dependencies> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-sqs</artifactId> </dependency> <dependency> diff --git a/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java b/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java similarity index 78% rename from integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java rename to integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java index 04c1541..d3637f4 100644 --- a/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java +++ b/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java @@ -14,12 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.aws; +package org.apache.camel.quarkus.component.aws2; -import io.quarkus.runtime.annotations.RegisterForReflection; import org.apache.camel.builder.RouteBuilder; -@RegisterForReflection public class CamelRoute extends RouteBuilder { @Override @@ -29,6 +27,12 @@ public class CamelRoute extends RouteBuilder { .setBody(constant("Quarkus is great!")) .to("aws2-sqs://camel-1?delaySeconds=5") .to("log:sf?showAll=true"); + + from("timer:quarkus-s3?repeatCount=1") + .setHeader("CamelAwsS3Key", constant("testquarkus")) + .setBody(constant("Quarkus is great!")) + .to("aws2-s3://camel-kafka-connector") + .to("log:sf?showAll=true"); } } diff --git a/integration-tests/aws2/src/main/resources/application.properties b/integration-tests/aws2/src/main/resources/application.properties index 3a45551..ca852d1 100644 --- a/integration-tests/aws2/src/main/resources/application.properties +++ b/integration-tests/aws2/src/main/resources/application.properties @@ -17,7 +17,6 @@ # # Quarkus # -quarkus.ssl.native=true quarkus.log.file.enable = false # @@ -30,4 +29,11 @@ camel.context.name = quarkus-camel-example # camel.component.aws2-sqs.access-key={{env:AWS_ACCESS_KEY}} camel.component.aws2-sqs.secret-key={{env:AWS_SECRET_KEY}} -camel.component.aws2-sqs.region={{env:AWS_REGION}} \ No newline at end of file +camel.component.aws2-sqs.region={{env:AWS_REGION}} + +# +# Camel :: AWS S3 +# +camel.component.aws2-s3.access-key={{env:AWS_ACCESS_KEY}} +camel.component.aws2-s3.secret-key={{env:AWS_SECRET_KEY}} +camel.component.aws2-s3.region={{env:AWS_REGION}} \ No newline at end of file diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index d44ea13..4d554d6 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -214,6 +214,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-ses-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index c61e047..53bf362 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -249,6 +249,17 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-aws2-s3</artifactId> + <version>${camel.version}</version> + <exclusions> + <exclusion> + <groupId>software.amazon.awssdk</groupId> + <artifactId>netty-nio-client</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-aws2-ses</artifactId> <version>${camel.version}</version> </dependency> @@ -1195,6 +1206,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-s3</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-ses</artifactId> <version>${camel-quarkus.version}</version> </dependency>