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/22 16:51:52 UTC

[camel] 03/14: CAMEL-17792: Add doc about the message headers of camel-git

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 8d51a57e3f3348899b236d60b70f5193abce8636
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 22 11:46:01 2022 +0100

    CAMEL-17792: Add doc about the message headers of camel-git
---
 .../org/apache/camel/component/git/git.json        | 14 ++++++++++++
 .../camel-git/src/main/docs/git-component.adoc     | 25 +++-------------------
 .../apache/camel/component/git/GitConstants.java   | 15 +++++++++++++
 .../apache/camel/component/git/GitEndpoint.java    |  3 ++-
 4 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/components/camel-git/src/generated/resources/org/apache/camel/component/git/git.json b/components/camel-git/src/generated/resources/org/apache/camel/component/git/git.json
index a1c4ad9..db79f1a 100644
--- a/components/camel-git/src/generated/resources/org/apache/camel/component/git/git.json
+++ b/components/camel-git/src/generated/resources/org/apache/camel/component/git/git.json
@@ -26,6 +26,20 @@
     "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": {
+    "CamelGitOperation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to do on a repository, if not specified as endpoint option" },
+    "CamelGitFilename": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The file name in an add operation" },
+    "CamelGitCommitMessage": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit message related in a commit operation" },
+    "CamelGitCommitUsername": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit username in a commit operation" },
+    "CamelGitCommitEmail": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit email in a commit operation" },
+    "CamelGitCommitId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit id" },
+    "CamelGitAllowEmpty": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag to manage empty git commits" },
+    "CamelGitAuthorName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The author name" },
+    "CamelGitCommiterName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The committer name" },
+    "CamelGitCommitTime": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit time" },
+    "CamelGitBranchLeaf": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The leaf" },
+    "CamelGitBranchObjectId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The object id" }
+  },
   "properties": {
     "localPath": { "kind": "path", "displayName": "Local Path", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Local repository path" },
     "branchName": { "kind": "parameter", "displayName": "Branch Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The branch name to work on" },
diff --git a/components/camel-git/src/main/docs/git-component.adoc b/components/camel-git/src/main/docs/git-component.adoc
index 51a377f..0080cad 100644
--- a/components/camel-git/src/main/docs/git-component.adoc
+++ b/components/camel-git/src/main/docs/git-component.adoc
@@ -51,28 +51,9 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
-
-== Message Headers
-
-[width="100%",cols="10%,10%,10%,20%,50%",options="header",]
-|=======================================================================
-|Name |Default Value |Type |Context |Description
-
-|CamelGitOperation |`null` |String |Producer |The operation to do on a repository, if not specified as endpoint option
-
-|CamelGitFilename |`null` |String |Producer |The file name in an add operation
-
-|CamelGitCommitMessage |`null` |String |Producer |The commit message related in a commit operation
-
-|CamelGitCommitUsername |`null` |String |Producer |The commit username in a commit operation
-
-|CamelGitCommitEmail |`null` |String |Producer |The commit email in a commit operation
-
-|CamelGitCommitId |`null` |String |Producer |The commit id
-
-|CamelGitAllowEmpty |`null` |Boolean |Producer |The flag to manage empty git commits
-
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 == Producer Example
 
diff --git a/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java b/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
index 7894c9c..4905bd0 100644
--- a/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
+++ b/components/camel-git/src/main/java/org/apache/camel/component/git/GitConstants.java
@@ -16,18 +16,33 @@
  */
 package org.apache.camel.component.git;
 
+import org.apache.camel.spi.Metadata;
+
 public interface GitConstants {
+    @Metadata(label = "producer", description = "The operation to do on a repository, if not specified as endpoint option",
+              javaType = "String")
     String GIT_OPERATION = "CamelGitOperation";
+    @Metadata(label = "producer", description = "The file name in an add operation", javaType = "String")
     String GIT_FILE_NAME = "CamelGitFilename";
+    @Metadata(label = "producer", description = "The commit message related in a commit operation", javaType = "String")
     String GIT_COMMIT_MESSAGE = "CamelGitCommitMessage";
+    @Metadata(label = "producer", description = "The commit username in a commit operation", javaType = "String")
     String GIT_COMMIT_USERNAME = "CamelGitCommitUsername";
+    @Metadata(label = "producer", description = "The commit email in a commit operation", javaType = "String")
     String GIT_COMMIT_EMAIL = "CamelGitCommitEmail";
+    @Metadata(description = "The commit id", javaType = "String")
     String GIT_COMMIT_ID = "CamelGitCommitId";
+    @Metadata(label = "producer", description = "The flag to manage empty git commits", javaType = "Boolean")
     String GIT_ALLOW_EMPTY = "CamelGitAllowEmpty";
+    @Metadata(label = "consumer", description = "The author name", javaType = "String")
     String GIT_COMMIT_AUTHOR_NAME = "CamelGitAuthorName";
+    @Metadata(label = "consumer", description = "The committer name", javaType = "String")
     String GIT_COMMIT_COMMITTER_NAME = "CamelGitCommiterName";
+    @Metadata(label = "consumer", description = "The commit time", javaType = "int")
     String GIT_COMMIT_TIME = "CamelGitCommitTime";
+    @Metadata(label = "consumer", description = "The leaf", javaType = "String")
     String GIT_BRANCH_LEAF = "CamelGitBranchLeaf";
+    @Metadata(label = "consumer", description = "The object id", javaType = "String")
     String GIT_BRANCH_OBJECT_ID = "CamelGitBranchObjectId";
     String GIT_TAG_LEAF = "CamelGitTagLeaf";
     String GIT_TAG_OBJECT_ID = "CamelGitTagObjectId";
diff --git a/components/camel-git/src/main/java/org/apache/camel/component/git/GitEndpoint.java b/components/camel-git/src/main/java/org/apache/camel/component/git/GitEndpoint.java
index 6fc0643..bccd4ce 100644
--- a/components/camel-git/src/main/java/org/apache/camel/component/git/GitEndpoint.java
+++ b/components/camel-git/src/main/java/org/apache/camel/component/git/GitEndpoint.java
@@ -34,7 +34,8 @@ import org.apache.camel.support.DefaultEndpoint;
 /**
  * Perform operations on git repositories.
  */
-@UriEndpoint(firstVersion = "2.16.0", scheme = "git", title = "Git", syntax = "git:localPath", category = { Category.FILE })
+@UriEndpoint(firstVersion = "2.16.0", scheme = "git", title = "Git", syntax = "git:localPath", category = { Category.FILE },
+             headersClass = GitConstants.class)
 public class GitEndpoint extends DefaultEndpoint {
 
     @UriPath