This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch 23153 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 036a71dda1ac1d444a4c019818fec41986122dcb Author: Andrea Cosentino <[email protected]> AuthorDate: Mon Mar 9 09:54:59 2026 +0100 CAMEL-23153 - Camel-Google: Add Google Cloud Vision AI component Signed-off-by: Andrea Cosentino <[email protected]> --- bom/camel-bom/pom.xml | 5 + catalog/camel-allcomponents/pom.xml | 5 + .../org/apache/camel/catalog/components.properties | 1 + .../camel/catalog/components/google-vision.json | 43 +++ .../jbang/camel-jbang-configuration-metadata.json | 4 +- .../camel-google/camel-google-vision/pom.xml | 61 ++++ .../GoogleCloudVisionComponentConfigurer.java | 57 ++++ .../GoogleCloudVisionEndpointConfigurer.java | 83 +++++ .../GoogleCloudVisionEndpointUriFactory.java | 76 +++++ .../component/google/vision/google-vision.json | 43 +++ .../services/org/apache/camel/component.properties | 7 + .../org/apache/camel/component/google-vision | 2 + .../camel/configurer/google-vision-component | 2 + .../apache/camel/configurer/google-vision-endpoint | 2 + .../apache/camel/urifactory/google-vision-endpoint | 2 + .../src/main/docs/google-vision-component.adoc | 264 ++++++++++++++++ .../vision/GoogleCloudVisionClientFactory.java | 47 +++ .../google/vision/GoogleCloudVisionComponent.java | 57 ++++ .../vision/GoogleCloudVisionConfiguration.java | 126 ++++++++ .../google/vision/GoogleCloudVisionConstants.java | 28 ++ .../google/vision/GoogleCloudVisionEndpoint.java | 109 +++++++ .../google/vision/GoogleCloudVisionOperations.java | 32 ++ .../google/vision/GoogleCloudVisionProducer.java | 193 ++++++++++++ .../unit/GoogleCloudVisionComponentTest.java | 50 +++ .../unit/GoogleCloudVisionConfigurationTest.java | 67 ++++ components/camel-google/pom.xml | 1 + .../org/apache/camel/main/components.properties | 1 + .../modules/ROOT/examples/json/google-vision.json | 1 + docs/components/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/google-vision-component.adoc | 1 + .../component/ComponentsBuilderFactory.java | 13 + .../dsl/GoogleVisionComponentBuilderFactory.java | 120 +++++++ .../builder/endpoint/EndpointBuilderFactory.java | 1 + .../camel/builder/endpoint/EndpointBuilders.java | 1 + .../builder/endpoint/StaticEndpointBuilders.java | 40 +++ .../GoogleCloudVisionEndpointBuilderFactory.java | 347 +++++++++++++++++++++ .../camel-component-known-dependencies.properties | 1 + parent/pom.xml | 6 + .../apache/camel/maven/packaging/MojoHelper.java | 3 +- 39 files changed, 1901 insertions(+), 2 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index bc4951b1c51f..e9d137156544 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -977,6 +977,11 @@ <artifactId>camel-google-vertexai</artifactId> <version>4.19.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-vision</artifactId> + <version>4.19.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-grape</artifactId> diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index a2f051c9c62f..97359d22feca 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -847,6 +847,11 @@ <artifactId>camel-google-vertexai</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-vision</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-grape</artifactId> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties index 3941fb9b3055..ec3a84d7b477 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties @@ -139,6 +139,7 @@ google-sheets google-sheets-stream google-storage google-vertexai +google-vision grape graphql grpc diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-vision.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-vision.json new file mode 100644 index 000000000000..874952595ccf --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-vision.json @@ -0,0 +1,43 @@ +{ + "component": { + "kind": "component", + "name": "google-vision", + "title": "Google Cloud Vision", + "description": "Analyze images using Google Cloud Vision AI", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "cloud,ai", + "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-google-vision", + "version": "4.19.0-SNAPSHOT", + "scheme": "google-vision", + "extendsScheme": "", + "syntax": "google-vision:operation", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] + "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + }, + "headers": { + "GoogleCloudVisionOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionOperations", "enum": [ "labelDetection", "textDetection", "faceDetection", "landmarkDetection", "logoDetection", "safeSearchDetection", "imagePropertiesDetection", "webDetection", "objectLocalization", "cropHintsDetection", "documentTextDetection" ], "deprecated": false, "deprecatio [...] + "GoogleCloudVisionResponseObject": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "com.google.cloud.vision.v1.AnnotateImageResponse", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The response object resulting from the Google Cloud Vision API invocation", "constantName": "org.apache.camel.component.google.vision.GoogleCloudVisionConstants#RESPONSE_OBJECT" } + }, + "properties": { + "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The operation name" }, + "serviceAccountKey": { "index": 1, "kind": "parameter", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "Service account key to authenticate an application as a service account" }, + "maxResults": { "index": 2, "kind": "parameter", "displayName": "Max Results", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The max number of results to return per feature type. Default is unset (API default)." }, + "operationType": { "index": 3, "kind": "parameter", "displayName": "Operation Type", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionOperations", "enum": [ "labelDetection", "textDetection", "faceDetection", "landmarkDetection", "logoDetection", "safeSearchDetection", "imagePropertiesDetection", "webDetection", "objectLocalization", "cropHintsDetection", "documentTextDetection" ], "dep [...] + "pojoRequest": { "index": 4, "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "Specifies if the request is a pojo request" }, + "lazyStartProducer": { "index": 5, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] + "client": { "index": 6, "kind": "parameter", "displayName": "Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.google.cloud.vision.v1.ImageAnnotatorClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The client to use during service invocation." } + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json index 7249ffadeb29..22ca438bb84d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/jbang/camel-jbang-configuration-metadata.json @@ -3,6 +3,7 @@ { "name": "camel.jbang", "description": "Camel JBang configurations" } ], "properties": [ + { "name": "camel.jbang.buildTool", "required": false, "description": "Build tool to use (Maven or Gradle)", "type": "string", "javaType": "String", "defaultValue": "Maven", "secret": false }, { "name": "camel.jbang.camel-version", "required": false, "description": "The version of Apache Camel to use", "type": "string", "javaType": "String", "secret": false }, { "name": "camel.jbang.camelSpringBootVersion", "required": false, "description": "To use a custom Camel version when running or export to Spring Boot", "label": "spring-boot", "type": "string", "javaType": "String", "secret": false }, { "name": "camel.jbang.classpathFiles", "required": false, "description": "Additional files to add to classpath (Use commas to separate multiple files).", "type": "string", "javaType": "String", "secret": false }, @@ -16,10 +17,11 @@ { "name": "camel.jbang.excludes", "required": false, "description": "Exclude files by name or pattern (Use commas to separate multiple files)", "type": "string", "javaType": "String", "secret": false }, { "name": "camel.jbang.exportDir", "required": false, "description": "Directory where the project will be exported", "type": "string", "javaType": "String", "defaultValue": ".", "secret": false }, { "name": "camel.jbang.gav", "required": false, "description": "Maven coordinate (groupId:artifactId:version)", "type": "string", "javaType": "String", "secret": false }, + { "name": "camel.jbang.gradleWrapper", "required": false, "description": "Include Gradle Wrapper files in the exported project", "type": "boolean", "javaType": "boolean", "defaultValue": true, "secret": false }, { "name": "camel.jbang.groovyFiles", "required": false, "description": "Additional groovy source files to export to src\/main\/resources\/camel-groovy directory (Use commas to separate multiple files)", "type": "string", "javaType": "String", "secret": false }, { "name": "camel.jbang.health", "required": false, "description": "Health check at \/observe\/health on local HTTP server (port 8080 by default)", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false, "deprecated": true }, { "name": "camel.jbang.ignoreLoadingError", "required": false, "description": "Whether to ignore route loading and compilation errors (use this with care!)", "label": "advanced", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, - { "name": "camel.jbang.javaVersion", "required": false, "description": "Java version", "type": "enum", "javaType": "String", "defaultValue": "21", "secret": false, "enum": [ "21" ] }, + { "name": "camel.jbang.javaVersion", "required": false, "description": "Java version (17 or 21)", "type": "enum", "javaType": "String", "defaultValue": "21", "secret": false, "enum": [ "17", "21" ] }, { "name": "camel.jbang.jfr", "required": false, "description": "Enables Java Flight Recorder saving recording to disk on exit", "type": "boolean", "javaType": "boolean", "defaultValue": false, "secret": false }, { "name": "camel.jbang.jfr-profile", "required": false, "description": "Java Flight Recorder profile to use (such as default or profile)", "type": "string", "javaType": "String", "defaultValue": "default", "secret": false }, { "name": "camel.jbang.jib-maven-plugin-version", "required": false, "description": "Version to use for jib-maven-plugin if exporting to camel-main and have Kubernetes enabled (jkube.xxx options)", "label": "kubernetes", "type": "string", "javaType": "String", "defaultValue": "3.4.5", "secret": false }, diff --git a/components/camel-google/camel-google-vision/pom.xml b/components/camel-google/camel-google-vision/pom.xml new file mode 100644 index 000000000000..2670bf924f91 --- /dev/null +++ b/components/camel-google/camel-google-vision/pom.xml @@ -0,0 +1,61 @@ +<?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-google-parent</artifactId> + <version>4.19.0-SNAPSHOT</version> + </parent> + <artifactId>camel-google-vision</artifactId> + <packaging>jar</packaging> + <name>Camel :: Google :: Vision</name> + <description>Camel Component for Google Cloud Vision AI</description> + <properties> + <firstVersion>4.19.0</firstVersion> + <camel.surefire.forkTimeout>300</camel.surefire.forkTimeout> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-common</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>com.google.cloud</groupId> + <artifactId>google-cloud-vision</artifactId> + <version>${google-cloud-vision-version}</version> + <exclusions> + <exclusion> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponentConfigurer.java b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponentConfigurer.java new file mode 100644 index 000000000000..99a6110666c4 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponentConfigurer.java @@ -0,0 +1,57 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.google.vision; + +import javax.annotation.processing.Generated; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; +import org.apache.camel.spi.PropertyConfigurerGetter; +import org.apache.camel.spi.ConfigurerStrategy; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.util.CaseInsensitiveMap; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo") +@SuppressWarnings("unchecked") +public class GoogleCloudVisionComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { + + @Override + public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { + GoogleCloudVisionComponent target = (GoogleCloudVisionComponent) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "autowiredenabled": + case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true; + case "lazystartproducer": + case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + default: return false; + } + } + + @Override + public Class<?> getOptionType(String name, boolean ignoreCase) { + switch (ignoreCase ? name.toLowerCase() : name) { + case "autowiredenabled": + case "autowiredEnabled": return boolean.class; + case "lazystartproducer": + case "lazyStartProducer": return boolean.class; + default: return null; + } + } + + @Override + public Object getOptionValue(Object obj, String name, boolean ignoreCase) { + GoogleCloudVisionComponent target = (GoogleCloudVisionComponent) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "autowiredenabled": + case "autowiredEnabled": return target.isAutowiredEnabled(); + case "lazystartproducer": + case "lazyStartProducer": return target.isLazyStartProducer(); + default: return null; + } + } +} + diff --git a/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointConfigurer.java b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointConfigurer.java new file mode 100644 index 000000000000..15973d88eddc --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointConfigurer.java @@ -0,0 +1,83 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.google.vision; + +import javax.annotation.processing.Generated; +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; +import org.apache.camel.spi.PropertyConfigurerGetter; +import org.apache.camel.spi.ConfigurerStrategy; +import org.apache.camel.spi.GeneratedPropertyConfigurer; +import org.apache.camel.util.CaseInsensitiveMap; +import org.apache.camel.support.component.PropertyConfigurerSupport; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo") +@SuppressWarnings("unchecked") +public class GoogleCloudVisionEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { + + @Override + public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { + GoogleCloudVisionEndpoint target = (GoogleCloudVisionEndpoint) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "client": target.getConfiguration().setClient(property(camelContext, com.google.cloud.vision.v1.ImageAnnotatorClient.class, value)); return true; + case "lazystartproducer": + case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + case "maxresults": + case "maxResults": target.getConfiguration().setMaxResults(property(camelContext, java.lang.Integer.class, value)); return true; + case "operationtype": + case "operationType": target.getConfiguration().setOperationType(property(camelContext, org.apache.camel.component.google.vision.GoogleCloudVisionOperations.class, value)); return true; + case "pojorequest": + case "pojoRequest": target.getConfiguration().setPojoRequest(property(camelContext, boolean.class, value)); return true; + case "serviceaccountkey": + case "serviceAccountKey": target.getConfiguration().setServiceAccountKey(property(camelContext, java.lang.String.class, value)); return true; + default: return false; + } + } + + @Override + public String[] getAutowiredNames() { + return new String[]{"client"}; + } + + @Override + public Class<?> getOptionType(String name, boolean ignoreCase) { + switch (ignoreCase ? name.toLowerCase() : name) { + case "client": return com.google.cloud.vision.v1.ImageAnnotatorClient.class; + case "lazystartproducer": + case "lazyStartProducer": return boolean.class; + case "maxresults": + case "maxResults": return java.lang.Integer.class; + case "operationtype": + case "operationType": return org.apache.camel.component.google.vision.GoogleCloudVisionOperations.class; + case "pojorequest": + case "pojoRequest": return boolean.class; + case "serviceaccountkey": + case "serviceAccountKey": return java.lang.String.class; + default: return null; + } + } + + @Override + public Object getOptionValue(Object obj, String name, boolean ignoreCase) { + GoogleCloudVisionEndpoint target = (GoogleCloudVisionEndpoint) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "client": return target.getConfiguration().getClient(); + case "lazystartproducer": + case "lazyStartProducer": return target.isLazyStartProducer(); + case "maxresults": + case "maxResults": return target.getConfiguration().getMaxResults(); + case "operationtype": + case "operationType": return target.getConfiguration().getOperationType(); + case "pojorequest": + case "pojoRequest": return target.getConfiguration().isPojoRequest(); + case "serviceaccountkey": + case "serviceAccountKey": return target.getConfiguration().getServiceAccountKey(); + default: return null; + } + } +} + diff --git a/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointUriFactory.java b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointUriFactory.java new file mode 100644 index 000000000000..2c08444a57ae --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpointUriFactory.java @@ -0,0 +1,76 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.google.vision; + +import javax.annotation.processing.Generated; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.camel.spi.EndpointUriFactory; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.GenerateEndpointUriFactoryMojo") +public class GoogleCloudVisionEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory { + + private static final String BASE = ":operation"; + + private static final Set<String> PROPERTY_NAMES; + private static final Set<String> SECRET_PROPERTY_NAMES; + private static final Map<String, String> MULTI_VALUE_PREFIXES; + static { + Set<String> props = new HashSet<>(7); + props.add("client"); + props.add("lazyStartProducer"); + props.add("maxResults"); + props.add("operation"); + props.add("operationType"); + props.add("pojoRequest"); + props.add("serviceAccountKey"); + PROPERTY_NAMES = Collections.unmodifiableSet(props); + SECRET_PROPERTY_NAMES = Collections.emptySet(); + MULTI_VALUE_PREFIXES = Collections.emptyMap(); + } + + @Override + public boolean isEnabled(String scheme) { + return "google-vision".equals(scheme); + } + + @Override + public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException { + String syntax = scheme + BASE; + String uri = syntax; + + Map<String, Object> copy = new HashMap<>(properties); + + uri = buildPathParameter(syntax, uri, "operation", null, true, copy); + uri = buildQueryParameters(uri, copy, encode); + return uri; + } + + @Override + public Set<String> propertyNames() { + return PROPERTY_NAMES; + } + + @Override + public Set<String> secretPropertyNames() { + return SECRET_PROPERTY_NAMES; + } + + @Override + public Map<String, String> multiValuePrefixes() { + return MULTI_VALUE_PREFIXES; + } + + @Override + public boolean isLenientProperties() { + return false; + } +} + diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/org/apache/camel/component/google/vision/google-vision.json b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/org/apache/camel/component/google/vision/google-vision.json new file mode 100644 index 000000000000..874952595ccf --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/org/apache/camel/component/google/vision/google-vision.json @@ -0,0 +1,43 @@ +{ + "component": { + "kind": "component", + "name": "google-vision", + "title": "Google Cloud Vision", + "description": "Analyze images using Google Cloud Vision AI", + "deprecated": false, + "firstVersion": "4.19.0", + "label": "cloud,ai", + "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-google-vision", + "version": "4.19.0-SNAPSHOT", + "scheme": "google-vision", + "extendsScheme": "", + "syntax": "google-vision:operation", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "browsable": false, + "remote": true + }, + "componentProperties": { + "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail [...] + "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] + }, + "headers": { + "GoogleCloudVisionOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionOperations", "enum": [ "labelDetection", "textDetection", "faceDetection", "landmarkDetection", "logoDetection", "safeSearchDetection", "imagePropertiesDetection", "webDetection", "objectLocalization", "cropHintsDetection", "documentTextDetection" ], "deprecated": false, "deprecatio [...] + "GoogleCloudVisionResponseObject": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "com.google.cloud.vision.v1.AnnotateImageResponse", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The response object resulting from the Google Cloud Vision API invocation", "constantName": "org.apache.camel.component.google.vision.GoogleCloudVisionConstants#RESPONSE_OBJECT" } + }, + "properties": { + "operation": { "index": 0, "kind": "path", "displayName": "Operation", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The operation name" }, + "serviceAccountKey": { "index": 1, "kind": "parameter", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "Service account key to authenticate an application as a service account" }, + "maxResults": { "index": 2, "kind": "parameter", "displayName": "Max Results", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The max number of results to return per feature type. Default is unset (API default)." }, + "operationType": { "index": 3, "kind": "parameter", "displayName": "Operation Type", "group": "producer", "label": "producer", "required": false, "type": "enum", "javaType": "org.apache.camel.component.google.vision.GoogleCloudVisionOperations", "enum": [ "labelDetection", "textDetection", "faceDetection", "landmarkDetection", "logoDetection", "safeSearchDetection", "imagePropertiesDetection", "webDetection", "objectLocalization", "cropHintsDetection", "documentTextDetection" ], "dep [...] + "pojoRequest": { "index": 4, "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "Specifies if the request is a pojo request" }, + "lazyStartProducer": { "index": 5, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...] + "client": { "index": 6, "kind": "parameter", "displayName": "Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.google.cloud.vision.v1.ImageAnnotatorClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration", "configurationField": "configuration", "description": "The client to use during service invocation." } + } +} diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component.properties new file mode 100644 index 000000000000..be9aafd4a442 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component.properties @@ -0,0 +1,7 @@ +# Generated by camel build tools - do NOT edit this file! +components=google-vision +groupId=org.apache.camel +artifactId=camel-google-vision +version=4.19.0-SNAPSHOT +projectName=Camel :: Google :: Vision +projectDescription=Camel Component for Google Cloud Vision AI diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component/google-vision b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component/google-vision new file mode 100644 index 000000000000..54c67cd9ebbe --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/component/google-vision @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.google.vision.GoogleCloudVisionComponent diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-component b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-component new file mode 100644 index 000000000000..30f432566a94 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-component @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.google.vision.GoogleCloudVisionComponentConfigurer diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-endpoint b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-endpoint new file mode 100644 index 000000000000..e3e3e823f879 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-vision-endpoint @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.google.vision.GoogleCloudVisionEndpointConfigurer diff --git a/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-vision-endpoint b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-vision-endpoint new file mode 100644 index 000000000000..121a03f926c4 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-vision-endpoint @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.google.vision.GoogleCloudVisionEndpointUriFactory diff --git a/components/camel-google/camel-google-vision/src/main/docs/google-vision-component.adoc b/components/camel-google/camel-google-vision/src/main/docs/google-vision-component.adoc new file mode 100644 index 000000000000..4d4465f31665 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/docs/google-vision-component.adoc @@ -0,0 +1,264 @@ += Google Cloud Vision Component +:doctitle: Google Cloud Vision +:shortname: google-vision +:artifactid: camel-google-vision +:description: Analyze images using Google Cloud Vision AI +:since: 4.19 +:supportlevel: Preview +:tabs-sync-option: +:component-header: Only producer is supported +//Manually maintained attributes +:group: Google +:camel-spring-boot-name: google-vision + +*Since Camel {since}* + +*{component-header}* + +The Google Cloud Vision component provides access to https://cloud.google.com/vision[Google Cloud Vision AI] via +the https://github.com/googleapis/java-cloud-vision[Google Cloud Vision Client for Java]. + +Google Cloud Vision AI enables you to detect objects, text, faces, landmarks, logos, and more within images +using pre-trained machine learning models. + +Maven users will need to add the following dependency to their pom.xml +for this component: + +[source,xml] +------------------------------------------------------ +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-vision</artifactId> + <!-- use the same version as your Camel core version --> + <version>x.x.x</version> +</dependency> +------------------------------------------------------ + +[[GoogleVision-AuthenticationConfiguration]] + +== Authentication Configuration + +Google Cloud Vision component authentication is targeted for use with the GCP Service Accounts. +For more information, please refer to https://github.com/googleapis/google-cloud-java#authentication[Google Cloud Authentication]. + +When you have the **service account key**, you can provide authentication credentials to your application code. +Google security credentials can be set through the component endpoint: + +[source,java] +-------------------------------------------------------- +String endpoint = "google-vision://labelDetection?serviceAccountKey=/home/user/Downloads/my-key.json"; +-------------------------------------------------------- + +Or by setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS` : + +-------------------------------------------------------- +export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json" +-------------------------------------------------------- + + +== URI Format + +-------------------------------------------------------- +google-vision://operation[?options] +-------------------------------------------------------- + +You can append query options to the URI in the following format, +`?options=value&option2=value&...` + +For example, to perform label detection on an image, use the following snippet: + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .to("google-vision://labelDetection?serviceAccountKey=/home/user/Downloads/my-key.json"); +-------------------------------------------------------------------------------- + + + +// component options: START +include::partial$component-configure-options.adoc[] +include::partial$component-endpoint-options.adoc[] +include::partial$component-endpoint-headers.adoc[] +// component options: END + + +== Usage + +=== Message body + +The message body should contain the image data as a `byte[]`. The component will build the Vision API request from this image data. + +When `pojoRequest=true`, the message body should be a `com.google.cloud.vision.v1.AnnotateImageRequest` instance, giving you full control over the request. + +=== Google Cloud Vision operations + +The Google Cloud Vision component provides the following operations: + +- `labelDetection` - Detect labels (objects, entities, categories) in images +- `textDetection` - Detect and extract text (OCR) from images +- `documentTextDetection` - Full document text detection optimized for dense text and documents +- `faceDetection` - Detect faces and facial attributes +- `landmarkDetection` - Detect well-known landmarks +- `logoDetection` - Detect company logos +- `safeSearchDetection` - Detect explicit content (adult, violence, etc.) +- `imagePropertiesDetection` - Detect image properties such as dominant colors +- `webDetection` - Detect web references and similar images +- `objectLocalization` - Detect and localize multiple objects with bounding polygons +- `cropHintsDetection` - Suggest crop hints for images + +The operation is specified as part of the endpoint URI (e.g., `google-vision://labelDetection`). +It can also be overridden at runtime by setting the `GoogleCloudVisionOperation` message header. + +=== Advanced component configuration + +If you need to have more control over the `ImageAnnotatorClient` instance configuration, you can create your own instance and refer to it in your Camel google-vision component configuration: + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .to("google-vision://labelDetection?client=#myVisionClient"); +-------------------------------------------------------------------------------- + +=== Google Cloud Vision operation examples + +- `labelDetection`: Detect labels in an image + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/image.jpg")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://labelDetection?serviceAccountKey=/home/user/Downloads/my-key.json&maxResults=10") + .log("Labels: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `List<EntityAnnotation>` with the detected labels. + +- `textDetection`: Extract text from an image (OCR) + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/document.png")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://textDetection?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("Text: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `List<EntityAnnotation>` with the detected text. + +- `faceDetection`: Detect faces in an image + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/photo.jpg")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://faceDetection?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("Faces: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `List<FaceAnnotation>` with the detected faces and their attributes. + +- `safeSearchDetection`: Detect explicit content + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/image.jpg")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://safeSearchDetection?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("SafeSearch: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `SafeSearchAnnotation` with likelihood ratings for adult, spoof, medical, violence, and racy content. + +- `objectLocalization`: Detect and localize objects + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/image.jpg")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://objectLocalization?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("Objects: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `List<LocalizedObjectAnnotation>` with detected objects and their bounding polygons. + +- `webDetection`: Find web references and similar images + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/image.jpg")); + exchange.getIn().setBody(imageData); + }) + .to("google-vision://webDetection?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("Web detection: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The body will contain a `WebDetection` with matching pages, images, and best guess labels. + +- Using POJO request for full control: + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + Image image = Image.newBuilder() + .setContent(ByteString.copyFrom(imageData)) + .build(); + Feature feature = Feature.newBuilder() + .setType(Feature.Type.LABEL_DETECTION) + .setMaxResults(5) + .build(); + AnnotateImageRequest request = AnnotateImageRequest.newBuilder() + .addFeatures(feature) + .setImage(image) + .build(); + exchange.getIn().setBody(request); + }) + .to("google-vision://labelDetection?serviceAccountKey=/home/user/Downloads/my-key.json&pojoRequest=true") + .log("Response: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +When using `pojoRequest=true`, the body should be a `AnnotateImageRequest` and the full `AnnotateImageResponse` is returned. + +- Overriding the operation at runtime via header: + +[source,java] +-------------------------------------------------------------------------------- +from("direct:start") + .process(exchange -> { + byte[] imageData = Files.readAllBytes(Path.of("/path/to/image.jpg")); + exchange.getIn().setBody(imageData); + exchange.getIn().setHeader(GoogleCloudVisionConstants.OPERATION, GoogleCloudVisionOperations.logoDetection); + }) + .to("google-vision://labelDetection?serviceAccountKey=/home/user/Downloads/my-key.json") + .log("Logos: ${body}") + .to("mock:result"); +-------------------------------------------------------------------------------- + +The header `GoogleCloudVisionOperation` overrides the operation specified in the endpoint URI. + + +include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionClientFactory.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionClientFactory.java new file mode 100644 index 000000000000..7522b8f03e87 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionClientFactory.java @@ -0,0 +1,47 @@ +/* + * 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.google.vision; + +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.Credentials; +import com.google.cloud.vision.v1.ImageAnnotatorClient; +import com.google.cloud.vision.v1.ImageAnnotatorSettings; +import org.apache.camel.CamelContext; +import org.apache.camel.component.google.common.GoogleCredentialsHelper; + +public final class GoogleCloudVisionClientFactory { + + private GoogleCloudVisionClientFactory() { + } + + public static ImageAnnotatorClient create( + CamelContext context, + GoogleCloudVisionConfiguration configuration) + throws Exception { + + Credentials credentials = GoogleCredentialsHelper.getCredentials(context, configuration); + + if (credentials != null) { + ImageAnnotatorSettings settings = ImageAnnotatorSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build(); + return ImageAnnotatorClient.create(settings); + } else { + ImageAnnotatorSettings settings = ImageAnnotatorSettings.newBuilder().build(); + return ImageAnnotatorClient.create(settings); + } + } +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponent.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponent.java new file mode 100644 index 000000000000..9ee6fc95b802 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionComponent.java @@ -0,0 +1,57 @@ +/* + * 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.google.vision; + +import java.util.Map; + +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.annotations.Component; +import org.apache.camel.support.DefaultComponent; + +@Component("google-vision") +public class GoogleCloudVisionComponent extends DefaultComponent { + + @Metadata + private GoogleCloudVisionConfiguration configuration = new GoogleCloudVisionConfiguration(); + + public GoogleCloudVisionComponent() { + } + + public GoogleCloudVisionComponent(CamelContext context) { + super(context); + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + if (remaining == null || remaining.isBlank()) { + throw new IllegalArgumentException("Operation must be specified."); + } + final GoogleCloudVisionConfiguration configurationCopy + = this.configuration != null ? this.configuration.copy() : new GoogleCloudVisionConfiguration(); + configurationCopy.setOperation(remaining); + + Endpoint endpoint = new GoogleCloudVisionEndpoint(uri, this, configurationCopy); + setProperties(endpoint, parameters); + return endpoint; + } + + public GoogleCloudVisionConfiguration getConfiguration() { + return configuration; + } +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConfiguration.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConfiguration.java new file mode 100644 index 000000000000..b5d4f96bd433 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConfiguration.java @@ -0,0 +1,126 @@ +/* + * 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.google.vision; + +import com.google.cloud.vision.v1.ImageAnnotatorClient; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.component.google.common.GoogleCommonConfiguration; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; + +@UriParams +public class GoogleCloudVisionConfiguration implements Cloneable, GoogleCommonConfiguration { + + @UriPath(label = "common", description = "The operation name") + @Metadata(required = true) + private String operation; + + @UriParam(label = "common", description = "Service account key to authenticate an application as a service account") + private String serviceAccountKey; + + @UriParam(label = "producer", + enums = "labelDetection,textDetection,faceDetection,landmarkDetection,logoDetection,safeSearchDetection,imagePropertiesDetection,webDetection,objectLocalization,cropHintsDetection,documentTextDetection") + private GoogleCloudVisionOperations operationType; + + @UriParam(label = "producer", + description = "The max number of results to return per feature type. Default is unset (API default).") + private Integer maxResults; + + @UriParam(defaultValue = "false", description = "Specifies if the request is a pojo request") + private boolean pojoRequest; + + @UriParam(label = "advanced") + @Metadata(autowired = true) + private ImageAnnotatorClient client; + + public String getOperation() { + return operation; + } + + /** + * The operation name + */ + public void setOperation(String operation) { + this.operation = operation; + } + + @Override + public String getServiceAccountKey() { + return serviceAccountKey; + } + + /** + * Service account key + */ + public void setServiceAccountKey(String serviceAccountKey) { + this.serviceAccountKey = serviceAccountKey; + } + + public GoogleCloudVisionOperations getOperationType() { + return operationType; + } + + /** + * The operation to perform on the producer. + */ + public void setOperationType(GoogleCloudVisionOperations operationType) { + this.operationType = operationType; + } + + public Integer getMaxResults() { + return maxResults; + } + + /** + * The max number of results to return per feature type. + */ + public void setMaxResults(Integer maxResults) { + this.maxResults = maxResults; + } + + public ImageAnnotatorClient getClient() { + return client; + } + + /** + * The client to use during service invocation. + */ + public void setClient(ImageAnnotatorClient client) { + this.client = client; + } + + public boolean isPojoRequest() { + return pojoRequest; + } + + /** + * Configure the input type. If true the message will be POJO type. + */ + public void setPojoRequest(boolean pojoRequest) { + this.pojoRequest = pojoRequest; + } + + public GoogleCloudVisionConfiguration copy() { + try { + return (GoogleCloudVisionConfiguration) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeCamelException(e); + } + } +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConstants.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConstants.java new file mode 100644 index 000000000000..25432c4402c6 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionConstants.java @@ -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. + */ +package org.apache.camel.component.google.vision; + +import org.apache.camel.spi.Metadata; + +public interface GoogleCloudVisionConstants { + @Metadata(description = "The operation to perform", + javaType = "org.apache.camel.component.google.vision.GoogleCloudVisionOperations") + String OPERATION = "GoogleCloudVisionOperation"; + @Metadata(description = "The response object resulting from the Google Cloud Vision API invocation", + javaType = "com.google.cloud.vision.v1.AnnotateImageResponse") + String RESPONSE_OBJECT = "GoogleCloudVisionResponseObject"; +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpoint.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpoint.java new file mode 100644 index 000000000000..ad73dff6befd --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionEndpoint.java @@ -0,0 +1,109 @@ +/* + * 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.google.vision; + +import com.google.cloud.vision.v1.ImageAnnotatorClient; +import org.apache.camel.Category; +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.spi.EndpointServiceLocation; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.support.DefaultEndpoint; +import org.apache.camel.util.ObjectHelper; + +/** + * Analyze images using Google Cloud Vision AI + * + * Google Cloud Vision Endpoint definition represents the Vision API and contains configuration to customize the + * behavior of Producer. + */ +@UriEndpoint(firstVersion = "4.19.0", scheme = "google-vision", title = "Google Cloud Vision", + syntax = "google-vision:operation", category = { + Category.CLOUD, Category.AI }, + producerOnly = true, headersClass = GoogleCloudVisionConstants.class) +public class GoogleCloudVisionEndpoint extends DefaultEndpoint implements EndpointServiceLocation { + + @UriParam + private GoogleCloudVisionConfiguration configuration; + + private ImageAnnotatorClient visionClient; + + public GoogleCloudVisionEndpoint(String uri, GoogleCloudVisionComponent component, + GoogleCloudVisionConfiguration configuration) { + super(uri, component); + this.configuration = configuration; + } + + @Override + public Producer createProducer() throws Exception { + return new GoogleCloudVisionProducer(this); + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + throw new UnsupportedOperationException( + "Cannot consume from the google-vision endpoint: " + getEndpointUri()); + } + + public GoogleCloudVisionConfiguration getConfiguration() { + return configuration; + } + + /** + * Setup configuration + */ + public void setConfiguration(GoogleCloudVisionConfiguration configuration) { + this.configuration = configuration; + } + + @Override + protected void doStart() throws Exception { + super.doStart(); + if (configuration.getClient() != null) { + visionClient = configuration.getClient(); + } else { + visionClient = GoogleCloudVisionClientFactory.create(this.getCamelContext(), configuration); + } + } + + @Override + protected void doStop() throws Exception { + super.doStop(); + if (configuration.getClient() == null && visionClient != null) { + visionClient.close(); + } + } + + public ImageAnnotatorClient getClient() { + return visionClient; + } + + @Override + public String getServiceUrl() { + if (ObjectHelper.isNotEmpty(configuration.getOperation())) { + return getServiceProtocol() + ":" + configuration.getOperation(); + } + return null; + } + + @Override + public String getServiceProtocol() { + return "vision"; + } +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionOperations.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionOperations.java new file mode 100644 index 000000000000..75633ba8f72f --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionOperations.java @@ -0,0 +1,32 @@ +/* + * 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.google.vision; + +public enum GoogleCloudVisionOperations { + + labelDetection, + textDetection, + faceDetection, + landmarkDetection, + logoDetection, + safeSearchDetection, + imagePropertiesDetection, + webDetection, + objectLocalization, + cropHintsDetection, + documentTextDetection; +} diff --git a/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionProducer.java b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionProducer.java new file mode 100644 index 000000000000..804c64d14757 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/main/java/org/apache/camel/component/google/vision/GoogleCloudVisionProducer.java @@ -0,0 +1,193 @@ +/* + * 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.google.vision; + +import java.util.ArrayList; +import java.util.List; + +import com.google.cloud.vision.v1.AnnotateImageRequest; +import com.google.cloud.vision.v1.AnnotateImageResponse; +import com.google.cloud.vision.v1.BatchAnnotateImagesResponse; +import com.google.cloud.vision.v1.Feature; +import com.google.cloud.vision.v1.Image; +import com.google.cloud.vision.v1.ImageAnnotatorClient; +import com.google.protobuf.ByteString; +import org.apache.camel.Exchange; +import org.apache.camel.InvalidPayloadException; +import org.apache.camel.Message; +import org.apache.camel.support.DefaultProducer; + +/** + * The GoogleCloudVision producer. + */ +public class GoogleCloudVisionProducer extends DefaultProducer { + private GoogleCloudVisionEndpoint endpoint; + + public GoogleCloudVisionProducer(GoogleCloudVisionEndpoint endpoint) { + super(endpoint); + this.endpoint = endpoint; + } + + @Override + public void process(final Exchange exchange) throws Exception { + if (getConfiguration().isPojoRequest()) { + processPojo(exchange); + } else { + processImage(exchange); + } + } + + private void processPojo(Exchange exchange) throws InvalidPayloadException { + ImageAnnotatorClient client = endpoint.getClient(); + AnnotateImageRequest request = exchange.getIn().getMandatoryBody(AnnotateImageRequest.class); + + List<AnnotateImageRequest> requests = new ArrayList<>(); + requests.add(request); + + BatchAnnotateImagesResponse batchResponse = client.batchAnnotateImages(requests); + AnnotateImageResponse response = batchResponse.getResponses(0); + + Message message = getMessageForResponse(exchange); + message.setHeader(GoogleCloudVisionConstants.RESPONSE_OBJECT, response); + message.setBody(response); + } + + private void processImage(Exchange exchange) throws InvalidPayloadException { + ImageAnnotatorClient client = endpoint.getClient(); + GoogleCloudVisionOperations operation = determineOperation(exchange); + + byte[] imageData = exchange.getIn().getMandatoryBody(byte[].class); + + Image image = Image.newBuilder() + .setContent(ByteString.copyFrom(imageData)) + .build(); + + Feature.Builder featureBuilder = Feature.newBuilder() + .setType(mapOperationToFeatureType(operation)); + + if (getConfiguration().getMaxResults() != null) { + featureBuilder.setMaxResults(getConfiguration().getMaxResults()); + } + + Feature feature = featureBuilder.build(); + + AnnotateImageRequest request = AnnotateImageRequest.newBuilder() + .addFeatures(feature) + .setImage(image) + .build(); + + List<AnnotateImageRequest> requests = new ArrayList<>(); + requests.add(request); + + BatchAnnotateImagesResponse batchResponse = client.batchAnnotateImages(requests); + AnnotateImageResponse response = batchResponse.getResponses(0); + + if (response.hasError()) { + throw new RuntimeException( + "Google Cloud Vision API error: " + response.getError().getMessage()); + } + + Message message = getMessageForResponse(exchange); + message.setHeader(GoogleCloudVisionConstants.RESPONSE_OBJECT, response); + message.setBody(extractResult(response, operation)); + } + + private Feature.Type mapOperationToFeatureType(GoogleCloudVisionOperations operation) { + switch (operation) { + case labelDetection: + return Feature.Type.LABEL_DETECTION; + case textDetection: + return Feature.Type.TEXT_DETECTION; + case faceDetection: + return Feature.Type.FACE_DETECTION; + case landmarkDetection: + return Feature.Type.LANDMARK_DETECTION; + case logoDetection: + return Feature.Type.LOGO_DETECTION; + case safeSearchDetection: + return Feature.Type.SAFE_SEARCH_DETECTION; + case imagePropertiesDetection: + return Feature.Type.IMAGE_PROPERTIES; + case webDetection: + return Feature.Type.WEB_DETECTION; + case objectLocalization: + return Feature.Type.OBJECT_LOCALIZATION; + case cropHintsDetection: + return Feature.Type.CROP_HINTS; + case documentTextDetection: + return Feature.Type.DOCUMENT_TEXT_DETECTION; + default: + throw new IllegalArgumentException("Unsupported operation: " + operation); + } + } + + private Object extractResult(AnnotateImageResponse response, GoogleCloudVisionOperations operation) { + switch (operation) { + case labelDetection: + return response.getLabelAnnotationsList(); + case textDetection: + return response.getTextAnnotationsList(); + case faceDetection: + return response.getFaceAnnotationsList(); + case landmarkDetection: + return response.getLandmarkAnnotationsList(); + case logoDetection: + return response.getLogoAnnotationsList(); + case safeSearchDetection: + return response.getSafeSearchAnnotation(); + case imagePropertiesDetection: + return response.getImagePropertiesAnnotation(); + case webDetection: + return response.getWebDetection(); + case objectLocalization: + return response.getLocalizedObjectAnnotationsList(); + case cropHintsDetection: + return response.getCropHintsAnnotation(); + case documentTextDetection: + return response.getFullTextAnnotation(); + default: + throw new IllegalArgumentException("Unsupported operation: " + operation); + } + } + + private GoogleCloudVisionOperations determineOperation(Exchange exchange) { + GoogleCloudVisionOperations operation = exchange.getIn().getHeader(GoogleCloudVisionConstants.OPERATION, + GoogleCloudVisionOperations.class); + if (operation == null) { + operation = getConfiguration().getOperationType(); + } + if (operation == null) { + String operationName = getConfiguration().getOperation(); + if (operationName != null) { + operation = GoogleCloudVisionOperations.valueOf(operationName); + } + } + if (operation == null) { + throw new IllegalArgumentException( + "Operation must be specified via endpoint URI, configuration, or message header."); + } + return operation; + } + + public static Message getMessageForResponse(final Exchange exchange) { + return exchange.getMessage(); + } + + private GoogleCloudVisionConfiguration getConfiguration() { + return this.endpoint.getConfiguration(); + } +} diff --git a/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionComponentTest.java b/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionComponentTest.java new file mode 100644 index 000000000000..f454f6938f12 --- /dev/null +++ b/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionComponentTest.java @@ -0,0 +1,50 @@ +/* + * 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.google.vision.unit; + +import org.apache.camel.component.google.vision.GoogleCloudVisionComponent; +import org.apache.camel.component.google.vision.GoogleCloudVisionEndpoint; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class GoogleCloudVisionComponentTest extends CamelTestSupport { + + @Test + public void testCreateEndpoint() throws Exception { + GoogleCloudVisionComponent component = context.getComponent("google-vision", GoogleCloudVisionComponent.class); + assertNotNull(component); + + GoogleCloudVisionEndpoint endpoint = (GoogleCloudVisionEndpoint) component + .createEndpoint("google-vision:labelDetection?serviceAccountKey=test.json"); + assertNotNull(endpoint); + assertNotNull(endpoint.getConfiguration()); + assertEquals("labelDetection", endpoint.getConfiguration().getOperation()); + } + + @Test + public void testCreateEndpointWithoutOperation() { + GoogleCloudVisionComponent component = context.getComponent("google-vision", GoogleCloudVisionComponent.class); + assertNotNull(component); + + assertThrows(IllegalArgumentException.class, + () -> component.createEndpoint("google-vision:?serviceAccountKey=test.json")); + } +} diff --git a/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionConfigurationTest.java b/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionConfigurationTest.java new file mode 100644 index 000000000000..f08bb567099e --- /dev/null +++ b/components/camel-google/camel-google-vision/src/test/java/org/apache/camel/component/google/vision/unit/GoogleCloudVisionConfigurationTest.java @@ -0,0 +1,67 @@ +/* + * 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.google.vision.unit; + +import org.apache.camel.component.google.vision.GoogleCloudVisionConfiguration; +import org.apache.camel.component.google.vision.GoogleCloudVisionOperations; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; + +public class GoogleCloudVisionConfigurationTest { + + @Test + public void testConfigurationDefaults() { + GoogleCloudVisionConfiguration config = new GoogleCloudVisionConfiguration(); + assertFalse(config.isPojoRequest()); + } + + @Test + public void testConfigurationCopy() { + GoogleCloudVisionConfiguration config = new GoogleCloudVisionConfiguration(); + config.setOperation("labelDetection"); + config.setServiceAccountKey("test-key.json"); + config.setOperationType(GoogleCloudVisionOperations.labelDetection); + config.setMaxResults(10); + config.setPojoRequest(true); + + GoogleCloudVisionConfiguration copy = config.copy(); + assertNotSame(config, copy); + assertEquals("labelDetection", copy.getOperation()); + assertEquals("test-key.json", copy.getServiceAccountKey()); + assertEquals(GoogleCloudVisionOperations.labelDetection, copy.getOperationType()); + assertEquals(10, copy.getMaxResults()); + } + + @Test + public void testOperationsEnum() { + assertNotNull(GoogleCloudVisionOperations.valueOf("labelDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("textDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("faceDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("landmarkDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("logoDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("safeSearchDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("imagePropertiesDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("webDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("objectLocalization")); + assertNotNull(GoogleCloudVisionOperations.valueOf("cropHintsDetection")); + assertNotNull(GoogleCloudVisionOperations.valueOf("documentTextDetection")); + } +} diff --git a/components/camel-google/pom.xml b/components/camel-google/pom.xml index c007b58af354..14d1ea0a6362 100644 --- a/components/camel-google/pom.xml +++ b/components/camel-google/pom.xml @@ -45,6 +45,7 @@ <module>camel-google-sheets</module> <module>camel-google-storage</module> <module>camel-google-vertexai</module> + <module>camel-google-vision</module> </modules> </project> diff --git a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties index 3941fb9b3055..ec3a84d7b477 100644 --- a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties +++ b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties @@ -139,6 +139,7 @@ google-sheets google-sheets-stream google-storage google-vertexai +google-vision grape graphql grpc diff --git a/docs/components/modules/ROOT/examples/json/google-vision.json b/docs/components/modules/ROOT/examples/json/google-vision.json new file mode 120000 index 000000000000..72d289f89573 --- /dev/null +++ b/docs/components/modules/ROOT/examples/json/google-vision.json @@ -0,0 +1 @@ +../../../../../../components/camel-google/camel-google-vision/src/generated/resources/META-INF/org/apache/camel/component/google/vision/google-vision.json \ No newline at end of file diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index 6ba21b9a2674..8a0d98049306 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -154,6 +154,7 @@ *** xref:google-calendar-component.adoc[Google Calendar] *** xref:google-calendar-stream-component.adoc[Google Calendar Stream] *** xref:google-functions-component.adoc[Google Cloud Functions] +*** xref:google-vision-component.adoc[Google Cloud Vision] *** xref:google-drive-component.adoc[Google Drive] *** xref:google-firestore-component.adoc[Google Firestore] *** xref:google-mail-component.adoc[Google Mail] diff --git a/docs/components/modules/ROOT/pages/google-vision-component.adoc b/docs/components/modules/ROOT/pages/google-vision-component.adoc new file mode 120000 index 000000000000..535dbbaf69b3 --- /dev/null +++ b/docs/components/modules/ROOT/pages/google-vision-component.adoc @@ -0,0 +1 @@ +../../../../../components/camel-google/camel-google-vision/src/main/docs/google-vision-component.adoc \ No newline at end of file diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 2aa9ebba2cf0..5a3c5ed1400e 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -1916,6 +1916,19 @@ public interface ComponentsBuilderFactory { static GoogleVertexaiComponentBuilderFactory.GoogleVertexaiComponentBuilder googleVertexai() { return GoogleVertexaiComponentBuilderFactory.googleVertexai(); } + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * @return the dsl builder + */ + static GoogleVisionComponentBuilderFactory.GoogleVisionComponentBuilder googleVision() { + return GoogleVisionComponentBuilderFactory.googleVision(); + } /** * Grape (camel-grape) * Fetch, load and manage additional jars dynamically after Camel Context diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleVisionComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleVisionComponentBuilderFactory.java new file mode 100644 index 000000000000..d6c980ef864f --- /dev/null +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleVisionComponentBuilderFactory.java @@ -0,0 +1,120 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.component.dsl; + +import javax.annotation.processing.Generated; +import org.apache.camel.Component; +import org.apache.camel.builder.component.AbstractComponentBuilder; +import org.apache.camel.builder.component.ComponentBuilder; +import org.apache.camel.component.google.vision.GoogleCloudVisionComponent; + +/** + * Analyze images using Google Cloud Vision AI + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") +public interface GoogleVisionComponentBuilderFactory { + + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * @return the dsl builder + */ + static GoogleVisionComponentBuilder googleVision() { + return new GoogleVisionComponentBuilderImpl(); + } + + /** + * Builder for the Google Cloud Vision component. + */ + interface GoogleVisionComponentBuilder extends ComponentBuilder<GoogleCloudVisionComponent> { + + + /** + * Whether the producer should be started lazy (on the first message). + * By starting lazy you can use this to allow CamelContext and routes to + * startup in situations where a producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default GoogleVisionComponentBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + + + /** + * Whether autowiring is enabled. This is used for automatic autowiring + * options (the option must be marked as autowired) by looking up in the + * registry to find if there is a single instance of matching type, + * which then gets configured on the component. This can be used for + * automatic configuring JDBC data sources, JMS connection factories, + * AWS Clients, etc. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: advanced + * + * @param autowiredEnabled the value to set + * @return the dsl builder + */ + default GoogleVisionComponentBuilder autowiredEnabled(boolean autowiredEnabled) { + doSetProperty("autowiredEnabled", autowiredEnabled); + return this; + } + } + + class GoogleVisionComponentBuilderImpl + extends AbstractComponentBuilder<GoogleCloudVisionComponent> + implements GoogleVisionComponentBuilder { + @Override + protected GoogleCloudVisionComponent buildConcreteComponent() { + return new GoogleCloudVisionComponent(); + } + @Override + protected boolean setPropertyOnComponent( + Component component, + String name, + Object value) { + switch (name) { + case "lazyStartProducer": ((GoogleCloudVisionComponent) component).setLazyStartProducer((boolean) value); return true; + case "autowiredEnabled": ((GoogleCloudVisionComponent) component).setAutowiredEnabled((boolean) value); return true; + default: return false; + } + } + } +} \ No newline at end of file diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java index 5b419175f44c..e2db56a0ca10 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java @@ -139,6 +139,7 @@ public interface EndpointBuilderFactory org.apache.camel.builder.endpoint.dsl.GoogleCalendarStreamEndpointBuilderFactory.GoogleCalendarStreamBuilders, org.apache.camel.builder.endpoint.dsl.GoogleCloudFunctionsEndpointBuilderFactory.GoogleCloudFunctionsBuilders, org.apache.camel.builder.endpoint.dsl.GoogleCloudStorageEndpointBuilderFactory.GoogleCloudStorageBuilders, + org.apache.camel.builder.endpoint.dsl.GoogleCloudVisionEndpointBuilderFactory.GoogleCloudVisionBuilders, org.apache.camel.builder.endpoint.dsl.GoogleDriveEndpointBuilderFactory.GoogleDriveBuilders, org.apache.camel.builder.endpoint.dsl.GoogleFirestoreEndpointBuilderFactory.GoogleFirestoreBuilders, org.apache.camel.builder.endpoint.dsl.GoogleMailEndpointBuilderFactory.GoogleMailBuilders, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java index 971f9f3b4a51..b73cacd5ec91 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java @@ -136,6 +136,7 @@ public interface EndpointBuilders org.apache.camel.builder.endpoint.dsl.GoogleCalendarStreamEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.GoogleCloudFunctionsEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.GoogleCloudStorageEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.GoogleCloudVisionEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.GoogleDriveEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.GoogleFirestoreEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.GoogleMailEndpointBuilderFactory, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index 0ae95d853158..d580a0b7a512 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -6283,6 +6283,46 @@ public class StaticEndpointBuilders { public static GoogleVertexAIEndpointBuilderFactory.GoogleVertexAIEndpointBuilder googleVertexai(String componentName, String path) { return GoogleVertexAIEndpointBuilderFactory.endpointBuilder(componentName, path); } + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * Syntax: <code>google-vision:operation</code> + * + * Path parameter: operation (required) + * The operation name + * + * @param path operation + * @return the dsl builder + */ + public static GoogleCloudVisionEndpointBuilderFactory.GoogleCloudVisionEndpointBuilder googleVision(String path) { + return googleVision("google-vision", path); + } + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * Syntax: <code>google-vision:operation</code> + * + * Path parameter: operation (required) + * The operation name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path operation + * @return the dsl builder + */ + public static GoogleCloudVisionEndpointBuilderFactory.GoogleCloudVisionEndpointBuilder googleVision(String componentName, String path) { + return GoogleCloudVisionEndpointBuilderFactory.endpointBuilder(componentName, path); + } /** * Grape (camel-grape) * Fetch, load and manage additional jars dynamically after Camel Context diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudVisionEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudVisionEndpointBuilderFactory.java new file mode 100644 index 000000000000..5fae56a73f5a --- /dev/null +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleCloudVisionEndpointBuilderFactory.java @@ -0,0 +1,347 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.endpoint.dsl; + +import java.util.*; +import java.util.concurrent.*; +import java.util.function.*; +import java.util.stream.*; +import javax.annotation.processing.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * Analyze images using Google Cloud Vision AI + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface GoogleCloudVisionEndpointBuilderFactory { + + /** + * Builder for endpoint for the Google Cloud Vision component. + */ + public interface GoogleCloudVisionEndpointBuilder + extends + EndpointProducerBuilder { + default AdvancedGoogleCloudVisionEndpointBuilder advanced() { + return (AdvancedGoogleCloudVisionEndpointBuilder) this; + } + + /** + * Service account key to authenticate an application as a service + * account. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param serviceAccountKey the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder serviceAccountKey(String serviceAccountKey) { + doSetProperty("serviceAccountKey", serviceAccountKey); + return this; + } + /** + * The max number of results to return per feature type. Default is + * unset (API default). + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param maxResults the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder maxResults(Integer maxResults) { + doSetProperty("maxResults", maxResults); + return this; + } + /** + * The max number of results to return per feature type. Default is + * unset (API default). + * + * The option will be converted to a <code>java.lang.Integer</code> + * type. + * + * Group: producer + * + * @param maxResults the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder maxResults(String maxResults) { + doSetProperty("maxResults", maxResults); + return this; + } + /** + * The operation to perform on the producer. + * + * The option is a: + * <code>org.apache.camel.component.google.vision.GoogleCloudVisionOperations</code> type. + * + * Group: producer + * + * @param operationType the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder operationType(org.apache.camel.component.google.vision.GoogleCloudVisionOperations operationType) { + doSetProperty("operationType", operationType); + return this; + } + /** + * The operation to perform on the producer. + * + * The option will be converted to a + * <code>org.apache.camel.component.google.vision.GoogleCloudVisionOperations</code> type. + * + * Group: producer + * + * @param operationType the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder operationType(String operationType) { + doSetProperty("operationType", operationType); + return this; + } + /** + * Specifies if the request is a pojo request. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param pojoRequest the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder pojoRequest(boolean pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + return this; + } + /** + * Specifies if the request is a pojo request. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param pojoRequest the value to set + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder pojoRequest(String pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + return this; + } + } + + /** + * Advanced builder for endpoint for the Google Cloud Vision component. + */ + public interface AdvancedGoogleCloudVisionEndpointBuilder + extends + EndpointProducerBuilder { + default GoogleCloudVisionEndpointBuilder basic() { + return (GoogleCloudVisionEndpointBuilder) this; + } + + /** + * Whether the producer should be started lazy (on the first message). + * By starting lazy you can use this to allow CamelContext and routes to + * startup in situations where a producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedGoogleCloudVisionEndpointBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * Whether the producer should be started lazy (on the first message). + * By starting lazy you can use this to allow CamelContext and routes to + * startup in situations where a producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedGoogleCloudVisionEndpointBuilder lazyStartProducer(String lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * The client to use during service invocation. + * + * The option is a: + * <code>com.google.cloud.vision.v1.ImageAnnotatorClient</code> type. + * + * Group: advanced + * + * @param client the value to set + * @return the dsl builder + */ + default AdvancedGoogleCloudVisionEndpointBuilder client(com.google.cloud.vision.v1.ImageAnnotatorClient client) { + doSetProperty("client", client); + return this; + } + /** + * The client to use during service invocation. + * + * The option will be converted to a + * <code>com.google.cloud.vision.v1.ImageAnnotatorClient</code> type. + * + * Group: advanced + * + * @param client the value to set + * @return the dsl builder + */ + default AdvancedGoogleCloudVisionEndpointBuilder client(String client) { + doSetProperty("client", client); + return this; + } + } + + public interface GoogleCloudVisionBuilders { + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * @return the dsl builder for the headers' name. + */ + default GoogleCloudVisionHeaderNameBuilder googleVision() { + return GoogleCloudVisionHeaderNameBuilder.INSTANCE; + } + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * Syntax: <code>google-vision:operation</code> + * + * Path parameter: operation (required) + * The operation name + * + * @param path operation + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder googleVision(String path) { + return GoogleCloudVisionEndpointBuilderFactory.endpointBuilder("google-vision", path); + } + /** + * Google Cloud Vision (camel-google-vision) + * Analyze images using Google Cloud Vision AI + * + * Category: cloud,ai + * Since: 4.19 + * Maven coordinates: org.apache.camel:camel-google-vision + * + * Syntax: <code>google-vision:operation</code> + * + * Path parameter: operation (required) + * The operation name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path operation + * @return the dsl builder + */ + default GoogleCloudVisionEndpointBuilder googleVision(String componentName, String path) { + return GoogleCloudVisionEndpointBuilderFactory.endpointBuilder(componentName, path); + } + + } + /** + * The builder of headers' name for the Google Cloud Vision component. + */ + public static class GoogleCloudVisionHeaderNameBuilder { + /** + * The internal instance of the builder used to access to all the + * methods representing the name of headers. + */ + private static final GoogleCloudVisionHeaderNameBuilder INSTANCE = new GoogleCloudVisionHeaderNameBuilder(); + + /** + * The operation to perform. + * + * The option is a: {@code + * org.apache.camel.component.google.vision.GoogleCloudVisionOperations} + * type. + * + * Group: producer + * + * @return the name of the header {@code GoogleCloudVisionOperation}. + */ + public String googleCloudVisionOperation() { + return "GoogleCloudVisionOperation"; + } + /** + * The response object resulting from the Google Cloud Vision API + * invocation. + * + * The option is a: {@code + * com.google.cloud.vision.v1.AnnotateImageResponse} type. + * + * Group: producer + * + * @return the name of the header {@code + * GoogleCloudVisionResponseObject}. + */ + public String googleCloudVisionResponseObject() { + return "GoogleCloudVisionResponseObject"; + } + } + static GoogleCloudVisionEndpointBuilder endpointBuilder(String componentName, String path) { + class GoogleCloudVisionEndpointBuilderImpl extends AbstractEndpointBuilder implements GoogleCloudVisionEndpointBuilder, AdvancedGoogleCloudVisionEndpointBuilder { + public GoogleCloudVisionEndpointBuilderImpl(String path) { + super(componentName, path); + } + } + return new GoogleCloudVisionEndpointBuilderImpl(path); + } +} \ No newline at end of file diff --git a/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties b/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties index 609ab9b75ed0..76415541cbe2 100644 --- a/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties +++ b/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties @@ -156,6 +156,7 @@ org.apache.camel.component.google.sheets.GoogleSheetsComponent=camel:google-shee org.apache.camel.component.google.sheets.stream.GoogleSheetsStreamComponent=camel:google-sheets org.apache.camel.component.google.storage.GoogleCloudStorageComponent=camel:google-storage org.apache.camel.component.google.vertexai.GoogleVertexAIComponent=camel:google-vertexai +org.apache.camel.component.google.vision.GoogleCloudVisionComponent=camel:google-vision org.apache.camel.component.grape.GrapeComponent=camel:grape org.apache.camel.component.graphql.GraphqlComponent=camel:graphql org.apache.camel.component.grpc.GrpcComponent=camel:grpc diff --git a/parent/pom.xml b/parent/pom.xml index 69564a039ffa..a58874f83df9 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -219,6 +219,7 @@ <google-cloud-secretmanager-version>2.85.0</google-cloud-secretmanager-version> <google-cloud-storage-version>2.64.0</google-cloud-storage-version> <google-cloud-aiplatform-version>3.86.0</google-cloud-aiplatform-version> + <google-cloud-vision-version>3.59.0</google-cloud-vision-version> <google-genai-version>1.42.0</google-genai-version> <graaljs-version>25.0.2</graaljs-version> <graphql-java-version>25.0</graphql-java-version> @@ -1526,6 +1527,11 @@ <artifactId>camel-google-vertexai</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-google-vision</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-grape</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 84ecac4da6bf..fed133489a2f 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 @@ -83,7 +83,8 @@ public final class MojoHelper { dir.resolve("camel-google-mail"), dir.resolve("camel-google-pubsub"), dir.resolve("camel-google-sheets"), dir.resolve("camel-google-storage"), dir.resolve("camel-google-functions"), - dir.resolve("camel-google-secret-manager"), dir.resolve("camel-google-vertexai")); + dir.resolve("camel-google-secret-manager"), dir.resolve("camel-google-vertexai"), + dir.resolve("camel-google-vision")); case "camel-debezium": return Arrays.asList(dir.resolve("camel-debezium-mongodb"), dir.resolve("camel-debezium-mysql"), dir.resolve("camel-debezium-postgres"), dir.resolve("camel-debezium-sqlserver"),
