This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch CAMEL-20088 in repository https://gitbox.apache.org/repos/asf/camel.git
commit c0685eacd670f7364e5b0f3e764c4d9e9b795fd8 Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Nov 7 10:16:04 2023 +0100 CAMEL-20088 - Camel-Azure-Schema-Registry component: Moving the bits from camel-kamelets and have a non-classic component Signed-off-by: Andrea Cosentino <[email protected]> --- bom/camel-bom/pom.xml | 5 ++ catalog/camel-allcomponents/pom.xml | 5 ++ .../org/apache/camel/catalog/others.properties | 1 + .../catalog/others/azure-schema-registry.json | 15 +++++ .../camel-azure-schema-registry/pom.xml | 69 ++++++++++++++++++++++ .../services/org/apache/camel/other.properties | 7 +++ .../generated/resources/azure-schema-registry.json | 15 +++++ .../src/main/docs/azure-schema-registry.adoc | 13 ++++ .../registry/DefaultAzureCredentialWrapper.java | 37 ++++++++++++ parent/pom.xml | 5 ++ .../apache/camel/maven/packaging/MojoHelper.java | 2 +- 11 files changed, 173 insertions(+), 1 deletion(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index e65e00e3922..c798145f795 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -266,6 +266,11 @@ <artifactId>camel-azure-key-vault</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-schema-registry</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-azure-servicebus</artifactId> diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index 649c378f157..1b215392db4 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -262,6 +262,11 @@ <artifactId>camel-azure-key-vault</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-schema-registry</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-azure-servicebus</artifactId> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties index 19f74621977..17cedb8b02b 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties @@ -1,5 +1,6 @@ attachments aws-xray +azure-schema-registry cli-connector cloud cloudevents diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/azure-schema-registry.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/azure-schema-registry.json new file mode 100644 index 00000000000..3bb8af12d5b --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/azure-schema-registry.json @@ -0,0 +1,15 @@ +{ + "other": { + "kind": "other", + "name": "azure-schema-registry", + "title": "Azure Schema Registry", + "description": "Azure Schema Registry Component for utilities to deal with authentication", + "deprecated": false, + "firstVersion": "4.2.0", + "label": "core", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-azure-schema-registry", + "version": "4.2.0-SNAPSHOT" + } +} diff --git a/components/camel-azure/camel-azure-schema-registry/pom.xml b/components/camel-azure/camel-azure-schema-registry/pom.xml new file mode 100644 index 00000000000..7a1c60eea15 --- /dev/null +++ b/components/camel-azure/camel-azure-schema-registry/pom.xml @@ -0,0 +1,69 @@ +<?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-azure-parent</artifactId> + <version>4.2.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-azure-schema-registry</artifactId> + <packaging>jar</packaging> + <name>Camel :: Azure :: Schema Registry</name> + <description>Azure Schema Registry Component for utilities to deal with authentication</description> + + <properties> + <firstVersion>4.2.0</firstVersion> + <label>core</label> + </properties> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + + <dependency> + <groupId>com.azure</groupId> + <artifactId>azure-identity</artifactId> + </dependency> + + <!-- testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-mock</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + +</project> diff --git a/components/camel-azure/camel-azure-schema-registry/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-azure/camel-azure-schema-registry/src/generated/resources/META-INF/services/org/apache/camel/other.properties new file mode 100644 index 00000000000..c7e6b314bed --- /dev/null +++ b/components/camel-azure/camel-azure-schema-registry/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +name=azure-schema-registry +groupId=org.apache.camel +artifactId=camel-azure-schema-registry +version=4.2.0-SNAPSHOT +projectName=Camel :: Azure :: Schema Registry +projectDescription=Azure Schema Registry Component for utilities to deal with authentication diff --git a/components/camel-azure/camel-azure-schema-registry/src/generated/resources/azure-schema-registry.json b/components/camel-azure/camel-azure-schema-registry/src/generated/resources/azure-schema-registry.json new file mode 100644 index 00000000000..3bb8af12d5b --- /dev/null +++ b/components/camel-azure/camel-azure-schema-registry/src/generated/resources/azure-schema-registry.json @@ -0,0 +1,15 @@ +{ + "other": { + "kind": "other", + "name": "azure-schema-registry", + "title": "Azure Schema Registry", + "description": "Azure Schema Registry Component for utilities to deal with authentication", + "deprecated": false, + "firstVersion": "4.2.0", + "label": "core", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-azure-schema-registry", + "version": "4.2.0-SNAPSHOT" + } +} diff --git a/components/camel-azure/camel-azure-schema-registry/src/main/docs/azure-schema-registry.adoc b/components/camel-azure/camel-azure-schema-registry/src/main/docs/azure-schema-registry.adoc new file mode 100644 index 00000000000..46cd466e123 --- /dev/null +++ b/components/camel-azure/camel-azure-schema-registry/src/main/docs/azure-schema-registry.adoc @@ -0,0 +1,13 @@ += Azure Schema Registry Component +:doctitle: Azure Schema Registry +:shortname: azure-schema-registry +:artifactid: camel-azure-schema-registry +:description: Azure Schema Registry Component for utilities to deal with authentication +:since: 4.2 +:supportlevel: Preview +:tabs-sync-option: + +*Since Camel {since}* + +The camel-azure-schema-registry component contains some useful classes to deal with authentication against +the Azure Schema Registry diff --git a/components/camel-azure/camel-azure-schema-registry/src/main/java/org/apache/camel/component/azure/schema/registry/DefaultAzureCredentialWrapper.java b/components/camel-azure/camel-azure-schema-registry/src/main/java/org/apache/camel/component/azure/schema/registry/DefaultAzureCredentialWrapper.java new file mode 100644 index 00000000000..9e31d636d5a --- /dev/null +++ b/components/camel-azure/camel-azure-schema-registry/src/main/java/org/apache/camel/component/azure/schema/registry/DefaultAzureCredentialWrapper.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.azure.schema.registry; + +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.TokenCredential; +import com.azure.core.credential.TokenRequestContext; +import com.azure.identity.DefaultAzureCredentialBuilder; +import reactor.core.publisher.Mono; + +public class DefaultAzureCredentialWrapper implements TokenCredential { + + private final TokenCredential credential; + + public DefaultAzureCredentialWrapper() { + this.credential = new DefaultAzureCredentialBuilder().build(); + } + + @Override + public Mono<AccessToken> getToken(TokenRequestContext tokenRequestContext) { + return this.credential.getToken(tokenRequestContext); + } +} diff --git a/parent/pom.xml b/parent/pom.xml index 6e917aa9847..18aa39fcf50 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -858,6 +858,11 @@ <artifactId>camel-azure-key-vault</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-azure-schema-registry</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-azure-servicebus</artifactId> diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java index f27957470c5..ce72d1ef407 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java @@ -55,7 +55,7 @@ public final class MojoHelper { return Arrays.asList(dir.resolve("camel-azure-eventhubs"), dir.resolve("camel-azure-storage-blob"), dir.resolve("camel-azure-storage-datalake"), dir.resolve("camel-azure-cosmosdb"), dir.resolve("camel-azure-storage-queue"), dir.resolve("camel-azure-servicebus"), - dir.resolve("camel-azure-key-vault"), dir.resolve("camel-azure-files")); + dir.resolve("camel-azure-key-vault"), dir.resolve("camel-azure-files"), dir.resolve("camel-azure-schema-registry")); case "camel-google": return Arrays.asList(dir.resolve("camel-google-bigquery"), dir.resolve("camel-google-calendar"), dir.resolve("camel-google-drive"), dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"),
