atiaomar1978-hub commented on code in PR #25433:
URL: https://github.com/apache/camel/pull/25433#discussion_r3768031014


##########
parent/pom.xml:
##########
@@ -80,7 +80,13 @@
         <avro-ipc-jetty-version>1.12.1</avro-ipc-jetty-version>
         <avro-ipc-netty-version>1.12.1</avro-ipc-netty-version>
         <awaitility-version>4.3.0</awaitility-version>
+<<<<<<< HEAD

Review Comment:
   Fixed — the merge conflict in `parent/pom.xml` was resolved and the branch 
has been rebased on current `main` (see commits `08dd1a2`, `9d890ace`, and 
latest `eb936edc`).
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-common/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/xsd/maven-4.0.0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-alibaba-parent</artifactId>
+        <version>4.22.0-SNAPSHOT</version>
+    </parent>
+
+    <properties>
+        <firstVersion>4.22.0</firstVersion>
+    </properties>
+
+    <artifactId>camel-alibaba-common</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Alibaba Cloud :: Common</name>
+    <description>Common utilities for Camel Alibaba Cloud 
components</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>

Review Comment:
   Fixed — the OSS SDK dependency was removed from `camel-alibaba-common`. 
Client creation now lives in `OSSUtils.createClient()` inside 
`camel-alibaba-oss`; the common module only contains shared `ServiceKeys`.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java:
##########
@@ -0,0 +1,240 @@
+/*
+ * 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.alibaba.oss;
+
+import com.aliyun.sdk.service.oss2.OSSClient;
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.alibaba.common.AlibabaClientBuilderUtil;
+import org.apache.camel.component.alibaba.common.models.ServiceKeys;
+import org.apache.camel.component.alibaba.oss.constants.OSSHeaders;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.apache.camel.util.ObjectHelper;
+
+/**
+ * Alibaba Cloud Object Storage Service (OSS) component
+ */
+@UriEndpoint(firstVersion = "4.22.0", scheme = "alibaba-oss", title = "Alibaba 
Object Storage Service (OSS)",
+             syntax = "alibaba-oss:operation",
+             category = { Category.CLOUD }, headersClass = OSSHeaders.class)
+public class OSSEndpoint extends ScheduledPollEndpoint {
+
+    @UriPath(description = "Operation to be performed", displayName = 
"Operation", label = "producer")
+    @Metadata(required = true)
+    private String operation;
+
+    @UriParam(description = "OSS service region", displayName = "Service 
region")
+    @Metadata(required = true)
+    private String region;
+
+    @UriParam(description = "OSS endpoint URL. Carries higher precedence than 
region based client initialization",
+              displayName = "Endpoint url")
+    private String endpoint;
+
+    @UriParam(description = "Configuration object for cloud service 
authentication", displayName = "Service Configuration",
+              security = "secret", label = "security")
+    private ServiceKeys serviceKeys;
+
+    @UriParam(description = "Access key for the cloud user", displayName = 
"API access key (AK)",
+              security = "secret", label = "security")
+    @Metadata(required = true)
+    private String accessKey;
+
+    @UriParam(description = "Secret key for the cloud user", displayName = 
"API secret key (SK)",
+              security = "secret", label = "security")
+    @Metadata(required = true)
+    private String secretKey;
+
+    @UriParam(description = "Name of bucket to perform operation on", 
displayName = "Bucket Name", endpointIdentity = true)
+    private String bucketName;
+
+    @UriParam(description = "Name of object to perform operation with", 
displayName = "Object Name")
+    private String objectName;
+
+    @UriParam(description = "The object name prefix used for filtering objects 
to be listed", displayName = "Prefix",
+              label = "consumer")
+    private String prefix;
+
+    @UriParam(description = "The maximum number of keys returned when listing 
objects", displayName = "Max Keys",
+              label = "consumer,producer")
+    private Integer maxKeys;
+
+    @UriParam(description = "Determines if objects should be deleted after 
they have been retrieved",
+              displayName = "Delete after read", defaultValue = "false", label 
= "consumer")
+    private boolean deleteAfterRead;
+
+    @UriParam(description = "The maximum number of messages to poll at each 
polling", displayName = "Maximum messages per poll",
+              defaultValue = "10", label = "consumer")
+    private int maxMessagesPerPoll = 10;
+
+    @UriParam(description = "An autowired OSS client", displayName = "OSS 
Client", label = "advanced")
+    @Metadata(autowired = true)
+    private OSSClient ossClient;
+
+    public OSSEndpoint() {
+    }
+
+    public OSSEndpoint(String uri, String operation, OSSComponent component) {
+        super(uri, component);
+        this.operation = operation;
+    }
+
+    public Producer createProducer() throws Exception {
+        return new OSSProducer(this);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        OSSConsumer consumer = new OSSConsumer(this, processor);
+        configureConsumer(consumer);
+        consumer.setMaxMessagesPerPoll(maxMessagesPerPoll);
+        return consumer;
+    }
+
+    /**
+     * Initialize and return an OSS client
+     */
+    public OSSClient initClient() {
+        if (ossClient != null) {
+            return ossClient;
+        }
+
+        if (ObjectHelper.isEmpty(getServiceKeys()) && 
ObjectHelper.isEmpty(getAccessKey())) {
+            throw new IllegalArgumentException("Authentication parameter 
'access key (AK)' not found");
+        }
+        if (ObjectHelper.isEmpty(getServiceKeys()) && 
ObjectHelper.isEmpty(getSecretKey())) {
+            throw new IllegalArgumentException("Authentication parameter 
'secret key (SK)' not found");
+        }
+        if (ObjectHelper.isEmpty(getRegion()) && 
ObjectHelper.isEmpty(getEndpoint())) {
+            throw new IllegalArgumentException("Region/endpoint not found");
+        }
+
+        String auth = getServiceKeys() != null ? 
getServiceKeys().getAccessKey() : getAccessKey();
+        String secret = getServiceKeys() != null ? 
getServiceKeys().getSecretKey() : getSecretKey();
+

Review Comment:
   Fixed — `initClient()` now assigns the created client to `this.ossClient` 
and returns the cached instance on subsequent calls. Non-autowired clients are 
closed in `doStop()`.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSComponent.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.alibaba.oss;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.HealthCheckComponent;
+
+@Component("alibaba-oss")
+public class OSSComponent extends HealthCheckComponent {
+
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {

Review Comment:
   Fixed — `@Override` has been added to `OSSComponent.createEndpoint()`.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
bom/camel-bom/pom.xml:
##########
@@ -66,6 +66,21 @@
         <artifactId>camel-ai-tool</artifactId>
         <version>4.23.0-SNAPSHOT</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-alibaba-common</artifactId>
+        <version>4.22.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-alibaba-mns</artifactId>
+        <version>4.22.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-alibaba-oss</artifactId>
+        <version>4.22.0-SNAPSHOT</version>
+      </dependency>

Review Comment:
   Fixed in `eb936edc` — all three alibaba BOM entries now use 
`4.23.0-SNAPSHOT`, matching `parent/pom.xml` and the module POMs.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java:
##########
@@ -0,0 +1,240 @@
+/*
+ * 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.alibaba.oss;
+
+import com.aliyun.sdk.service.oss2.OSSClient;
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.alibaba.common.models.ServiceKeys;
+import org.apache.camel.component.alibaba.oss.constants.OSSHeaders;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.ScheduledPollEndpoint;
+
+/**
+ * Alibaba Cloud Object Storage Service (OSS) component
+ */
+@UriEndpoint(firstVersion = "4.23.0", scheme = "alibaba-oss", title = "Alibaba 
Object Storage Service (OSS)",
+             syntax = "alibaba-oss:operation",
+             category = { Category.CLOUD }, headersClass = OSSHeaders.class)
+public class OSSEndpoint extends ScheduledPollEndpoint {
+
+    @UriPath(description = "Operation to be performed", displayName = 
"Operation", label = "producer")
+    @Metadata(required = true)
+    private String operation;
+
+    @UriParam(description = "OSS service region", displayName = "Service 
region")
+    @Metadata(required = true)
+    private String region;
+
+    @UriParam(description = "OSS endpoint URL. Carries higher precedence than 
region based client initialization",
+              displayName = "Endpoint url")
+    private String endpoint;
+
+    @UriParam(description = "Configuration object for cloud service 
authentication", displayName = "Service Configuration",
+              security = "secret", label = "security")
+    private ServiceKeys serviceKeys;
+
+    @UriParam(description = "Access key for the cloud user", displayName = 
"API access key (AK)",
+              security = "secret", label = "security")
+    @Metadata(required = true)
+    private String accessKey;

Review Comment:
   Fixed in `eb936edc` — `accessKey`, `secretKey`, and `serviceKeys` on 
`OSSEndpoint` now use `secret = true`, `security = "secret"`, and `label = 
"security"` so credentials are masked in logs/JMX as well as covered by the 
security policy framework.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java:
##########
@@ -0,0 +1,377 @@
+/*
+ * 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.alibaba.oss;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.aliyun.sdk.service.oss2.OSSClient;
+import com.aliyun.sdk.service.oss2.models.BucketSummary;
+import com.aliyun.sdk.service.oss2.models.CopyObjectRequest;
+import com.aliyun.sdk.service.oss2.models.CopyObjectResult;
+import com.aliyun.sdk.service.oss2.models.DeleteObjectRequest;
+import com.aliyun.sdk.service.oss2.models.DeleteObjectResult;
+import com.aliyun.sdk.service.oss2.models.GetObjectRequest;
+import com.aliyun.sdk.service.oss2.models.GetObjectResult;
+import com.aliyun.sdk.service.oss2.models.HeadObjectRequest;
+import com.aliyun.sdk.service.oss2.models.HeadObjectResult;
+import com.aliyun.sdk.service.oss2.models.ListBucketsRequest;
+import com.aliyun.sdk.service.oss2.models.ListBucketsResult;
+import com.aliyun.sdk.service.oss2.models.ListObjectsRequest;
+import com.aliyun.sdk.service.oss2.models.ListObjectsResult;
+import com.aliyun.sdk.service.oss2.models.ObjectSummary;
+import com.aliyun.sdk.service.oss2.models.PutObjectRequest;
+import com.aliyun.sdk.service.oss2.models.PutObjectResult;
+import com.aliyun.sdk.service.oss2.transport.BinaryData;
+import com.google.gson.Gson;
+import org.apache.camel.Exchange;
+import org.apache.camel.WrappedFile;
+import org.apache.camel.component.alibaba.oss.constants.OSSOperations;
+import org.apache.camel.component.alibaba.oss.constants.OSSProperties;
+import org.apache.camel.component.alibaba.oss.models.ClientConfigurations;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OSSProducer extends DefaultProducer {
+    private static final Logger LOG = 
LoggerFactory.getLogger(OSSProducer.class);
+
+    private final OSSEndpoint endpoint;
+    private OSSClient ossClient;
+    private Gson gson;
+
+    public OSSProducer(OSSEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected void doInit() throws Exception {
+        super.doInit();
+        this.gson = new Gson();
+    }
+
+    @Override
+    public void process(Exchange exchange) throws Exception {
+        ClientConfigurations clientConfigurations = new ClientConfigurations();
+
+        if (ossClient == null) {
+            this.ossClient = endpoint.initClient();
+        }
+

Review Comment:
   Fixed in `eb936edc` — runtime overrides are resolved in 
`OSSUtils.createClientConfigurations()`, which checks message **headers** 
first, then exchange properties as fallback, then endpoint/URI defaults. Tests 
and docs updated to use headers.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



##########
components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java:
##########
@@ -0,0 +1,377 @@
+/*
+ * 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.alibaba.oss;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.aliyun.sdk.service.oss2.OSSClient;
+import com.aliyun.sdk.service.oss2.models.BucketSummary;
+import com.aliyun.sdk.service.oss2.models.CopyObjectRequest;
+import com.aliyun.sdk.service.oss2.models.CopyObjectResult;
+import com.aliyun.sdk.service.oss2.models.DeleteObjectRequest;
+import com.aliyun.sdk.service.oss2.models.DeleteObjectResult;
+import com.aliyun.sdk.service.oss2.models.GetObjectRequest;
+import com.aliyun.sdk.service.oss2.models.GetObjectResult;
+import com.aliyun.sdk.service.oss2.models.HeadObjectRequest;
+import com.aliyun.sdk.service.oss2.models.HeadObjectResult;
+import com.aliyun.sdk.service.oss2.models.ListBucketsRequest;
+import com.aliyun.sdk.service.oss2.models.ListBucketsResult;
+import com.aliyun.sdk.service.oss2.models.ListObjectsRequest;
+import com.aliyun.sdk.service.oss2.models.ListObjectsResult;
+import com.aliyun.sdk.service.oss2.models.ObjectSummary;
+import com.aliyun.sdk.service.oss2.models.PutObjectRequest;
+import com.aliyun.sdk.service.oss2.models.PutObjectResult;
+import com.aliyun.sdk.service.oss2.transport.BinaryData;
+import com.google.gson.Gson;
+import org.apache.camel.Exchange;
+import org.apache.camel.WrappedFile;
+import org.apache.camel.component.alibaba.oss.constants.OSSOperations;
+import org.apache.camel.component.alibaba.oss.constants.OSSProperties;
+import org.apache.camel.component.alibaba.oss.models.ClientConfigurations;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OSSProducer extends DefaultProducer {
+    private static final Logger LOG = 
LoggerFactory.getLogger(OSSProducer.class);
+
+    private final OSSEndpoint endpoint;
+    private OSSClient ossClient;
+    private Gson gson;
+
+    public OSSProducer(OSSEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    protected void doInit() throws Exception {
+        super.doInit();
+        this.gson = new Gson();
+    }
+

Review Comment:
   Fixed in `eb936edc` — Gson was removed. Producer operations now return 
structured `Map<String, Object>` or `List<Map<String, Object>>` bodies. Tests 
assert on map entries instead of JSON strings.
   
   _AI-generated reply on behalf of atiaomar1978-hub_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to