You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/01/31 11:59:27 UTC
[camel] branch main updated: Camel 17573-Upgrade HuaweiCloud SDK version to 3.0.76 & Fix some code issues (#6859)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a7ba2ee Camel 17573-Upgrade HuaweiCloud SDK version to 3.0.76 & Fix some code issues (#6859)
a7ba2ee is described below
commit a7ba2eef91f645bd56bfb8d22047fbde0b2c9c87
Author: Hokutor <hw...@huawei.com>
AuthorDate: Mon Jan 31 19:58:52 2022 +0800
Camel 17573-Upgrade HuaweiCloud SDK version to 3.0.76 & Fix some code issues (#6859)
* CAMEL-17321: Add HuaweiCloud FaceRecognitionService(FRS) Component
Co-Authored-By: Reji Mathews <co...@gmail.com>
Co-Authored-By: lyndonmiao <ly...@qq.com>
* CAMEL-17573: Upgeade HuaweiCloud SDK version to 3.0.76 & Fix some code issues
Co-Authored-By: lyndonmiao <ly...@qq.com>
* CAMEL-17573: Upgeade HuaweiCloud SDK version to 3.0.76 & Fix some code issues
Co-Authored-By: lyndonmiao <ly...@qq.com>
Co-authored-by: Reji Mathews <co...@gmail.com>
Co-authored-by: lyndonmiao <ly...@qq.com>
---
.../huaweicloud/frs/FaceRecognitionProducer.java | 24 +++-------------------
.../image/ImageRecognitionProducer.java | 5 -----
parent/pom.xml | 2 +-
3 files changed, 4 insertions(+), 27 deletions(-)
diff --git a/components/camel-huawei/camel-huaweicloud-frs/src/main/java/org/apache/camel/component/huaweicloud/frs/FaceRecognitionProducer.java b/components/camel-huawei/camel-huaweicloud-frs/src/main/java/org/apache/camel/component/huaweicloud/frs/FaceRecognitionProducer.java
index dc5f87b..0ff0115 100644
--- a/components/camel-huawei/camel-huaweicloud-frs/src/main/java/org/apache/camel/component/huaweicloud/frs/FaceRecognitionProducer.java
+++ b/components/camel-huawei/camel-huaweicloud-frs/src/main/java/org/apache/camel/component/huaweicloud/frs/FaceRecognitionProducer.java
@@ -168,7 +168,7 @@ public class FaceRecognitionProducer extends DefaultProducer {
* @param exchange camel exchange
*/
private void performFaceDetectionOperation(Exchange exchange, ClientConfigurations clientConfigurations) {
- updateClientConfigurations(exchange, clientConfigurations);
+ updateFaceDetectionConfigurations(exchange, clientConfigurations);
SdkResponse result;
if (!StringUtils.isEmpty(clientConfigurations.getImageBase64())) {
FaceDetectBase64Req reqBody = new FaceDetectBase64Req().withImageBase64(clientConfigurations.getImageBase64());
@@ -196,7 +196,7 @@ public class FaceRecognitionProducer extends DefaultProducer {
* @param exchange camel exchange
*/
private void performFaceVerificationOperation(Exchange exchange, ClientConfigurations clientConfigurations) {
- updateClientConfigurations(exchange, clientConfigurations);
+ updateFaceVerificationConfigurations(exchange, clientConfigurations);
SdkResponse result;
if (!StringUtils.isEmpty(clientConfigurations.getImageBase64())
@@ -232,7 +232,7 @@ public class FaceRecognitionProducer extends DefaultProducer {
* @param exchange camel exchange
*/
private void performLiveDetectOperation(Exchange exchange, ClientConfigurations clientConfigurations) {
- updateClientConfigurations(exchange, clientConfigurations);
+ updateLiveDetectConfigurations(exchange, clientConfigurations);
SdkResponse result;
if (!StringUtils.isEmpty(clientConfigurations.getVideoBase64())) {
LiveDetectBase64Req reqBody = new LiveDetectBase64Req().withVideoBase64(clientConfigurations.getVideoBase64())
@@ -265,24 +265,6 @@ public class FaceRecognitionProducer extends DefaultProducer {
return file;
}
- /**
- * Update dynamic client configurations. Some endpoint parameters (imageContent, imageUrl, tagLanguage, tagLimit and
- * threshold) can also be passed via exchange properties, so they can be updated between each transaction. Since
- * they can change, we must clear the previous transaction and update these parameters with their new values
- *
- * @param exchange camel exchange
- * @param clientConfigurations frs client configurations
- */
- private void updateClientConfigurations(Exchange exchange, ClientConfigurations clientConfigurations) {
- if (FaceRecognitionConstants.OPERATION_FACE_DETECTION.equals(endpoint.getOperation())) {
- updateFaceDetectionConfigurations(exchange, clientConfigurations);
- } else if (FaceRecognitionConstants.OPERATION_FACE_VERIFICATION.equals(endpoint.getOperation())) {
- updateFaceVerificationConfigurations(exchange, clientConfigurations);
- } else if (FaceRecognitionConstants.OPERATION_FACE_LIVE_DETECT.equals(endpoint.getOperation())) {
- updateLiveDetectConfigurations(exchange, clientConfigurations);
- }
- }
-
private void updateFaceDetectionConfigurations(Exchange exchange, ClientConfigurations clientConfigurations) {
boolean isImageBase64Set = true;
boolean isImageUrlSet = true;
diff --git a/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/java/org/apache/camel/component/huaweicloud/image/ImageRecognitionProducer.java b/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/java/org/apache/camel/component/huaweicloud/image/ImageRecognitionProducer.java
index d0fc443..6669f39 100644
--- a/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/java/org/apache/camel/component/huaweicloud/image/ImageRecognitionProducer.java
+++ b/components/camel-huawei/camel-huaweicloud-imagerecognition/src/main/java/org/apache/camel/component/huaweicloud/image/ImageRecognitionProducer.java
@@ -66,11 +66,6 @@ public class ImageRecognitionProducer extends DefaultProducer {
clientConfigurations.setProjectId(getProjectId(endpoint));
clientConfigurations.setEndpoint(getEndpoint(endpoint));
- if (StringUtils.isEmpty(endpoint.getImageContent()) && StringUtils.isEmpty(endpoint.getImageUrl())) {
- if (StringUtils.isEmpty(endpoint.getRegion())) {
- throw new IllegalArgumentException("either image or url should be set");
- }
- }
clientConfigurations.setIgnoreSslVerification(endpoint.isIgnoreSslVerification());
if (clientConfigurations.isIgnoreSslVerification()) {
LOG.warn("SSL verification is ignored. This is unsafe in production environment");
diff --git a/parent/pom.xml b/parent/pom.xml
index 1bffdbb..fe334cf 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -246,7 +246,7 @@
<httpclient4-version>4.5.13</httpclient4-version>
<httpasyncclient-version>4.1.5</httpasyncclient-version>
<huaweicloud-obs-version>3.21.4.1</huaweicloud-obs-version>
- <huaweicloud-sdk-version>3.0.59</huaweicloud-sdk-version>
+ <huaweicloud-sdk-version>3.0.76</huaweicloud-sdk-version>
<hystrix-version>1.5.18</hystrix-version>
<ical4j-version>1.0.7</ical4j-version>
<icu4j-version>70.1</icu4j-version>