You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/29 16:59:48 UTC
[camel] 05/12: CAMEL-17792: Add doc about the message headers of camel-huaweicloud-obs
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 891023776436ee1edd50857f0e84201ea83c7d0f
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 29 14:52:40 2022 +0200
CAMEL-17792: Add doc about the message headers of camel-huaweicloud-obs
---
.../component/huaweicloud/obs/hwcloud-obs.json | 11 ++++++++
.../src/main/docs/hwcloud-obs-component.adoc | 31 +++-------------------
.../component/huaweicloud/obs/OBSEndpoint.java | 3 ++-
.../camel/component/huaweicloud/obs/OBSUtils.java | 6 ++---
.../huaweicloud/obs/constants/OBSHeaders.java | 19 +++++++++++++
5 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
index 2ee0389..2eb031d 100644
--- a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
+++ b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
@@ -26,6 +26,17 @@
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
"autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
},
+ "headers": {
+ "CamelHwCloudObsBucketName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the bucket where object is contained" },
+ "CamelHwCloudObsObjectKey": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The key that the object is stored under" },
+ "CamelHwCloudObsLastModified": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The date and time that the object was last modified" },
+ "CamelHwCloudObsETag": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The 128-bit MD5 digest of the Base64 code of the object. This data is the unique identifier of the object content" },
+ "CamelHwCloudObsContentMD5": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The 128-bit Base64-encoded digest used to decrypt the object" },
+ "CamelHwCloudObsObjectType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Shows whether the object is a `file` or a `folder`" },
+ "Content-Length": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The size of the object body in bytes" },
+ "Content-Type": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of content stored in the object" },
+ "CamelFileName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of the object with which the operation is to be performed" }
+ },
"properties": {
"operation": { "kind": "path", "displayName": "Operation", "group": "producer", "label": "producer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Operation to be performed" },
"bucketName": { "kind": "parameter", "displayName": "Bucket Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of bucket to perform operation on" },
diff --git a/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc b/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
index be48239..e915a57 100644
--- a/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
+++ b/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
@@ -79,32 +79,9 @@ If any of the above properties are set, they will override their corresponding q
|=======================================================================
-=== Message headers set by the OBS consumer
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|`CamelHwCloudObsBucketName` |`String` | Name of the bucket where object is contained
-
-|`CamelHwCloudObsObjectName` |`String` | Name of the object with which the operation is to be performed
-
-|`CamelHwCloudObsObjectKey` |`String` | The key that the object is stored under
-
-|`CamelHwCloudObsLastModified` |`String` | The date and time that the object was last modified
-
-|`Content-Length` |`String` | The size of the object body in bytes
-
-|`Content-Type` |`String` | The type of content stored in the object
-
-|`CamelHwCloudObsETag` |`String` | The 128-bit MD5 digest of the Base64 code of the object. This data is the unique identifier of the object content
-
-|`CamelHwCloudObsContentMD5` |`String` | The 128-bit Base64-encoded digest used to decrypt the object
-
-|`CamelHwCloudObsObjectType` |`String` | Shows whether the object is a `file` or a `folder`
-
-|=======================================================================
-
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
== List of Supported OBS Operations
@@ -173,7 +150,7 @@ Check the following code snippets:
from("direct:triggerRoute")
.setProperty(OBSPropeties.OPERATION, constant("createBucket"))
.setProperty(OBSPropeties.BUCKET_NAME ,constant("your_bucket_name"))
- .setProperty(OBSPropeties.BUCKET_LOCATION, constant("your_bucket_location))
+ .setProperty(OBSPropeties.BUCKET_LOCATION, constant("your_bucket_location"))
.to("hwcloud-obs:createBucket?region=cn-north-4&serviceKeys=#myServiceKeyConfig")
----
diff --git a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
index e56a7f9..02068d7 100644
--- a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
+++ b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
@@ -24,6 +24,7 @@ import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.huaweicloud.obs.constants.OBSHeaders;
import org.apache.camel.component.huaweicloud.obs.models.OBSRegion;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
@@ -37,7 +38,7 @@ import org.apache.camel.util.ObjectHelper;
*/
@UriEndpoint(firstVersion = "3.12.0", scheme = "hwcloud-obs", title = "Huawei Object Storage Service (OBS)",
syntax = "hwcloud-obs:operation",
- category = { Category.CLOUD })
+ category = { Category.CLOUD }, headersClass = OBSHeaders.class)
public class OBSEndpoint extends ScheduledPollEndpoint {
@UriPath(description = "Operation to be performed", displayName = "Operation", label = "producer")
diff --git a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSUtils.java b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSUtils.java
index ba4b22c..c984671 100644
--- a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSUtils.java
+++ b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSUtils.java
@@ -65,12 +65,12 @@ public final class OBSUtils {
message.setHeader(OBSHeaders.BUCKET_NAME, obsObject.getBucketName());
message.setHeader(OBSHeaders.OBJECT_KEY, obsObject.getObjectKey());
message.setHeader(OBSHeaders.LAST_MODIFIED, obsObject.getMetadata().getLastModified());
- message.setHeader(Exchange.CONTENT_LENGTH, obsObject.getMetadata().getContentLength());
- message.setHeader(Exchange.CONTENT_TYPE, obsObject.getMetadata().getContentType());
+ message.setHeader(OBSHeaders.CONTENT_LENGTH, obsObject.getMetadata().getContentLength());
+ message.setHeader(OBSHeaders.CONTENT_TYPE, obsObject.getMetadata().getContentType());
message.setHeader(OBSHeaders.ETAG, obsObject.getMetadata().getEtag());
message.setHeader(OBSHeaders.CONTENT_MD5, obsObject.getMetadata().getContentMd5());
- message.setHeader(Exchange.FILE_NAME, obsObject.getObjectKey());
+ message.setHeader(OBSHeaders.FILE_NAME, obsObject.getObjectKey());
if (obsObject.getObjectKey().endsWith("/")) {
message.setHeader(OBSHeaders.OBJECT_TYPE, OBSConstants.FOLDER);
diff --git a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSHeaders.java b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSHeaders.java
index d14542f..b67ae98 100644
--- a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSHeaders.java
+++ b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSHeaders.java
@@ -16,16 +16,35 @@
*/
package org.apache.camel.component.huaweicloud.obs.constants;
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.Metadata;
+
/**
* Constants for the exchange headers when consuming objects
*/
public final class OBSHeaders {
+ @Metadata(label = "consumer", description = "Name of the bucket where object is contained", javaType = "String")
public static final String BUCKET_NAME = "CamelHwCloudObsBucketName";
+ @Metadata(label = "consumer", description = "The key that the object is stored under", javaType = "String")
public static final String OBJECT_KEY = "CamelHwCloudObsObjectKey";
+ @Metadata(label = "consumer", description = "The date and time that the object was last modified", javaType = "Date")
public static final String LAST_MODIFIED = "CamelHwCloudObsLastModified";
+ @Metadata(label = "consumer", description = "The 128-bit MD5 digest of the Base64 code of the object. " +
+ "This data is the unique identifier of the object content",
+ javaType = "String")
public static final String ETAG = "CamelHwCloudObsETag";
+ @Metadata(label = "consumer", description = "The 128-bit Base64-encoded digest used to decrypt the object",
+ javaType = "String")
public static final String CONTENT_MD5 = "CamelHwCloudObsContentMD5";
+ @Metadata(label = "consumer", description = "Shows whether the object is a `file` or a `folder`", javaType = "String")
public static final String OBJECT_TYPE = "CamelHwCloudObsObjectType";
+ @Metadata(label = "consumer", description = "The size of the object body in bytes", javaType = "Long")
+ public static final String CONTENT_LENGTH = Exchange.CONTENT_LENGTH;
+ @Metadata(label = "consumer", description = "The type of content stored in the object", javaType = "String")
+ public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE;
+ @Metadata(label = "consumer", description = "Name of the object with which the operation is to be performed",
+ javaType = "String")
+ public static final String FILE_NAME = Exchange.FILE_NAME;
private OBSHeaders() {
}