This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9c5a8dc73f04daf70407de53cf6210ec61e6405a Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Sep 11 16:31:35 2019 +0200 CAMEL-13435 - Add an AWS Translate component --- components/camel-aws-translate/pom.xml | 82 +++++++++ .../src/main/docs/aws-eks-component.adoc | 183 +++++++++++++++++++ .../aws/translate/TranslateComponent.java | 130 +++++++++++++ .../TranslateComponentVerifierExtension.java | 92 ++++++++++ .../aws/translate/TranslateConfiguration.java | 138 ++++++++++++++ .../aws/translate/TranslateConstants.java | 26 +++ .../component/aws/translate/TranslateEndpoint.java | 120 ++++++++++++ .../aws/translate/TranslateOperations.java | 22 +++ .../component/aws/translate/TranslateProducer.java | 108 +++++++++++ .../TranslateProducerIntegrationTest.java | 67 +++++++ .../src/test/resources/log4j2.properties | 28 +++ .../aws/eks/EKSComponentSpringTest-context.xml | 50 +++++ .../dsl/TranslateEndpointBuilderFactory.java | 146 +++++++++++++++ .../camel-aws-translate-starter/pom.xml | 61 +++++++ .../TranslateComponentAutoConfiguration.java | 128 +++++++++++++ .../TranslateComponentConfiguration.java | 194 ++++++++++++++++++++ .../TranslateComponentAutoConfiguration.java | 128 +++++++++++++ .../TranslateComponentConfiguration.java | 194 ++++++++++++++++++++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++ .../src/main/resources/META-INF/NOTICE.txt | 11 ++ .../src/main/resources/META-INF/spring.factories | 19 ++ .../src/main/resources/META-INF/spring.provides | 17 ++ platforms/spring-boot/components-starter/pom.xml | 1 + 23 files changed, 2148 insertions(+) diff --git a/components/camel-aws-translate/pom.xml b/components/camel-aws-translate/pom.xml new file mode 100644 index 0000000..0664ccc --- /dev/null +++ b/components/camel-aws-translate/pom.xml @@ -0,0 +1,82 @@ +<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" + 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>components</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-aws-translate</artifactId> + <packaging>jar</packaging> + + <name>Camel :: AWS Translate</name> + <description>A Camel Amazon Translate Web Service Component</description> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>com.amazonaws</groupId> + <artifactId>aws-java-sdk-translate</artifactId> + <version>${aws-java-sdk-version}</version> + </dependency> + + <!-- for testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/components/camel-aws-translate/src/main/docs/aws-eks-component.adoc b/components/camel-aws-translate/src/main/docs/aws-eks-component.adoc new file mode 100644 index 0000000..2e0989a --- /dev/null +++ b/components/camel-aws-translate/src/main/docs/aws-eks-component.adoc @@ -0,0 +1,183 @@ +[[aws-eks-component]] += AWS EKS Component + +*Available as of Camel version 3.0* + +The EKS component supports create, delete, describe and list +https://aws.amazon.com/eks/[AWS EKS] clusters instances. + +Prerequisites + +You must have a valid Amazon Web Services developer account, and be +signed up to use Amazon EKS. More information is available at +https://aws.amazon.com/eks/[Amazon EKS]. + +== URI Format + +[source,java] +------------------------- +aws-eks://label[?options] +------------------------- + +You can append query options to the URI in the following format, +?options=value&option2=value&... + +== URI Options + + +// component options: START +The AWS EKS component supports 5 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *configuration* (advanced) | The AWS EKS default configuration | | EKSConfiguration +| *accessKey* (producer) | Amazon AWS Access Key | | String +| *secretKey* (producer) | Amazon AWS Secret Key | | String +| *region* (producer) | The region in which EKS client needs to work | | String +| *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +|=== +// component options: END + + + + +// endpoint options: START +The AWS EKS endpoint is configured using URI syntax: + +---- +aws-eks:label +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *label* | *Required* Logical name | | String +|=== + + +=== Query Parameters (10 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *accessKey* (producer) | Amazon AWS Access Key | | String +| *eksClient* (producer) | To use a existing configured AWS EKS as client | | AmazonEKS +| *lazyStartProducer* (producer) | 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 [...] +| *operation* (producer) | *Required* The operation to perform | | EKSOperations +| *proxyHost* (producer) | To define a proxy host when instantiating the EKS client | | String +| *proxyPort* (producer) | To define a proxy port when instantiating the EKS client | | Integer +| *region* (producer) | The region in which EKS client needs to work. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() | | String +| *secretKey* (producer) | Amazon AWS Secret Key | | String +| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean +|=== +// endpoint options: END +// spring-boot-auto-configure options: START +== Spring Boot Auto-Configuration + +When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-eks-starter</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + + +The component supports 12 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *camel.component.aws-eks.access-key* | Amazon AWS Access Key | | String +| *camel.component.aws-eks.basic-property-binding* | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | Boolean +| *camel.component.aws-eks.configuration.access-key* | Amazon AWS Access Key | | String +| *camel.component.aws-eks.configuration.eks-client* | To use a existing configured AWS EKS as client | | AmazonEKS +| *camel.component.aws-eks.configuration.operation* | The operation to perform | | EKSOperations +| *camel.component.aws-eks.configuration.proxy-host* | To define a proxy host when instantiating the EKS client | | String +| *camel.component.aws-eks.configuration.proxy-port* | To define a proxy port when instantiating the EKS client | | Integer +| *camel.component.aws-eks.configuration.region* | The region in which EKS client needs to work. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) You'll need to use the name Regions.EU_WEST_1.name() | | String +| *camel.component.aws-eks.configuration.secret-key* | Amazon AWS Secret Key | | String +| *camel.component.aws-eks.enabled* | Whether to enable auto configuration of the aws-eks component. This is enabled by default. | | Boolean +| *camel.component.aws-eks.region* | The region in which EKS client needs to work | | String +| *camel.component.aws-eks.secret-key* | Amazon AWS Secret Key | | String +|=== +// spring-boot-auto-configure options: END + + + + +Required EKS component options + +You have to provide the amazonEKSClient in the +Registry or your accessKey and secretKey to access +the https://aws.amazon.com/eks/[Amazon EKS] service. + +== Usage + +=== Message headers evaluated by the EKS producer + +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|Header |Type |Description + +|`CamelAwsEKSMaxResults` |`Integer` |The limit number of results while listing clusters + +|`CamelAwsEKSOperation` |`String` |The operation we want to perform + +|`CamelAwsEKSDescription` |`String` |A key description to use while performing a createKey operation + +|`CamelAwsEKSClusterName` |`String` |The cluster name + +|`CamelAwsEKSRoleARN` |`String` |The role ARN to use while creating the cluster + +|`CamelAwsEKSVPCConfig` |`VPCConfigRequest` |The VPC config for the creations of an EKS cluster +|======================================================================= + +=== EKS Producer operations + +Camel-AWS EKS component provides the following operation on the producer side: + +- listClusters +- createCluster +- describeCluster +- deleteCluster + +== Automatic detection of AmazonEKS client in registry + +The component is capable of detecting the presence of an AmazonEKS bean into the registry. +If it's the only instance of that type it will be used as client and you won't have to define it as uri parameter. +This may be really useful for smarter configuration of the endpoint. + +Dependencies + +Maven users will need to add the following dependency to their pom.xml. + +*pom.xml* + +[source,xml] +--------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-eks</artifactId> + <version>${camel-version}</version> +</dependency> +--------------------------------------- + +where `$\{camel-version\}` must be replaced by the actual version of Camel. + diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponent.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponent.java new file mode 100644 index 0000000..9a59ac4 --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponent.java @@ -0,0 +1,130 @@ +/* + * 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.aws.translate; + +import java.util.Map; +import java.util.Set; + +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; +import org.apache.camel.util.ObjectHelper; + +import com.amazonaws.services.translate.AmazonTranslate; + +/** + * For working with Amazon Translate. + */ +@Component("aws-translate") +public class TranslateComponent extends DefaultComponent { + + @Metadata + private String accessKey; + @Metadata + private String secretKey; + @Metadata + private String region; + @Metadata(label = "advanced") + private TranslateConfiguration configuration; + + public TranslateComponent() { + this(null); + } + + public TranslateComponent(CamelContext context) { + super(context); + + this.configuration = new TranslateConfiguration(); + registerExtension(new TranslateComponentVerifierExtension()); + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + TranslateConfiguration configuration = this.configuration.copy(); + setProperties(configuration, parameters); + + if (ObjectHelper.isEmpty(configuration.getAccessKey())) { + setAccessKey(accessKey); + } + if (ObjectHelper.isEmpty(configuration.getSecretKey())) { + setSecretKey(secretKey); + } + if (ObjectHelper.isEmpty(configuration.getRegion())) { + setRegion(region); + } + checkAndSetRegistryClient(configuration); + if (configuration.getTranslateClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { + throw new IllegalArgumentException("Amazon translate client or accessKey and secretKey must be specified"); + } + + TranslateEndpoint endpoint = new TranslateEndpoint(uri, this, configuration); + return endpoint; + } + + public TranslateConfiguration getConfiguration() { + return configuration; + } + + /** + * The AWS EKS default configuration + */ + public void setConfiguration(TranslateConfiguration configuration) { + this.configuration = configuration; + } + + public String getAccessKey() { + return configuration.getAccessKey(); + } + + /** + * Amazon AWS Access Key + */ + public void setAccessKey(String accessKey) { + configuration.setAccessKey(accessKey); + } + + public String getSecretKey() { + return configuration.getSecretKey(); + } + + /** + * Amazon AWS Secret Key + */ + public void setSecretKey(String secretKey) { + configuration.setSecretKey(secretKey); + } + + public String getRegion() { + return configuration.getRegion(); + } + + /** + * The region in which EKS client needs to work + */ + public void setRegion(String region) { + configuration.setRegion(region); + } + + private void checkAndSetRegistryClient(TranslateConfiguration configuration) { + Set<AmazonTranslate> clients = getCamelContext().getRegistry().findByType(AmazonTranslate.class); + if (clients.size() == 1) { + configuration.setTranslateClient(clients.stream().findFirst().get()); + } + } +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponentVerifierExtension.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponentVerifierExtension.java new file mode 100644 index 0000000..c7ed7ed --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateComponentVerifierExtension.java @@ -0,0 +1,92 @@ +/* + * 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.aws.translate; + +import java.util.Map; + +import com.amazonaws.SdkClientException; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.regions.Regions; +import com.amazonaws.services.translate.AmazonTranslate; +import com.amazonaws.services.translate.AmazonTranslateClientBuilder; +import com.amazonaws.services.translate.model.TranslateTextRequest; + +import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; +import org.apache.camel.component.extension.verifier.ResultBuilder; +import org.apache.camel.component.extension.verifier.ResultErrorBuilder; +import org.apache.camel.component.extension.verifier.ResultErrorHelper; + +public class TranslateComponentVerifierExtension extends DefaultComponentVerifierExtension { + + public TranslateComponentVerifierExtension() { + this("aws-translate"); + } + + public TranslateComponentVerifierExtension(String scheme) { + super(scheme); + } + + // ********************************* + // Parameters validation + // ********************************* + + @Override + protected Result verifyParameters(Map<String, Object> parameters) { + + ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS).error(ResultErrorHelper.requiresOption("accessKey", parameters)) + .error(ResultErrorHelper.requiresOption("secretKey", parameters)).error(ResultErrorHelper.requiresOption("region", parameters)); + + // Validate using the catalog + + super.verifyParametersAgainstCatalog(builder, parameters); + + return builder.build(); + } + + // ********************************* + // Connectivity validation + // ********************************* + + @Override + protected Result verifyConnectivity(Map<String, Object> parameters) { + ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY); + + try { + TranslateConfiguration configuration = setProperties(new TranslateConfiguration(), parameters); + AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); + AmazonTranslate client = AmazonTranslateClientBuilder.standard().withCredentials(credentialsProvider).withRegion(Regions.valueOf(configuration.getRegion())).build(); + TranslateTextRequest req = new TranslateTextRequest(); + req.setSourceLanguageCode("it"); + req.setTargetLanguageCode("en"); + req.setText("ciao"); + client.translateText(req); + } catch (SdkClientException e) { + ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage()) + .detail("aws_translate_exception_message", e.getMessage()).detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName()) + .detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e); + + builder.error(errorBuilder.build()); + } catch (Exception e) { + builder.error(ResultErrorBuilder.withException(e).build()); + } + return builder.build(); + } +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConfiguration.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConfiguration.java new file mode 100644 index 0000000..d7cabcf --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConfiguration.java @@ -0,0 +1,138 @@ +/* + * 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.aws.translate; + +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; + +import com.amazonaws.services.translate.AmazonTranslate; + +@UriParams +public class TranslateConfiguration implements Cloneable { + + @UriPath(description = "Logical name") + @Metadata(required = true) + private String label; + @UriParam(label = "producer") + private AmazonTranslate translateClient; + @UriParam(label = "producer", secret = true) + private String accessKey; + @UriParam(label = "producer", secret = true) + private String secretKey; + @UriParam(label = "producer") + @Metadata(required = true) + private TranslateOperations operation; + @UriParam(label = "producer") + private String proxyHost; + @UriParam(label = "producer") + private Integer proxyPort; + @UriParam + private String region; + + public AmazonTranslate getTranslateClient() { + return translateClient; + } + + /** + * To use a existing configured AWS Translate as client + */ + public void setTranslateClient(AmazonTranslate translateClient) { + this.translateClient = translateClient; + } + + public String getAccessKey() { + return accessKey; + } + + /** + * Amazon AWS Access Key + */ + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + /** + * Amazon AWS Secret Key + */ + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public TranslateOperations getOperation() { + return operation; + } + + /** + * The operation to perform + */ + public void setOperation(TranslateOperations operation) { + this.operation = operation; + } + + public String getProxyHost() { + return proxyHost; + } + + /** + * To define a proxy host when instantiating the EKS client + */ + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + /** + * To define a proxy port when instantiating the EKS client + */ + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + /** + * The region in which EKS client needs to work. When using this parameter, the configuration will expect the capitalized name of the region (for example AP_EAST_1) + * You'll need to use the name Regions.EU_WEST_1.name() + */ + public void setRegion(String region) { + this.region = region; + } + + // ************************************************* + // + // ************************************************* + + public TranslateConfiguration copy() { + try { + return (TranslateConfiguration)super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeCamelException(e); + } + } +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConstants.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConstants.java new file mode 100644 index 0000000..d88cb34 --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateConstants.java @@ -0,0 +1,26 @@ +/* + * 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.aws.translate; + +/** + * Constants used in Camel AWS EKS module + */ +public interface TranslateConstants { + String SOURCE_LANGUAGE = "CamelAwsTranslateSourceLanguage"; + String TARGET_LANGUAGE = "CamelAwsTranslateTargetLanguage"; + String OPERATION = "CamelAwsTranslateOperation"; +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateEndpoint.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateEndpoint.java new file mode 100644 index 0000000..66fa245 --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateEndpoint.java @@ -0,0 +1,120 @@ +/* + * 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.aws.translate; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.regions.Regions; +import com.amazonaws.services.translate.AmazonTranslate; +import com.amazonaws.services.translate.AmazonTranslateClientBuilder; + +import org.apache.camel.Component; +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.support.ScheduledPollEndpoint; +import org.apache.camel.util.ObjectHelper; + +/** + * The aws-kms is used for managing Amazon EKS + */ +@UriEndpoint(firstVersion = "3.0.0", scheme = "aws-translate", title = "AWS Translate", syntax = "aws-translate:label", producerOnly = true, label = "cloud,management") +public class TranslateEndpoint extends ScheduledPollEndpoint { + + private AmazonTranslate translateClient; + + @UriParam + private TranslateConfiguration configuration; + + public TranslateEndpoint(String uri, Component component, TranslateConfiguration configuration) { + super(uri, component); + this.configuration = configuration; + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + throw new UnsupportedOperationException("You cannot receive messages from this endpoint"); + } + + @Override + public Producer createProducer() throws Exception { + return new TranslateProducer(this); + } + + @Override + public void doStart() throws Exception { + super.doStart(); + + translateClient = configuration.getTranslateClient() != null ? configuration.getTranslateClient() : createTranslateClient(); + } + + @Override + public void doStop() throws Exception { + if (ObjectHelper.isEmpty(configuration.getTranslateClient())) { + if (translateClient != null) { + translateClient.shutdown(); + } + } + super.doStop(); + } + + public TranslateConfiguration getConfiguration() { + return configuration; + } + + public AmazonTranslate getTranslateClient() { + return translateClient; + } + + AmazonTranslate createTranslateClient() { + AmazonTranslate client = null; + ClientConfiguration clientConfiguration = null; + AmazonTranslateClientBuilder clientBuilder = null; + boolean isClientConfigFound = false; + if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { + clientConfiguration = new ClientConfiguration(); + clientConfiguration.setProxyHost(configuration.getProxyHost()); + clientConfiguration.setProxyPort(configuration.getProxyPort()); + isClientConfigFound = true; + } + if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { + AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); + if (isClientConfigFound) { + clientBuilder = AmazonTranslateClientBuilder.standard().withClientConfiguration(clientConfiguration).withCredentials(credentialsProvider); + } else { + clientBuilder = AmazonTranslateClientBuilder.standard().withCredentials(credentialsProvider); + } + } else { + if (isClientConfigFound) { + clientBuilder = AmazonTranslateClientBuilder.standard(); + } else { + clientBuilder = AmazonTranslateClientBuilder.standard().withClientConfiguration(clientConfiguration); + } + } + if (ObjectHelper.isNotEmpty(configuration.getRegion())) { + clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); + } + client = clientBuilder.build(); + return client; + } +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateOperations.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateOperations.java new file mode 100644 index 0000000..159e2c5 --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateOperations.java @@ -0,0 +1,22 @@ +/* + * 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.aws.translate; + +public enum TranslateOperations { + + translateText +} diff --git a/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateProducer.java b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateProducer.java new file mode 100644 index 0000000..399b6bf --- /dev/null +++ b/components/camel-aws-translate/src/main/java/org/apache/camel/component/aws/translate/TranslateProducer.java @@ -0,0 +1,108 @@ +/* + * 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.aws.translate; + +import com.amazonaws.AmazonServiceException; +import com.amazonaws.services.translate.AmazonTranslate; +import com.amazonaws.services.translate.model.TranslateTextRequest; +import com.amazonaws.services.translate.model.TranslateTextResult; + +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; +import org.apache.camel.Message; +import org.apache.camel.support.DefaultProducer; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; + +/** + * A Producer which sends messages to the Amazon EKS Service + * <a href="http://aws.amazon.com/eks/">AWS EKS</a> + */ +public class TranslateProducer extends DefaultProducer { + + private transient String eksProducerToString; + + public TranslateProducer(Endpoint endpoint) { + super(endpoint); + } + + @Override + public void process(Exchange exchange) throws Exception { + switch (determineOperation(exchange)) { + case translateText: + translateText(getEndpoint().getTranslateClient(), exchange); + break; + default: + throw new IllegalArgumentException("Unsupported operation"); + } + } + + private TranslateOperations determineOperation(Exchange exchange) { + TranslateOperations operation = exchange.getIn().getHeader(TranslateConstants.OPERATION, TranslateOperations.class); + if (operation == null) { + operation = getConfiguration().getOperation(); + } + return operation; + } + + protected TranslateConfiguration getConfiguration() { + return getEndpoint().getConfiguration(); + } + + @Override + public String toString() { + if (eksProducerToString == null) { + eksProducerToString = "EKSProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]"; + } + return eksProducerToString; + } + + @Override + public TranslateEndpoint getEndpoint() { + return (TranslateEndpoint)super.getEndpoint(); + } + + private void translateText(AmazonTranslate translateClient, Exchange exchange) { + TranslateTextRequest request = new TranslateTextRequest(); + String source = exchange.getIn().getHeader(TranslateConstants.SOURCE_LANGUAGE, String.class); + String target = exchange.getIn().getHeader(TranslateConstants.TARGET_LANGUAGE, String.class); + if (ObjectHelper.isEmpty(source) || ObjectHelper.isEmpty(target)) { + throw new IllegalArgumentException("Source and target language must be specified"); + } + request.setSourceLanguageCode(source); + request.setTargetLanguageCode(target); + request.setText(exchange.getMessage().getBody(String.class)); + TranslateTextResult result; + try { + result = translateClient.translateText(request); + } catch (AmazonServiceException ase) { + log.trace("Translate Text command returned the error code {}", ase.getErrorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result.getTranslatedText()); + } + + public static Message getMessageForResponse(final Exchange exchange) { + if (exchange.getPattern().isOutCapable()) { + Message out = exchange.getOut(); + out.copyFrom(exchange.getIn()); + return out; + } + return exchange.getIn(); + } +} \ No newline at end of file diff --git a/components/camel-aws-translate/src/test/java/org/apache/camel/component/aws/translate/integration/TranslateProducerIntegrationTest.java b/components/camel-aws-translate/src/test/java/org/apache/camel/component/aws/translate/integration/TranslateProducerIntegrationTest.java new file mode 100644 index 0000000..74953f0 --- /dev/null +++ b/components/camel-aws-translate/src/test/java/org/apache/camel/component/aws/translate/integration/TranslateProducerIntegrationTest.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.aws.translate.integration; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.aws.translate.TranslateConstants; +import org.apache.camel.component.aws.translate.TranslateOperations; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Ignore; +import org.junit.Test; + +@Ignore("This test must be manually started, you need to specify AWS Credentials") +public class TranslateProducerIntegrationTest extends CamelTestSupport { + + @EndpointInject("mock:result") + private MockEndpoint mock; + + @Test + public void translateTextTest() throws Exception { + + mock.expectedMessageCount(1); + Exchange exchange = template.request("direct:translateText", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(TranslateConstants.OPERATION, TranslateOperations.translateText); + exchange.getIn().setHeader(TranslateConstants.SOURCE_LANGUAGE, "it"); + exchange.getIn().setHeader(TranslateConstants.TARGET_LANGUAGE, "de"); + exchange.getIn().setBody("Ciao Signorina"); + } + }); + + assertMockEndpointsSatisfied(); + + String resultGet = (String) exchange.getIn().getBody(); + assertEquals("Hallo, Miss.", resultGet); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:translateText") + .to("aws-translate://test?accessKey=RAW(xxxx)&secretKey=RAW(xxxx)®ion=EU_WEST_1&operation=translateText") + .to("mock:result"); + } + }; + } +} \ No newline at end of file diff --git a/components/camel-aws-translate/src/test/resources/log4j2.properties b/components/camel-aws-translate/src/test/resources/log4j2.properties new file mode 100644 index 0000000..bd64fd3 --- /dev/null +++ b/components/camel-aws-translate/src/test/resources/log4j2.properties @@ -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. +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-aws-eks-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file diff --git a/components/camel-aws-translate/src/test/resources/org/apache/camel/component/aws/eks/EKSComponentSpringTest-context.xml b/components/camel-aws-translate/src/test/resources/org/apache/camel/component/aws/eks/EKSComponentSpringTest-context.xml new file mode 100644 index 0000000..2b17b83 --- /dev/null +++ b/components/camel-aws-translate/src/test/resources/org/apache/camel/component/aws/eks/EKSComponentSpringTest-context.xml @@ -0,0 +1,50 @@ +<?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. + +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:listClusters"/> + <to uri="aws-eks://test?eksClient=#amazonEksClient&operation=listClusters"/> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:createCluster"/> + <to uri="aws-eks://test?eksClient=#amazonEksClient&operation=createCluster"/> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:deleteCluster"/> + <to uri="aws-eks://test?eksClient=#amazonEksClient&operation=deleteCluster"/> + <to uri="mock:result"/> + </route> + <route> + <from uri="direct:describeCluster"/> + <to uri="aws-eks://test?eksClient=#amazonEksClient&operation=describeCluster"/> + <to uri="mock:result"/> + </route> + </camelContext> + + <bean id="amazonEksClient" class="org.apache.camel.component.aws.eks.AmazonEKSClientMock"/> +</beans> \ No newline at end of file diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/TranslateEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/TranslateEndpointBuilderFactory.java new file mode 100644 index 0000000..6db5a7a --- /dev/null +++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/TranslateEndpointBuilderFactory.java @@ -0,0 +1,146 @@ +/* + * 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 javax.annotation.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * The aws-kms is used for managing Amazon EKS + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface TranslateEndpointBuilderFactory { + + + /** + * Builder for endpoint for the AWS Translate component. + */ + public interface TranslateEndpointBuilder extends EndpointProducerBuilder { + default AdvancedTranslateEndpointBuilder advanced() { + return (AdvancedTranslateEndpointBuilder) this; + } + /** + * The region in which EKS client needs to work. When using this + * parameter, the configuration will expect the capitalized name of the + * region (for example AP_EAST_1) You'll need to use the name + * Regions.EU_WEST_1.name(). + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default TranslateEndpointBuilder region(String region) { + doSetProperty("region", region); + return this; + } + } + + /** + * Advanced builder for endpoint for the AWS Translate component. + */ + public interface AdvancedTranslateEndpointBuilder + extends + EndpointProducerBuilder { + default TranslateEndpointBuilder basic() { + return (TranslateEndpointBuilder) this; + } + /** + * Whether the endpoint should use basic property binding (Camel 2.x) or + * the newer property binding with additional capabilities. + * + * The option is a: <code>boolean</code> type. + * + * Group: advanced + */ + default AdvancedTranslateEndpointBuilder basicPropertyBinding( + boolean basicPropertyBinding) { + doSetProperty("basicPropertyBinding", basicPropertyBinding); + return this; + } + /** + * Whether the endpoint should use basic property binding (Camel 2.x) or + * the newer property binding with additional capabilities. + * + * The option will be converted to a <code>boolean</code> type. + * + * Group: advanced + */ + default AdvancedTranslateEndpointBuilder basicPropertyBinding( + String basicPropertyBinding) { + doSetProperty("basicPropertyBinding", basicPropertyBinding); + return this; + } + /** + * Sets whether synchronous processing should be strictly used, or Camel + * is allowed to use asynchronous processing (if supported). + * + * The option is a: <code>boolean</code> type. + * + * Group: advanced + */ + default AdvancedTranslateEndpointBuilder synchronous(boolean synchronous) { + doSetProperty("synchronous", synchronous); + return this; + } + /** + * Sets whether synchronous processing should be strictly used, or Camel + * is allowed to use asynchronous processing (if supported). + * + * The option will be converted to a <code>boolean</code> type. + * + * Group: advanced + */ + default AdvancedTranslateEndpointBuilder synchronous(String synchronous) { + doSetProperty("synchronous", synchronous); + return this; + } + } + + /** + * Proxy enum for + * <code>org.apache.camel.component.aws.translate.TranslateOperations</code> + * enum. + */ + enum TranslateOperations { + translateText; + } + /** + * AWS Translate (camel-aws-translate) + * The aws-kms is used for managing Amazon EKS + * + * Category: cloud,management + * Available as of version: 3.0 + * Maven coordinates: org.apache.camel:camel-aws-translate + * + * Syntax: <code>aws-translate:label</code> + * + * Path parameter: label (required) + * Logical name + */ + default TranslateEndpointBuilder awsTranslate(String path) { + class TranslateEndpointBuilderImpl extends AbstractEndpointBuilder implements TranslateEndpointBuilder, AdvancedTranslateEndpointBuilder { + public TranslateEndpointBuilderImpl(String path) { + super("aws-translate", path); + } + } + return new TranslateEndpointBuilderImpl(path); + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/pom.xml b/platforms/spring-boot/components-starter/camel-aws-translate-starter/pom.xml new file mode 100644 index 0000000..635bd65 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/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>components-starter</artifactId> + <version>3.0.0-SNAPSHOT</version> + </parent> + <artifactId>camel-aws-translate-starter</artifactId> + <packaging>jar</packaging> + <name>Spring-Boot Starter :: Camel :: AWS Translate</name> + <description>Spring-Boot Starter for A Camel Amazon Translate Web Service Component</description> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot-version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-translate</artifactId> + <version>${project.version}</version> + <!--START OF GENERATED CODE--> + <exclusions> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + <!--END OF GENERATED CODE--> + </dependency> + <!--START OF GENERATED CODE--> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <!--END OF GENERATED CODE--> + </dependencies> +</project> diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentAutoConfiguration.java new file mode 100644 index 0000000..33c0e62 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentAutoConfiguration.java @@ -0,0 +1,128 @@ +/* + * 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.aws.eks.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.aws.eks.TranslateComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + TranslateComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + TranslateComponentConfiguration.class}) +public class TranslateComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(TranslateComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private TranslateComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<TranslateComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.aws-translate"); + } + } + + @Lazy + @Bean(name = "aws-translate-component") + @ConditionalOnMissingBean(TranslateComponent.class) + public TranslateComponent configureTranslateComponent() throws Exception { + TranslateComponent component = new TranslateComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + CamelPropertiesHelper.setCamelProperties(camelContext, + nestedProperty, nestedParameters, false); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + CamelPropertiesHelper.setCamelProperties(camelContext, component, + parameters, false); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<TranslateComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-translate.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-translate.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentConfiguration.java new file mode 100644 index 0000000..183775b --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/eks/springboot/TranslateComponentConfiguration.java @@ -0,0 +1,194 @@ +/* + * 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.aws.eks.springboot; + +import javax.annotation.Generated; +import com.amazonaws.services.translate.AmazonTranslate; +import org.apache.camel.component.aws.eks.TranslateOperations; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The aws-kms is used for managing Amazon EKS + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.aws-translate") +public class TranslateComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the aws-translate component. This + * is enabled by default. + */ + private Boolean enabled; + /** + * The AWS EKS default configuration + */ + private TranslateConfigurationNestedConfiguration configuration; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The region in which EKS client needs to work + */ + private String region; + /** + * Whether the component should use basic property binding (Camel 2.x) or + * the newer property binding with additional capabilities + */ + private Boolean basicPropertyBinding = false; + + public TranslateConfigurationNestedConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration( + TranslateConfigurationNestedConfiguration configuration) { + this.configuration = configuration; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public Boolean getBasicPropertyBinding() { + return basicPropertyBinding; + } + + public void setBasicPropertyBinding(Boolean basicPropertyBinding) { + this.basicPropertyBinding = basicPropertyBinding; + } + + public static class TranslateConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.aws.eks.TranslateConfiguration.class; + /** + * To use a existing configured AWS Translate as client + */ + private AmazonTranslate translateClient; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The operation to perform + */ + private TranslateOperations operation; + /** + * To define a proxy host when instantiating the EKS client + */ + private String proxyHost; + /** + * To define a proxy port when instantiating the EKS client + */ + private Integer proxyPort; + /** + * The region in which EKS client needs to work. When using this + * parameter, the configuration will expect the capitalized name of the + * region (for example AP_EAST_1) You'll need to use the name + * Regions.EU_WEST_1.name() + */ + private String region; + + public AmazonTranslate getTranslateClient() { + return translateClient; + } + + public void setTranslateClient(AmazonTranslate translateClient) { + this.translateClient = translateClient; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public TranslateOperations getOperation() { + return operation; + } + + public void setOperation(TranslateOperations operation) { + this.operation = operation; + } + + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentAutoConfiguration.java new file mode 100644 index 0000000..c710fd9 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentAutoConfiguration.java @@ -0,0 +1,128 @@ +/* + * 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.aws.translate.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.aws.translate.TranslateComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + TranslateComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + TranslateComponentConfiguration.class}) +public class TranslateComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(TranslateComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private TranslateComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<TranslateComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.aws-translate"); + } + } + + @Lazy + @Bean(name = "aws-translate-component") + @ConditionalOnMissingBean(TranslateComponent.class) + public TranslateComponent configureTranslateComponent() throws Exception { + TranslateComponent component = new TranslateComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + CamelPropertiesHelper.setCamelProperties(camelContext, + nestedProperty, nestedParameters, false); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + CamelPropertiesHelper.setCamelProperties(camelContext, component, + parameters, false); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<TranslateComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-translate.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.aws-translate.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentConfiguration.java new file mode 100644 index 0000000..18927e4 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/java/org/apache/camel/component/aws/translate/springboot/TranslateComponentConfiguration.java @@ -0,0 +1,194 @@ +/* + * 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.aws.translate.springboot; + +import javax.annotation.Generated; +import com.amazonaws.services.translate.AmazonTranslate; +import org.apache.camel.component.aws.translate.TranslateOperations; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The aws-kms is used for managing Amazon EKS + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.aws-translate") +public class TranslateComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether to enable auto configuration of the aws-translate component. This + * is enabled by default. + */ + private Boolean enabled; + /** + * The AWS EKS default configuration + */ + private TranslateConfigurationNestedConfiguration configuration; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The region in which EKS client needs to work + */ + private String region; + /** + * Whether the component should use basic property binding (Camel 2.x) or + * the newer property binding with additional capabilities + */ + private Boolean basicPropertyBinding = false; + + public TranslateConfigurationNestedConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration( + TranslateConfigurationNestedConfiguration configuration) { + this.configuration = configuration; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public Boolean getBasicPropertyBinding() { + return basicPropertyBinding; + } + + public void setBasicPropertyBinding(Boolean basicPropertyBinding) { + this.basicPropertyBinding = basicPropertyBinding; + } + + public static class TranslateConfigurationNestedConfiguration { + public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.aws.translate.TranslateConfiguration.class; + /** + * To use a existing configured AWS Translate as client + */ + private AmazonTranslate translateClient; + /** + * Amazon AWS Access Key + */ + private String accessKey; + /** + * Amazon AWS Secret Key + */ + private String secretKey; + /** + * The operation to perform + */ + private TranslateOperations operation; + /** + * To define a proxy host when instantiating the EKS client + */ + private String proxyHost; + /** + * To define a proxy port when instantiating the EKS client + */ + private Integer proxyPort; + /** + * The region in which EKS client needs to work. When using this + * parameter, the configuration will expect the capitalized name of the + * region (for example AP_EAST_1) You'll need to use the name + * Regions.EU_WEST_1.name() + */ + private String region; + + public AmazonTranslate getTranslateClient() { + return translateClient; + } + + public void setTranslateClient(AmazonTranslate translateClient) { + this.translateClient = translateClient; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public TranslateOperations getOperation() { + return operation; + } + + public void setOperation(TranslateOperations operation) { + this.operation = operation; + } + + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + } +} \ No newline at end of file diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/NOTICE.txt new file mode 100644 index 0000000..2e215bf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/NOTICE.txt @@ -0,0 +1,11 @@ + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == + == in this case for the Apache Camel distribution. == + ========================================================================= + + This product includes software developed by + The Apache Software Foundation (http://www.apache.org/). + + Please read the different LICENSE files present in the licenses directory of + this distribution. diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..5a8665b --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.aws.eks.springboot.TranslateComponentAutoConfiguration diff --git a/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.provides new file mode 100644 index 0000000..50a694d --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-aws-translate-starter/src/main/resources/META-INF/spring.provides @@ -0,0 +1,17 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +provides: camel-aws-translate diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml index 8aeb9dc..ada5bd8 100644 --- a/platforms/spring-boot/components-starter/pom.xml +++ b/platforms/spring-boot/components-starter/pom.xml @@ -132,6 +132,7 @@ <module>camel-aws-sns-starter</module> <module>camel-aws-sqs-starter</module> <module>camel-aws-swf-starter</module> + <module>camel-aws-translate-starter</module> <module>camel-aws-xray-starter</module> <module>camel-azure-starter</module> <module>camel-barcode-starter</module>