This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2a041878c09d3fc18cf818949f1623cc67f1c434 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Sep 20 13:31:56 2020 +0200 CAMEL-15549: Api components now have details about APIs being consumer or producer only. --- .../apache/camel/catalog/docs/box-component.adoc | 64 ++++++++++++++++++---- components/camel-box/camel-box-component/pom.xml | 19 +++++-- ...CollaborationsManagerEndpointConfiguration.java | 3 +- .../BoxCommentsManagerEndpointConfiguration.java | 3 +- .../BoxEventLogsManagerEndpointConfiguration.java | 3 +- .../box/BoxEventsManagerEndpointConfiguration.java | 3 +- .../box/BoxFilesManagerEndpointConfiguration.java | 3 +- .../BoxFoldersManagerEndpointConfiguration.java | 3 +- .../box/BoxGroupsManagerEndpointConfiguration.java | 3 +- .../box/BoxSearchManagerEndpointConfiguration.java | 3 +- .../box/BoxTasksManagerEndpointConfiguration.java | 3 +- .../box/BoxUsersManagerEndpointConfiguration.java | 3 +- .../org/apache/camel/component/box/box.json | 40 +++++++------- .../src/main/docs/box-component.adoc | 64 ++++++++++++++++++---- .../apache/camel/component/box/BoxEndpoint.java | 10 ++-- .../java/org/apache/camel/spi/ApiParams.java | 14 +++++ .../modules/ROOT/pages/box-component.adoc | 64 ++++++++++++++++++---- .../org/apache/camel/tooling/model/ApiModel.java | 18 ++++++ .../org/apache/camel/tooling/model/JsonMapper.java | 30 ++++++---- .../maven/AbstractApiMethodGeneratorMojo.java | 8 +++ .../camel/maven/ApiComponentGeneratorMojo.java | 2 + .../main/java/org/apache/camel/maven/ApiProxy.java | 28 ++++++---- .../src/main/resources/api-endpoint-config.vm | 3 +- .../packaging/EndpointSchemaGeneratorMojo.java | 6 ++ .../apache/camel/maven/packaging/MvelHelper.java | 10 ++++ .../src/main/resources/endpoint-options.mvel | 14 ++++- .../main/java/org/apache/camel/spi/ApiParams.java | 14 +++++ 27 files changed, 338 insertions(+), 100 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/box-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/box-component.adoc index 4958561..fd30ada 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/box-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/box-component.adoc @@ -148,19 +148,19 @@ box:apiName/methodName There are 10 API names as listed in the table below: -[width="100%",cols="2,8",options="header"] +[width="100%",cols="2,1,7",options="header"] |=== -| API Name | Description -| *collaborations* | Provides operations to manage Box collaborations -| *comments* | Provides operations to manage Box comments -| *event-logs* | Provides operations to read Box enterprise (admin) event logs -| *events* | Provides operations to manage Box events -| *files* | Provides operations to manage Box files -| *folders* | Provides operations to manage Box folders -| *groups* | Provides operations to manage Box groups -| *search* | Provides operations to manage Box searches -| *tasks* | Provides operations to manage Box tasks -| *users* | Provides operations to manage Box users +| API Name | Type | Description +| *collaborations* | Producer | Provides operations to manage Box collaborations +| *comments* | Producer | Provides operations to manage Box comments +| *event-logs* | Producer | Provides operations to read Box enterprise (admin) event logs +| *events* | Consumer | Provides operations to manage Box events +| *files* | Producer | Provides operations to manage Box files +| *folders* | Producer | Provides operations to manage Box folders +| *groups* | Producer | Provides operations to manage Box groups +| *search* | Producer | Provides operations to manage Box searches +| *tasks* | Producer | Provides operations to manage Box tasks +| *users* | Producer | Provides operations to manage Box users |=== Each API is documented in the following sections to come. @@ -168,6 +168,10 @@ Each API is documented in the following sections to come. ==== API: collaborations +*Only producer is supported* + + + The collaborations API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -238,6 +242,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: comments +*Only producer is supported* + + + The comments API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -306,6 +314,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: event-logs +*Only producer is supported* + + + The event-logs API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -354,6 +366,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: events +*Only consumer is supported* + + + The events API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -399,6 +415,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: files +*Only producer is supported* + + + The files API has 22 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -569,6 +589,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: folders +*Only producer is supported* + + + The folders API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -667,6 +691,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: groups +*Only producer is supported* + + + The groups API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -753,6 +781,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: search +*Only producer is supported* + + + The search API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -799,6 +831,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: tasks +*Only producer is supported* + + + The tasks API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -881,6 +917,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: users +*Only producer is supported* + + + The users API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): diff --git a/components/camel-box/camel-box-component/pom.xml b/components/camel-box/camel-box-component/pom.xml index ca674ec..00df11f 100644 --- a/components/camel-box/camel-box-component/pom.xml +++ b/components/camel-box/camel-box-component/pom.xml @@ -119,6 +119,7 @@ <apiName>collaborations</apiName> <proxyClass>org.apache.camel.component.box.api.BoxCollaborationsManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>addFolderCollaboration</methodPattern> @@ -154,6 +155,7 @@ <apiName>comments</apiName> <proxyClass>org.apache.camel.component.box.api.BoxCommentsManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>addFileComment</methodPattern> @@ -185,6 +187,7 @@ <apiName>event-logs</apiName> <proxyClass>org.apache.camel.component.box.api.BoxEventLogsManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>getEnterpriseEvents</methodPattern> @@ -200,6 +203,7 @@ <apiName>files</apiName> <proxyClass>org.apache.camel.component.box.api.BoxFilesManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>uploadFile</methodPattern> @@ -310,8 +314,8 @@ <api> <apiName>folders</apiName> <proxyClass>org.apache.camel.component.box.api.BoxFoldersManager</proxyClass> - <fromJavasource> - </fromJavasource> + <producerOnly>true</producerOnly> + <fromJavasource /> <aliases> <alias> <methodPattern>getRootFolder</methodPattern> @@ -368,8 +372,8 @@ <api> <apiName>groups</apiName> <proxyClass>org.apache.camel.component.box.api.BoxGroupsManager</proxyClass> - <fromJavasource> - </fromJavasource> + <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>createGroup</methodPattern> @@ -423,6 +427,7 @@ <fromJavasource> <excludeMethods>stopListening</excludeMethods> </fromJavasource> + <consumerOnly>true</consumerOnly> <excludeConfigNames>listener</excludeConfigNames> <nullableOptions> <nullableOption>startingPosition</nullableOption> @@ -432,6 +437,7 @@ <apiName>search</apiName> <proxyClass>org.apache.camel.component.box.api.BoxSearchManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>searchFolder</methodPattern> @@ -442,8 +448,8 @@ <api> <apiName>tasks</apiName> <proxyClass>org.apache.camel.component.box.api.BoxTasksManager</proxyClass> - <fromJavasource> - </fromJavasource> + <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>addFileTask</methodPattern> @@ -490,6 +496,7 @@ <apiName>users</apiName> <proxyClass>org.apache.camel.component.box.api.BoxUsersManager</proxyClass> <fromJavasource /> + <producerOnly>true</producerOnly> <aliases> <alias> <methodPattern>getCurrentUser</methodPattern> diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCollaborationsManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCollaborationsManagerEndpointConfiguration.java index 6964444..a90473e 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCollaborationsManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCollaborationsManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxCollaborationsManager}. */ -@ApiParams(apiName = "collaborations", description = "Provides operations to manage Box collaborations", +@ApiParams(apiName = "collaborations", producerOnly = true, + description = "Provides operations to manage Box collaborations", apiMethods = {@ApiMethod(methodName = "addFolderCollaboration", description="Add a collaboration to this folder", signatures={"com.box.sdk.BoxCollaboration addFolderCollaboration(String folderId, com.box.sdk.BoxCollaborator collaborator, com.box.sdk.BoxCollaboration$Role role)"}), @ApiMethod(methodName = "addFolderCollaborationByEmail", description="Add a collaboration to this folder", signatures={"com.box.sdk.BoxCollaboration addFolderCollaborationByEmail(String folderId, Str [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCommentsManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCommentsManagerEndpointConfiguration.java index 4a6553f..3f02955 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCommentsManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxCommentsManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxCommentsManager}. */ -@ApiParams(apiName = "comments", description = "Provides operations to manage Box comments", +@ApiParams(apiName = "comments", producerOnly = true, + description = "Provides operations to manage Box comments", apiMethods = {@ApiMethod(methodName = "addFileComment", description="Add comment to file", signatures={"com.box.sdk.BoxFile addFileComment(String fileId, String message)"}), @ApiMethod(methodName = "changeCommentMessage", description="Change comment message", signatures={"com.box.sdk.BoxComment changeCommentMessage(String commentId, String message)"}), @ApiMethod(methodName = "deleteComment", description="Delete comment", signatures={"void deleteComment(String commentId)"}), @ [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventLogsManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventLogsManagerEndpointConfiguration.java index f8da3fb..6192af8 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventLogsManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventLogsManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxEventLogsManager}. */ -@ApiParams(apiName = "event-logs", description = "Provides operations to read Box enterprise (admin) event logs", +@ApiParams(apiName = "event-logs", producerOnly = true, + description = "Provides operations to read Box enterprise (admin) event logs", apiMethods = {@ApiMethod(methodName = "getEnterpriseEvents", description="Create an event stream with optional starting initial position and add listener that will be notified when an event is received", signatures={"java.util.List<com.box.sdk.BoxEvent> getEnterpriseEvents(String position, java.util.Date after, java.util.Date before, com.box.sdk.BoxEvent$Type[] types)"})}, aliases = {"getEnterpriseEvents=events"}) @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventsManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventsManagerEndpointConfiguration.java index de2c2b5..0092044 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventsManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxEventsManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxEventsManager}. */ -@ApiParams(apiName = "events", description = "Provides operations to manage Box events", +@ApiParams(apiName = "events", consumerOnly = true, + description = "Provides operations to manage Box events", apiMethods = {@ApiMethod(methodName = "listen", description="Create an event stream with optional starting initial position and add listener that will be notified when an event is received", signatures={"void listen(com.box.sdk.EventListener listener, Long startingPosition)"})}, aliases = {}) @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFilesManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFilesManagerEndpointConfiguration.java index 0f088a5..2979dc2 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFilesManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFilesManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxFilesManager}. */ -@ApiParams(apiName = "files", description = "Provides operations to manage Box files", +@ApiParams(apiName = "files", producerOnly = true, + description = "Provides operations to manage Box files", apiMethods = {@ApiMethod(methodName = "checkUpload", description="Does a pre-verification before upload, to check if the filename already exists or if there is permission to upload", signatures={"void checkUpload(String fileName, String parentFolderId, Long size)"}), @ApiMethod(methodName = "copyFile", description="Copy file to destination folder while optionally giving it a new name", signatures={"com.box.sdk.BoxFile copyFile(String fileId, String destinationFolderId, String [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFoldersManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFoldersManagerEndpointConfiguration.java index d6f29a2..94ceef5 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFoldersManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxFoldersManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxFoldersManager}. */ -@ApiParams(apiName = "folders", description = "Provides operations to manage Box folders", +@ApiParams(apiName = "folders", producerOnly = true, + description = "Provides operations to manage Box folders", apiMethods = {@ApiMethod(methodName = "copyFolder", description="Copy folder to destination folder while optionally giving it a new name", signatures={"com.box.sdk.BoxFolder copyFolder(String folderId, String destinationFolderId, String newName)"}), @ApiMethod(methodName = "createFolder", description="Create a folder specified by path from parent folder with given parentFolderId, creating intermediate directories as required", signatures={"com.box.sdk.BoxFolder createFolder(St [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxGroupsManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxGroupsManagerEndpointConfiguration.java index ada5426..5fbf2b9 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxGroupsManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxGroupsManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxGroupsManager}. */ -@ApiParams(apiName = "groups", description = "Provides operations to manage Box groups", +@ApiParams(apiName = "groups", producerOnly = true, + description = "Provides operations to manage Box groups", apiMethods = {@ApiMethod(methodName = "addGroupMembership", description="Add a member to group with the specified role", signatures={"com.box.sdk.BoxGroupMembership addGroupMembership(String groupId, String userId, com.box.sdk.BoxGroupMembership$Role role)"}), @ApiMethod(methodName = "createGroup", description="Create a new group with a specified name and optional additional parameters", signatures={"com.box.sdk.BoxGroup createGroup(String name, String provenance, String exter [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxSearchManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxSearchManagerEndpointConfiguration.java index 3abd1fc..6052a76 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxSearchManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxSearchManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxSearchManager}. */ -@ApiParams(apiName = "search", description = "Provides operations to manage Box searches", +@ApiParams(apiName = "search", producerOnly = true, + description = "Provides operations to manage Box searches", apiMethods = {@ApiMethod(methodName = "searchFolder", description="Search folder and all descendant folders using the given query", signatures={"java.util.Collection<com.box.sdk.BoxItem> searchFolder(String folderId, String query)"})}, aliases = {"searchFolder=search"}) @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxTasksManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxTasksManagerEndpointConfiguration.java index 7e116cf..361d545 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxTasksManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxTasksManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxTasksManager}. */ -@ApiParams(apiName = "tasks", description = "Provides operations to manage Box tasks", +@ApiParams(apiName = "tasks", producerOnly = true, + description = "Provides operations to manage Box tasks", apiMethods = {@ApiMethod(methodName = "addAssignmentToTask", description="Add assignment for task", signatures={"com.box.sdk.BoxTask addAssignmentToTask(String taskId, com.box.sdk.BoxUser assignTo)"}), @ApiMethod(methodName = "addFileTask", description="Add task to file", signatures={"com.box.sdk.BoxTask addFileTask(String fileId, com.box.sdk.BoxTask$Action action, java.util.Date dueAt, String message)"}), @ApiMethod(methodName = "deleteTask", description="Delete task", signat [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxUsersManagerEndpointConfiguration.java b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxUsersManagerEndpointConfiguration.java index da28b14..0dc53b3 100644 --- a/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxUsersManagerEndpointConfiguration.java +++ b/components/camel-box/camel-box-component/src/generated/java/org/apache/camel/component/box/BoxUsersManagerEndpointConfiguration.java @@ -14,7 +14,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link org.apache.camel.component.box.api.BoxUsersManager}. */ -@ApiParams(apiName = "users", description = "Provides operations to manage Box users", +@ApiParams(apiName = "users", producerOnly = true, + description = "Provides operations to manage Box users", apiMethods = {@ApiMethod(methodName = "addUserEmailAlias", description="Add a new email alias to user's account", signatures={"com.box.sdk.EmailAlias addUserEmailAlias(String userId, String email)"}), @ApiMethod(methodName = "createAppUser", description="Provision a new app user in an enterprise with additional user information using Box Developer Edition", signatures={"com.box.sdk.BoxUser createAppUser(String name, com.box.sdk.CreateUserParams params)"}), @ApiMethod(methodNam [...] @UriParams @Configurer diff --git a/components/camel-box/camel-box-component/src/generated/resources/org/apache/camel/component/box/box.json b/components/camel-box/camel-box-component/src/generated/resources/org/apache/camel/component/box/box.json index b5c0153..a243e65 100644 --- a/components/camel-box/camel-box-component/src/generated/resources/org/apache/camel/component/box/box.json +++ b/components/camel-box/camel-box-component/src/generated/resources/org/apache/camel/component/box/box.json @@ -70,27 +70,27 @@ "userPassword": { "kind": "parameter", "displayName": "User Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.box.BoxConfiguration", "configurationField": "configuration", "description": "Box user password, MUST be provided if authSecureStorage is not set, or returns null on first call" } }, "apis": { - "collaborations": { "description": "Provides operations to manage Box collaborations", "aliases": [ "addFolderCollaboration=add", "addFolderCollaborationByEmail=addByEmail", "deleteCollaboration=delete", "getFolderCollaborations=collaborations", "getPendingCollaborations=pendingCollaborations", "getCollaborationInfo=info", "updateCollaborationInfo=updateInfo" ], "methods": { "addFolderCollaboration": { "description": "Add a collaboration to this folder", "signatures": [ "com.box.sdk. [...] - "comments": { "description": "Provides operations to manage Box comments", "aliases": [ "addFileComment=add", "changeCommentMessage=updateMessage", "deleteComment=delete", "getCommentInfo=info", "getFileComments=comments", "replyToComment=reply" ], "methods": { "addFileComment": { "description": "Add comment to file", "signatures": [ "com.box.sdk.BoxFile addFileComment(String fileId, String message)" ] }, "changeCommentMessage": { "description": "Change comment message", "signatures" [...] - "event-logs": { "description": "Provides operations to read Box enterprise (admin) event logs", "aliases": [ "getEnterpriseEvents=events" ], "methods": { "getEnterpriseEvents": { "description": "Create an event stream with optional starting initial position and add listener that will be notified when an event is received", "signatures": [ "java.util.List<com.box.sdk.BoxEvent> getEnterpriseEvents(String position, java.util.Date after, java.util.Date before, com.box.sdk.BoxEvent$Type[] [...] - "events": { "description": "Provides operations to manage Box events", "methods": { "listen": { "description": "Create an event stream with optional starting initial position and add listener that will be notified when an event is received", "signatures": [ "void listen(com.box.sdk.EventListener listener, Long startingPosition)" ] } } }, - "files": { "description": "Provides operations to manage Box files", "aliases": [ "uploadFile=upload", "downloadFile=download", "copyFile=copy", "moveFile=move", "renameFile=rename", "createFileSharedLink=link", "deleteFile=delete", "uploadNewFileVersion=uploadVersion", "promoteFileVersion=promoteVersion", "getFileVersions=versions", "downloadPreviousFileVersion=downloadVersion", "deleteFileVersion=deleteVersion", "getFileInfo=info", "updateFileInfo=updateInfo", "createFileMetadata=c [...] - "folders": { "description": "Provides operations to manage Box folders", "aliases": [ "getRootFolder=root", "createFolder=create", "copyFolder=copy", "moveFolder=move", "renameFolder=rename", "createFolderSharedLink=link", "deleteFolder=delete", "getFolder=folder", "getFolderInfo=info", "getFolderItems=items", "updateFolderInfo=updateInfo" ], "methods": { "copyFolder": { "description": "Copy folder to destination folder while optionally giving it a new name", "signatures": [ "com.box [...] - "groups": { "description": "Provides operations to manage Box groups", "aliases": [ "createGroup=create", "deleteGroup=delete", "getAllGroups=groups", "getGroupInfo=info", "addGroupMembership=addMembership", "deleteGroupMembership=deleteMembership", "getGroupMemberships=memberships", "getGroupMembershipInfo=membershipInfo", "updateGroupMembershipInfo=updateMembershipInfo" ], "methods": { "addGroupMembership": { "description": "Add a member to group with the specified role", "signatur [...] - "search": { "description": "Provides operations to manage Box searches", "aliases": [ "searchFolder=search" ], "methods": { "searchFolder": { "description": "Search folder and all descendant folders using the given query", "signatures": [ "java.util.Collection<com.box.sdk.BoxItem> searchFolder(String folderId, String query)" ] } } }, - "tasks": { "description": "Provides operations to manage Box tasks", "aliases": [ "addFileTask=add", "deleteTask=delete", "getFileTasks=tasks", "getTaskInfo=info", "updateTaskInfo=updateInfo", "addAssignmentToTask=addAssignment", "deleteTaskAssignment=deleteAssignment", "getTaskAssignments=assignments", "getTaskAssignmentInfo=assignmentInfo" ], "methods": { "addAssignmentToTask": { "description": "Add assignment for task", "signatures": [ "com.box.sdk.BoxTask addAssignmentToTask(Stri [...] - "users": { "description": "Provides operations to manage Box users", "aliases": [ "getCurrentUser=currentUser", "getAllEnterpriseOrExternalUsers=users", "createAppUser=create", "createEnterpriseUser=create", "deleteUser=delete", "addUserEmailAlias=addEmailAlias", "getUserEmailAlias=emailAlias", "deleteUserEmailAlias=deleteEmailAlias", "getUserInfo=info", "updateUserInfo=updateInfo" ], "methods": { "addUserEmailAlias": { "description": "Add a new email alias to user's account", "signa [...] + "collaborations": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box collaborations", "aliases": [ "addFolderCollaboration=add", "addFolderCollaborationByEmail=addByEmail", "deleteCollaboration=delete", "getFolderCollaborations=collaborations", "getPendingCollaborations=pendingCollaborations", "getCollaborationInfo=info", "updateCollaborationInfo=updateInfo" ], "methods": { "addFolderCollaboration": { "description": "Add a collaboration t [...] + "comments": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box comments", "aliases": [ "addFileComment=add", "changeCommentMessage=updateMessage", "deleteComment=delete", "getCommentInfo=info", "getFileComments=comments", "replyToComment=reply" ], "methods": { "addFileComment": { "description": "Add comment to file", "signatures": [ "com.box.sdk.BoxFile addFileComment(String fileId, String message)" ] }, "changeCommentMessage": { "descrip [...] + "event-logs": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to read Box enterprise (admin) event logs", "aliases": [ "getEnterpriseEvents=events" ], "methods": { "getEnterpriseEvents": { "description": "Create an event stream with optional starting initial position and add listener that will be notified when an event is received", "signatures": [ "java.util.List<com.box.sdk.BoxEvent> getEnterpriseEvents(String position, java.util.Date after, java. [...] + "events": { "consumerOnly": true, "producerOnly": false, "description": "Provides operations to manage Box events", "methods": { "listen": { "description": "Create an event stream with optional starting initial position and add listener that will be notified when an event is received", "signatures": [ "void listen(com.box.sdk.EventListener listener, Long startingPosition)" ] } } }, + "files": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box files", "aliases": [ "uploadFile=upload", "downloadFile=download", "copyFile=copy", "moveFile=move", "renameFile=rename", "createFileSharedLink=link", "deleteFile=delete", "uploadNewFileVersion=uploadVersion", "promoteFileVersion=promoteVersion", "getFileVersions=versions", "downloadPreviousFileVersion=downloadVersion", "deleteFileVersion=deleteVersion", "getFileInfo=info", "upda [...] + "folders": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box folders", "aliases": [ "getRootFolder=root", "createFolder=create", "copyFolder=copy", "moveFolder=move", "renameFolder=rename", "createFolderSharedLink=link", "deleteFolder=delete", "getFolder=folder", "getFolderInfo=info", "getFolderItems=items", "updateFolderInfo=updateInfo" ], "methods": { "copyFolder": { "description": "Copy folder to destination folder while optionally gi [...] + "groups": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box groups", "aliases": [ "createGroup=create", "deleteGroup=delete", "getAllGroups=groups", "getGroupInfo=info", "addGroupMembership=addMembership", "deleteGroupMembership=deleteMembership", "getGroupMemberships=memberships", "getGroupMembershipInfo=membershipInfo", "updateGroupMembershipInfo=updateMembershipInfo" ], "methods": { "addGroupMembership": { "description": "Add a member [...] + "search": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box searches", "aliases": [ "searchFolder=search" ], "methods": { "searchFolder": { "description": "Search folder and all descendant folders using the given query", "signatures": [ "java.util.Collection<com.box.sdk.BoxItem> searchFolder(String folderId, String query)" ] } } }, + "tasks": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box tasks", "aliases": [ "addFileTask=add", "deleteTask=delete", "getFileTasks=tasks", "getTaskInfo=info", "updateTaskInfo=updateInfo", "addAssignmentToTask=addAssignment", "deleteTaskAssignment=deleteAssignment", "getTaskAssignments=assignments", "getTaskAssignmentInfo=assignmentInfo" ], "methods": { "addAssignmentToTask": { "description": "Add assignment for task", "signatures": [ [...] + "users": { "consumerOnly": false, "producerOnly": true, "description": "Provides operations to manage Box users", "aliases": [ "getCurrentUser=currentUser", "getAllEnterpriseOrExternalUsers=users", "createAppUser=create", "createEnterpriseUser=create", "deleteUser=delete", "addUserEmailAlias=addEmailAlias", "getUserEmailAlias=emailAlias", "deleteUserEmailAlias=deleteEmailAlias", "getUserInfo=info", "updateUserInfo=updateInfo" ], "methods": { "addUserEmailAlias": { "description": "Add [...] }, "apiProperties": { - "collaborations": { "methods": { "addFolderCollaboration": { "properties": { "collaborator": { "kind": "parameter", "displayName": "Collaborator", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxCollaborator", "deprecated": false, "secret": false, "description": "The collaborator to add", "optional": false }, "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "common", "label": "", "required": false, "type": "strin [...] - "comments": { "methods": { "addFileComment": { "properties": { "fileId": { "kind": "parameter", "displayName": "File Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of file", "optional": false }, "message": { "kind": "parameter", "displayName": "Message", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated" [...] - "event-logs": { "methods": { "getEnterpriseEvents": { "properties": { "after": { "kind": "parameter", "displayName": "After", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.util.Date", "deprecated": false, "secret": false, "description": "The lower bound on the timestamp of the events returned", "optional": false }, "before": { "kind": "parameter", "displayName": "Before", "group": "common", "label": "", "required": false, "type": "string", "ja [...] - "events": { "methods": { "listen": { "properties": { "startingPosition": { "kind": "parameter", "displayName": "Starting Position", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "secret": false, "description": "The starting position of the event stream", "optional": true } } } } }, - "files": { "methods": { "checkUpload": { "properties": { "fileName": { "kind": "parameter", "displayName": "File Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The name to give the uploaded file", "optional": false }, "parentFolderId": { "kind": "parameter", "displayName": "Parent Folder Id", "group": "common", "label": "", "required": false, "type": "string", "javaType" [...] - "folders": { "methods": { "copyFolder": { "properties": { "destinationFolderId": { "kind": "parameter", "displayName": "Destination Folder Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of the destination folder", "optional": false }, "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "common", "label": "", "required": false, "type": "string", " [...] - "groups": { "methods": { "addGroupMembership": { "properties": { "groupId": { "kind": "parameter", "displayName": "Group Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of group", "optional": false }, "role": { "kind": "parameter", "displayName": "Role", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxGroupMembership.R [...] - "search": { "methods": { "searchFolder": { "properties": { "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of folder searched", "optional": false }, "query": { "kind": "parameter", "displayName": "Query", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "depr [...] - "tasks": { "methods": { "addAssignmentToTask": { "properties": { "assignTo": { "kind": "parameter", "displayName": "Assign To", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxUser", "deprecated": false, "secret": false, "description": "The user to assign to task", "optional": false }, "taskId": { "kind": "parameter", "displayName": "Task Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.S [...] - "users": { "methods": { "addUserEmailAlias": { "properties": { "email": { "kind": "parameter", "displayName": "Email", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The email address to add as an alias", "optional": false }, "userId": { "kind": "parameter", "displayName": "User Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.Str [...] + "collaborations": { "methods": { "addFolderCollaboration": { "properties": { "collaborator": { "kind": "parameter", "displayName": "Collaborator", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxCollaborator", "deprecated": false, "secret": false, "description": "The collaborator to add", "optional": false }, "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "producer", "label": "", "required": false, "type": "s [...] + "comments": { "methods": { "addFileComment": { "properties": { "fileId": { "kind": "parameter", "displayName": "File Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of file", "optional": false }, "message": { "kind": "parameter", "displayName": "Message", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "depreca [...] + "event-logs": { "methods": { "getEnterpriseEvents": { "properties": { "after": { "kind": "parameter", "displayName": "After", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.util.Date", "deprecated": false, "secret": false, "description": "The lower bound on the timestamp of the events returned", "optional": false }, "before": { "kind": "parameter", "displayName": "Before", "group": "producer", "label": "", "required": false, "type": "string", [...] + "events": { "methods": { "listen": { "properties": { "startingPosition": { "kind": "parameter", "displayName": "Starting Position", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "secret": false, "description": "The starting position of the event stream", "optional": true } } } } }, + "files": { "methods": { "checkUpload": { "properties": { "fileName": { "kind": "parameter", "displayName": "File Name", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The name to give the uploaded file", "optional": false }, "parentFolderId": { "kind": "parameter", "displayName": "Parent Folder Id", "group": "producer", "label": "", "required": false, "type": "string", "javaT [...] + "folders": { "methods": { "copyFolder": { "properties": { "destinationFolderId": { "kind": "parameter", "displayName": "Destination Folder Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of the destination folder", "optional": false }, "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "producer", "label": "", "required": false, "type": "string [...] + "groups": { "methods": { "addGroupMembership": { "properties": { "groupId": { "kind": "parameter", "displayName": "Group Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of group", "optional": false }, "role": { "kind": "parameter", "displayName": "Role", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxGroupMembersh [...] + "search": { "methods": { "searchFolder": { "properties": { "folderId": { "kind": "parameter", "displayName": "Folder Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The id of folder searched", "optional": false }, "query": { "kind": "parameter", "displayName": "Query", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", " [...] + "tasks": { "methods": { "addAssignmentToTask": { "properties": { "assignTo": { "kind": "parameter", "displayName": "Assign To", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "com.box.sdk.BoxUser", "deprecated": false, "secret": false, "description": "The user to assign to task", "optional": false }, "taskId": { "kind": "parameter", "displayName": "Task Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.la [...] + "users": { "methods": { "addUserEmailAlias": { "properties": { "email": { "kind": "parameter", "displayName": "Email", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The email address to add as an alias", "optional": false }, "userId": { "kind": "parameter", "displayName": "User Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang [...] } } diff --git a/components/camel-box/camel-box-component/src/main/docs/box-component.adoc b/components/camel-box/camel-box-component/src/main/docs/box-component.adoc index 4958561..fd30ada 100644 --- a/components/camel-box/camel-box-component/src/main/docs/box-component.adoc +++ b/components/camel-box/camel-box-component/src/main/docs/box-component.adoc @@ -148,19 +148,19 @@ box:apiName/methodName There are 10 API names as listed in the table below: -[width="100%",cols="2,8",options="header"] +[width="100%",cols="2,1,7",options="header"] |=== -| API Name | Description -| *collaborations* | Provides operations to manage Box collaborations -| *comments* | Provides operations to manage Box comments -| *event-logs* | Provides operations to read Box enterprise (admin) event logs -| *events* | Provides operations to manage Box events -| *files* | Provides operations to manage Box files -| *folders* | Provides operations to manage Box folders -| *groups* | Provides operations to manage Box groups -| *search* | Provides operations to manage Box searches -| *tasks* | Provides operations to manage Box tasks -| *users* | Provides operations to manage Box users +| API Name | Type | Description +| *collaborations* | Producer | Provides operations to manage Box collaborations +| *comments* | Producer | Provides operations to manage Box comments +| *event-logs* | Producer | Provides operations to read Box enterprise (admin) event logs +| *events* | Consumer | Provides operations to manage Box events +| *files* | Producer | Provides operations to manage Box files +| *folders* | Producer | Provides operations to manage Box folders +| *groups* | Producer | Provides operations to manage Box groups +| *search* | Producer | Provides operations to manage Box searches +| *tasks* | Producer | Provides operations to manage Box tasks +| *users* | Producer | Provides operations to manage Box users |=== Each API is documented in the following sections to come. @@ -168,6 +168,10 @@ Each API is documented in the following sections to come. ==== API: collaborations +*Only producer is supported* + + + The collaborations API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -238,6 +242,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: comments +*Only producer is supported* + + + The comments API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -306,6 +314,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: event-logs +*Only producer is supported* + + + The event-logs API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -354,6 +366,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: events +*Only consumer is supported* + + + The events API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -399,6 +415,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: files +*Only producer is supported* + + + The files API has 22 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -569,6 +589,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: folders +*Only producer is supported* + + + The folders API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -667,6 +691,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: groups +*Only producer is supported* + + + The groups API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -753,6 +781,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: search +*Only producer is supported* + + + The search API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -799,6 +831,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: tasks +*Only producer is supported* + + + The tasks API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -881,6 +917,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: users +*Only producer is supported* + + + The users API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): diff --git a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/BoxEndpoint.java b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/BoxEndpoint.java index 5f7ee62..334453f 100644 --- a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/BoxEndpoint.java +++ b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/BoxEndpoint.java @@ -59,9 +59,7 @@ public class BoxEndpoint extends AbstractApiEndpoint<BoxApiName, BoxConfiguratio // cached connection private BoxAPIConnection boxConnection; - private Object apiProxy; - private boolean boxConnectionShared; public BoxEndpoint(String uri, BoxComponent component, BoxApiName apiName, String methodName, @@ -111,8 +109,6 @@ public class BoxEndpoint extends AbstractApiEndpoint<BoxApiName, BoxConfiguratio @Override protected void afterConfigureProperties() { - // create connection eagerly, a good way to validate configuration - createBoxConnection(); } @Override @@ -124,6 +120,12 @@ public class BoxEndpoint extends AbstractApiEndpoint<BoxApiName, BoxConfiguratio return apiProxy; } + @Override + protected void doStart() throws Exception { + super.doStart(); + createBoxConnection(); + } + private void createBoxConnection() { final BoxComponent component = getComponent(); this.boxConnectionShared = configuration.equals(getComponent().getConfiguration()); diff --git a/core/camel-api/src/generated/java/org/apache/camel/spi/ApiParams.java b/core/camel-api/src/generated/java/org/apache/camel/spi/ApiParams.java index 037970d..525e0f2 100644 --- a/core/camel-api/src/generated/java/org/apache/camel/spi/ApiParams.java +++ b/core/camel-api/src/generated/java/org/apache/camel/spi/ApiParams.java @@ -47,6 +47,20 @@ public @interface ApiParams { String description() default ""; /** + * Whether this API can only be used as a producer. + * <p/> + * By default its assumed the API can be used as both consumer and producer. + */ + boolean producerOnly() default false; + + /** + * Whether this API can only be used as a consumer. + * <p/> + * By default its assumed the API can be used as both consumer and producer. + */ + boolean consumerOnly() default false; + + /** * The API methods that the API provides of this configuration class. */ ApiMethod[] apiMethods(); diff --git a/docs/components/modules/ROOT/pages/box-component.adoc b/docs/components/modules/ROOT/pages/box-component.adoc index d366225..f78ed34 100644 --- a/docs/components/modules/ROOT/pages/box-component.adoc +++ b/docs/components/modules/ROOT/pages/box-component.adoc @@ -150,19 +150,19 @@ box:apiName/methodName There are 10 API names as listed in the table below: -[width="100%",cols="2,8",options="header"] +[width="100%",cols="2,1,7",options="header"] |=== -| API Name | Description -| *collaborations* | Provides operations to manage Box collaborations -| *comments* | Provides operations to manage Box comments -| *event-logs* | Provides operations to read Box enterprise (admin) event logs -| *events* | Provides operations to manage Box events -| *files* | Provides operations to manage Box files -| *folders* | Provides operations to manage Box folders -| *groups* | Provides operations to manage Box groups -| *search* | Provides operations to manage Box searches -| *tasks* | Provides operations to manage Box tasks -| *users* | Provides operations to manage Box users +| API Name | Type | Description +| *collaborations* | Producer | Provides operations to manage Box collaborations +| *comments* | Producer | Provides operations to manage Box comments +| *event-logs* | Producer | Provides operations to read Box enterprise (admin) event logs +| *events* | Consumer | Provides operations to manage Box events +| *files* | Producer | Provides operations to manage Box files +| *folders* | Producer | Provides operations to manage Box folders +| *groups* | Producer | Provides operations to manage Box groups +| *search* | Producer | Provides operations to manage Box searches +| *tasks* | Producer | Provides operations to manage Box tasks +| *users* | Producer | Provides operations to manage Box users |=== Each API is documented in the following sections to come. @@ -170,6 +170,10 @@ Each API is documented in the following sections to come. ==== API: collaborations +*Only producer is supported* + + + The collaborations API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -240,6 +244,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: comments +*Only producer is supported* + + + The comments API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -308,6 +316,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: event-logs +*Only producer is supported* + + + The event-logs API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -356,6 +368,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: events +*Only consumer is supported* + + + The events API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -401,6 +417,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: files +*Only producer is supported* + + + The files API has 22 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -571,6 +591,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: folders +*Only producer is supported* + + + The folders API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -669,6 +693,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: groups +*Only producer is supported* + + + The groups API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -755,6 +783,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: search +*Only producer is supported* + + + The search API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -801,6 +833,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: tasks +*Only producer is supported* + + + The tasks API has 9 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): @@ -883,6 +919,10 @@ would override a `CamelBox.myParameterNameHere` header. ==== API: users +*Only producer is supported* + + + The users API has 10 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading): diff --git a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/ApiModel.java b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/ApiModel.java index cf76a6a..205b655 100644 --- a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/ApiModel.java +++ b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/ApiModel.java @@ -25,6 +25,8 @@ public final class ApiModel { private String name; private String description; + private boolean consumerOnly; + private boolean producerOnly; private final List<String> aliases = new ArrayList<>(); // lets sort api methods A..Z so they are always in the same order private final Collection<ApiMethodModel> methods = new TreeSet<>(Comparators.apiMethodModelModelComparator()); @@ -45,6 +47,22 @@ public final class ApiModel { this.description = description; } + public boolean isConsumerOnly() { + return consumerOnly; + } + + public void setConsumerOnly(boolean consumerOnly) { + this.consumerOnly = consumerOnly; + } + + public boolean isProducerOnly() { + return producerOnly; + } + + public void setProducerOnly(boolean producerOnly) { + this.producerOnly = producerOnly; + } + public List<String> getAliases() { return aliases; } diff --git a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java index d24deb6..9590245 100644 --- a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java +++ b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java @@ -107,6 +107,8 @@ public final class JsonMapper { ApiModel am = new ApiModel(); am.setName(name); am.setDescription(mp.getStringOrDefault("description", "")); + am.setConsumerOnly(mp.getBooleanOrDefault("consumerOnly", false)); + am.setProducerOnly(mp.getBooleanOrDefault("producerOnly", false)); model.getApiOptions().add(am); Collection<String> aliases = mp.getCollection("aliases"); if (aliases != null && !aliases.isEmpty()) { @@ -448,21 +450,29 @@ public final class JsonMapper { model.forEach(a -> { JsonObject json = new JsonObject(); root.put(a.getName(), json); - if (!options && a.getDescription() != null) { - json.put("description", a.getDescription()); - } - if (!options && !a.getAliases().isEmpty()) { - json.put("aliases", new JsonArray(a.getAliases())); + if (!options) { + // lets be less verbose and only output these details for the api summary and not when we have all options included + json.put("consumerOnly", a.isConsumerOnly()); + json.put("producerOnly", a.isProducerOnly()); + if (a.getDescription() != null) { + json.put("description", a.getDescription()); + } + if (!a.getAliases().isEmpty()) { + json.put("aliases", new JsonArray(a.getAliases())); + } } Map<String, JsonObject> methods = new TreeMap<>(); json.put("methods", methods); a.getMethods().forEach(m -> { JsonObject mJson = new JsonObject(); - if (!options && m.getDescription() != null) { - mJson.put("description", m.getDescription()); - } - if (!options && !m.getSignatures().isEmpty()) { - mJson.put("signatures", new JsonArray(m.getSignatures())); + if (!options) { + // lets be less verbose and only output these details for the api summary and not when we have all options included + if (m.getDescription() != null) { + mJson.put("description", m.getDescription()); + } + if (!m.getSignatures().isEmpty()) { + mJson.put("signatures", new JsonArray(m.getSignatures())); + } } if (options) { mJson.put("properties", asJsonObject(m.getOptions())); diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java index e5bbf24..3d99806 100644 --- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java +++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/AbstractApiMethodGeneratorMojo.java @@ -58,6 +58,12 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa @Parameter protected String apiDescription; + @Parameter + protected boolean consumerOnly; + + @Parameter + protected boolean producerOnly; + /** * Method alias patterns for all APIs. */ @@ -202,6 +208,8 @@ public abstract class AbstractApiMethodGeneratorMojo extends AbstractApiMethodBa VelocityContext context = getCommonContext(models); context.put("apiName", apiName); context.put("apiDescription", apiDescription); + context.put("consumerOnly", consumerOnly); + context.put("producerOnly", producerOnly); context.put("configName", getConfigName()); context.put("componentName", componentName); context.put("componentPackage", componentPackage); diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java index 50b611c..cd1cf41 100644 --- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java +++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiComponentGeneratorMojo.java @@ -157,6 +157,8 @@ public class ApiComponentGeneratorMojo extends AbstractApiMethodBaseMojo { mojo.classPrefix = apiProxy.getClassPrefix(); mojo.apiName = apiProxy.getApiName(); mojo.apiDescription = apiProxy.getApiDescription(); + mojo.consumerOnly = apiProxy.isConsumerOnly(); + mojo.producerOnly = apiProxy.isProducerOnly(); } private AbstractApiMethodGeneratorMojo getApiMethodGenerator(ApiProxy api) { diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiProxy.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiProxy.java index fa88d3f..53fe7f7 100644 --- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiProxy.java +++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/ApiProxy.java @@ -27,25 +27,17 @@ import org.apache.maven.plugin.MojoExecutionException; public class ApiProxy { private String apiName; - private String apiDescription; - + private boolean consumerOnly; + private boolean producerOnly; private String proxyClass; - private FromJavasource fromJavasource; - private Substitution[] substitutions = new Substitution[0]; - private String excludeConfigNames; - private String excludeConfigTypes; - private ExtraOption[] extraOptions; - private String[] nullableOptions; - private String classPrefix; - private List<ApiMethodAlias> aliases = Collections.emptyList(); public String getApiName() { @@ -64,6 +56,22 @@ public class ApiProxy { this.apiDescription = apiDescription; } + public boolean isConsumerOnly() { + return consumerOnly; + } + + public void setConsumerOnly(boolean consumerOnly) { + this.consumerOnly = consumerOnly; + } + + public boolean isProducerOnly() { + return producerOnly; + } + + public void setProducerOnly(boolean producerOnly) { + this.producerOnly = producerOnly; + } + public String getProxyClass() { return proxyClass; } diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-endpoint-config.vm b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-endpoint-config.vm index dabc896..ffcfdfb 100644 --- a/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-endpoint-config.vm +++ b/tooling/maven/camel-api-component-maven-plugin/src/main/resources/api-endpoint-config.vm @@ -46,7 +46,8 @@ import org.apache.camel.spi.UriParams; /** * Camel endpoint configuration for {@link $proxyType.Name}. */ -@ApiParams(apiName = "$helper.getApiName($apiName)", description = "$helper.getApiDescription($apiDescription)", +@ApiParams(apiName = "$helper.getApiName($apiName)", #if($producerOnly)producerOnly = true,#elseif($consumerOnly)consumerOnly = true,#end + description = "$helper.getApiDescription($apiDescription)", apiMethods = $helper.getApiMethods($models), aliases = $helper.getAliases()) @UriParams @Configurer diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java index e719455..82b3af1 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java @@ -1116,6 +1116,8 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { } if (apiParams != null) { api.setDescription(apiParams.description()); + api.setConsumerOnly(apiParams.consumerOnly()); + api.setProducerOnly(apiParams.producerOnly()); } } else { api = op.get(); @@ -1148,6 +1150,10 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { apiMethod.addApiOptionModel(copy); // the option description is stored on @ApiMethod copy.setDescription(method.description()); + // whether we are consumer or producer only + group = EndpointHelper.labelAsGroupName(copy.getLabel(), api.isConsumerOnly(), + api.isProducerOnly()); + copy.setGroup(group); copy.setOptional(apiParam.optional()); } } else { diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java index ac2e149..9db78f0 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MvelHelper.java @@ -69,4 +69,14 @@ public final class MvelHelper { // empty if no alias return ""; } + + public static String producerOrConsumer(ApiModel api) { + if (api.isConsumerOnly()) { + return "Consumer"; + } else if (api.isProducerOnly()) { + return "Producer"; + } + return "Both"; + } + } diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel index 904a7e7..97fef79 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/endpoint-options.mvel @@ -43,16 +43,24 @@ The API name and API method is located in the endpoint URI as the @{apiSyntax} p There are @{apiOptions.size} API names as listed in the table below: -[width="100%",cols="2,8",options="header"] +[width="100%",cols="2,1,7",options="header"] |===@comment{ Render table cells. If description contains newline, prefix cell with `a`, so the content is rendered with formatting. } -| API Name | Description -@foreach{api : apiOptions}| *@{api.name}* | @{api.description} +| API Name | Type | Description +@foreach{api : apiOptions}| *@{api.name}* | @{util.producerOrConsumer(api)} | @{api.description} @end{}|=== Each API is documented in the following sections to come. @foreach{api : apiOptions} ==== API: @{api.name} +@if{api.consumerOnly} +*Only consumer is supported* +@elseif{api.producerOnly} +*Only producer is supported* +@else{} +*Both producer and consumer are supported* +@end{} + @if{api.methods.isEmpty()} The @{api.name} has no API methods. @else{} diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/ApiParams.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/ApiParams.java index 037970d..525e0f2 100644 --- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/ApiParams.java +++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/ApiParams.java @@ -47,6 +47,20 @@ public @interface ApiParams { String description() default ""; /** + * Whether this API can only be used as a producer. + * <p/> + * By default its assumed the API can be used as both consumer and producer. + */ + boolean producerOnly() default false; + + /** + * Whether this API can only be used as a consumer. + * <p/> + * By default its assumed the API can be used as both consumer and producer. + */ + boolean consumerOnly() default false; + + /** * The API methods that the API provides of this configuration class. */ ApiMethod[] apiMethods();