Skip to content

Commit

Permalink
Added an AWS2-CW native extension
Browse files Browse the repository at this point in the history
  • Loading branch information
oscerd authored and lburgazzoli committed Apr 23, 2020
1 parent 2b545a0 commit d2d52b8
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 220 deletions.
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Level | Since | Description
Preview | 1.0.0-M6 | Working with Apache Avro for data serialization.

| link:https://camel.apache.org/components/latest/aws2-cw-component.html[AWS 2 CloudWatch] (camel-quarkus-aws2-cw) +
`aws2-cw:namespace` | JVM +
Preview | 1.0.0-M6 | The aws2-cw component is used for sending metrics to an Amazon CloudWatch.
`aws2-cw:namespace` | Native +
Stable | 1.0.0-M6 | The aws2-cw component is used for sending metrics to an Amazon CloudWatch.

| link:https://camel.apache.org/components/latest/aws2-ddb-component.html[AWS 2 DynamoDB] (camel-quarkus-aws2-ddb) +
`aws2-ddb:tableName` | JVM +
Expand Down

This file was deleted.

80 changes: 0 additions & 80 deletions extensions-jvm/aws2-cw/integration-test/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat -->
<module>avro</module>
<module>avro-rpc</module>
<module>aws2-cw</module>
<module>aws2-ddb</module>
<module>aws2-ec2</module>
<module>aws2-ecs</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-cw</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>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-aws2-deployment</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.cw.deployment;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.jboss.jandex.DotName;
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;

class Aws2CwProcessor {

private static final String FEATURE = "camel-aws2-cw";

public static final String AWS_SDK_APPLICATION_ARCHIVE_MARKERS = "software/amazon/awssdk";

private static final List<String> INTERCEPTOR_PATHS = Arrays.asList(
"software/amazon/awssdk/global/handlers/execution.interceptors");

private static final DotName EXECUTION_INTERCEPTOR_NAME = DotName.createSimple(ExecutionInterceptor.class.getName());

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep(applicationArchiveMarkers = { AWS_SDK_APPLICATION_ARCHIVE_MARKERS })
void process(CombinedIndexBuildItem combinedIndexBuildItem,
BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
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()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
<module>integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws2-cw</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-aws2</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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
name: "AWS 2 CloudWatch"
description: "The aws2-cw component is used for sending metrics to an Amazon CloudWatch."
metadata:
unlisted: true
keywords:
- "camel"
- "aws"
- "cloud"
- "monitoring"
guide: "https://camel.apache.org/components/latest/aws2-cw-component.html"
guide: "https://quarkus.io/guides/camel"
categories:
- "integration"
status: "preview"
1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<module>aws-sqs</module>
<module>aws-swf</module>
<module>aws-translate</module>
<module>aws2-cw</module>
<module>aws2-s3</module>
<module>aws2-sns</module>
<module>aws2-sqs</module>
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/aws2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-cw</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-s3</artifactId>
Expand Down

0 comments on commit d2d52b8

Please sign in to comment.