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
The following commit(s) were added to refs/heads/master by this push: new e94b900 CAMEL-15549: Polished e94b900 is described below commit e94b9000ab1113ce2c53231345923d29c7ae57a0 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Sep 21 07:47:25 2020 +0200 CAMEL-15549: Polished --- .../catalog/docs/google-mail-stream-component.adoc | 14 ++-- .../drive/GoogleDriveFilesConverterLoader.java | 2 +- .../google/drive/GoogleDriveComponent.java | 4 - .../google/drive/GoogleDriveConfiguration.java | 7 -- .../google/drive/GoogleDriveFilesConverter.java | 2 +- .../google/mail/stream/google-mail-stream.json | 20 ++--- .../main/docs/google-mail-stream-component.adoc | 14 ++-- .../component/google/mail/GoogleMailComponent.java | 4 - .../google/mail/GoogleMailConfiguration.java | 6 -- .../component/google/mail/GoogleMailEndpoint.java | 1 - .../mail/stream/GoogleMailStreamComponent.java | 1 + .../mail/stream/GoogleMailStreamConfiguration.java | 17 +---- .../mail/stream/GoogleMailStreamConsumer.java | 7 -- .../mail/stream/GoogleMailStreamEndpoint.java | 4 +- .../component/ComponentsBuilderFactory.java | 2 +- .../GoogleMailStreamComponentBuilderFactory.java | 86 +++++++++++----------- .../src/generated/resources/metadata.json | 2 +- .../builder/endpoint/StaticEndpointBuilders.java | 8 +- .../GoogleMailStreamEndpointBuilderFactory.java | 80 ++++++++++---------- .../ROOT/pages/google-mail-stream-component.adoc | 14 ++-- 20 files changed, 129 insertions(+), 166 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-mail-stream-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-mail-stream-component.adoc index 6415233..9562078 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-mail-stream-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-mail-stream-component.adoc @@ -60,19 +60,19 @@ The Google Mail Stream component supports 13 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean | *clientFactory* (advanced) | The client Factory | | GoogleMailClientFactory | *configuration* (advanced) | The configuration | | GoogleMailStreamConfiguration +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |=== // component options: END @@ -94,7 +94,7 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *index* | Specifies an index for the endpoint | | String +| *index* | Currently not in use | | String |=== @@ -104,16 +104,13 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern @@ -134,6 +131,9 @@ with the following path and query parameters: | *startScheduler* (scheduler) | Whether the scheduler should be auto started. | true | boolean | *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit | *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |=== diff --git a/components/camel-google-drive/src/generated/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverterLoader.java b/components/camel-google-drive/src/generated/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverterLoader.java index de30d35..c5b6509 100644 --- a/components/camel-google-drive/src/generated/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverterLoader.java +++ b/components/camel-google-drive/src/generated/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverterLoader.java @@ -29,7 +29,7 @@ public final class GoogleDriveFilesConverterLoader implements TypeConverterLoade (type, exchange, value) -> org.apache.camel.component.google.drive.GoogleDriveFilesConverter.genericStringToChildReference((java.lang.String) value, exchange)); addTypeConverter(registry, com.google.api.services.drive.model.File.class, org.apache.camel.component.file.GenericFile.class, false, (type, exchange, value) -> org.apache.camel.component.google.drive.GoogleDriveFilesConverter.genericFileToGoogleDriveFile((org.apache.camel.component.file.GenericFile) value, exchange)); - addTypeConverter(registry, java.io.InputStream.class, com.google.api.services.drive.model.File.class, false, + addTypeConverter(registry, java.io.InputStream.class, com.google.api.services.drive.model.File.class, true, (type, exchange, value) -> org.apache.camel.component.google.drive.GoogleDriveFilesConverter.download((com.google.api.services.drive.model.File) value, exchange)); addTypeConverter(registry, java.lang.String.class, com.google.api.services.drive.model.File.class, false, (type, exchange, value) -> org.apache.camel.component.google.drive.GoogleDriveFilesConverter.downloadContentAsString((com.google.api.services.drive.model.File) value, exchange)); diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java index 95473e6..82d0f86 100644 --- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java +++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java @@ -26,16 +26,12 @@ import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.component.AbstractApiComponent; import org.apache.camel.util.ObjectHelper; -/** - * Represents the component that manages {@link GoogleDriveEndpoint}. - */ @Component("google-drive") public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiName, GoogleDriveConfiguration, GoogleDriveApiCollection> { @Metadata GoogleDriveConfiguration configuration; - @Metadata(label = "advanced") private Drive client; @Metadata(label = "advanced") diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java index 353f17a..569ac78 100644 --- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java +++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java @@ -40,26 +40,19 @@ public class GoogleDriveConfiguration { @UriPath @Metadata(required = true) private GoogleDriveApiName apiName; - @UriPath(enums = "copy,delete,get,getIdForEmail,insert,list,patch,stop,touch,trash,untrash,update,watch") @Metadata(required = true) private String methodName; - @UriParam private List<String> scopes = DEFAULT_SCOPES; - @UriParam private String clientId; - @UriParam(label = "security", secret = true) private String clientSecret; - @UriParam(label = "security", secret = true) private String accessToken; - @UriParam(label = "security", secret = true) private String refreshToken; - @UriParam private String applicationName; diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java index 6fd804c..474ff67 100644 --- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java +++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveFilesConverter.java @@ -69,7 +69,7 @@ public final class GoogleDriveFilesConverter { } // convenience method that takes google file metadata and converts that to an inputstream - @Converter + @Converter(allowNull = true) public static InputStream download(com.google.api.services.drive.model.File fileMetadata, Exchange exchange) throws Exception { if (fileMetadata.getDownloadUrl() != null && fileMetadata.getDownloadUrl().length() > 0) { diff --git a/components/camel-google-mail/src/generated/resources/org/apache/camel/component/google/mail/stream/google-mail-stream.json b/components/camel-google-mail/src/generated/resources/org/apache/camel/component/google/mail/stream/google-mail-stream.json index 985dba4..19170c1 100644 --- a/components/camel-google-mail/src/generated/resources/org/apache/camel/component/google/mail/stream/google-mail-stream.json +++ b/components/camel-google-mail/src/generated/resources/org/apache/camel/component/google/mail/stream/google-mail-stream.json @@ -6,7 +6,7 @@ "description": "Poll for incoming messages in Google Mail.", "deprecated": false, "firstVersion": "2.22.0", - "label": "api,cloud,mail", + "label": "cloud,api,mail", "javaType": "org.apache.camel.component.google.mail.stream.GoogleMailStreamComponent", "supportLevel": "Stable", "groupId": "org.apache.camel", @@ -22,32 +22,29 @@ "lenientProperties": false }, "componentProperties": { - "accessToken": { "kind": "property", "displayName": "Access Token", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage." }, "applicationName": { "kind": "property", "displayName": "Application Name", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Google mail application name. Example would be camel-google-mail\/1.0" }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by [...] "clientId": { "kind": "property", "displayName": "Client Id", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client ID of the mail application" }, - "clientSecret": { "kind": "property", "displayName": "Client Secret", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client secret of the mail application" }, "labels": { "kind": "property", "displayName": "Labels", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Comma separated list of labels to take into account" }, "markAsRead": { "kind": "property", "displayName": "Mark As Read", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Mark the message as read once it has been consumed" }, "maxResults": { "kind": "property", "displayName": "Max Results", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "secret": false, "defaultValue": "10", "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Max results to be returned" }, "query": { "kind": "property", "displayName": "Query", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "is:unread", "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "The query to execute on gmail box" }, - "refreshToken": { "kind": "property", "displayName": "Refresh Token", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one ex [...] "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }, "clientFactory": { "kind": "property", "displayName": "Client Factory", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.mail.GoogleMailClientFactory", "deprecated": false, "secret": false, "description": "The client Factory" }, - "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "deprecated": false, "secret": false, "description": "The configuration" } + "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "deprecated": false, "secret": false, "description": "The configuration" }, + "accessToken": { "kind": "property", "displayName": "Access Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage." }, + "clientSecret": { "kind": "property", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client secret of the mail application" }, + "refreshToken": { "kind": "property", "displayName": "Refresh Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current [...] }, "properties": { - "index": { "kind": "path", "displayName": "Index", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Specifies an index for the endpoint" }, - "accessToken": { "kind": "parameter", "displayName": "Access Token", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage." }, + "index": { "kind": "path", "displayName": "Index", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Currently not in use" }, "applicationName": { "kind": "parameter", "displayName": "Application Name", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Google mail application name. Example would be camel-google-mail\/1.0" }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled b [...] "clientId": { "kind": "parameter", "displayName": "Client Id", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client ID of the mail application" }, - "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client secret of the mail application" }, "labels": { "kind": "parameter", "displayName": "Labels", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Comma separated list of labels to take into account" }, "markAsRead": { "kind": "parameter", "displayName": "Mark As Read", "group": "consumer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Mark the message as read once it has been consumed" }, "maxResults": { "kind": "parameter", "displayName": "Max Results", "group": "consumer", "label": "", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "secret": false, "defaultValue": "10", "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Max results to be returned" }, "query": { "kind": "parameter", "displayName": "Query", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "is:unread", "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "The query to execute on gmail box" }, - "refreshToken": { "kind": "parameter", "displayName": "Refresh Token", "group": "consumer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one e [...] "sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." }, "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with [...] "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, @@ -67,7 +64,10 @@ "schedulerProperties": { "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." }, "startScheduler": { "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "description": "Whether the scheduler should be auto started." }, "timeUnit": { "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." }, - "useFixedDelay": { "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." } + "useFixedDelay": { "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, + "accessToken": { "kind": "parameter", "displayName": "Access Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage." }, + "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "Client secret of the mail application" }, + "refreshToken": { "kind": "parameter", "displayName": "Refresh Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": true, "configurationClass": "org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration", "configurationField": "configuration", "description": "OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the curren [...] }, "apis": { "attachments": { "consumerOnly": true, "producerOnly": false, "description": "The attachments collection of methods", "methods": { "get": { "description": "Gets the specified message attachment", "signatures": [ "com.google.api.services.gmail.Gmail$Users$Messages$Attachments$Get get(String userId, String messageId, String id)" ] } } }, diff --git a/components/camel-google-mail/src/main/docs/google-mail-stream-component.adoc b/components/camel-google-mail/src/main/docs/google-mail-stream-component.adoc index 6415233..9562078 100644 --- a/components/camel-google-mail/src/main/docs/google-mail-stream-component.adoc +++ b/components/camel-google-mail/src/main/docs/google-mail-stream-component.adoc @@ -60,19 +60,19 @@ The Google Mail Stream component supports 13 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean | *clientFactory* (advanced) | The client Factory | | GoogleMailClientFactory | *configuration* (advanced) | The configuration | | GoogleMailStreamConfiguration +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |=== // component options: END @@ -94,7 +94,7 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *index* | Specifies an index for the endpoint | | String +| *index* | Currently not in use | | String |=== @@ -104,16 +104,13 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern @@ -134,6 +131,9 @@ with the following path and query parameters: | *startScheduler* (scheduler) | Whether the scheduler should be auto started. | true | boolean | *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit | *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |=== diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailComponent.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailComponent.java index 8ff3992..40aafc3 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailComponent.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailComponent.java @@ -25,16 +25,12 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.component.AbstractApiComponent; -/** - * Represents the component that manages {@link GoogleMailEndpoint}. - */ @Component("google-mail") public class GoogleMailComponent extends AbstractApiComponent<GoogleMailApiName, GoogleMailConfiguration, GoogleMailApiCollection> { @Metadata GoogleMailConfiguration configuration; - @Metadata(label = "advanced") private Gmail client; @Metadata(label = "advanced") diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailConfiguration.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailConfiguration.java index d4fca4d..9e3e266 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailConfiguration.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailConfiguration.java @@ -32,23 +32,17 @@ public class GoogleMailConfiguration { @UriPath @Metadata(required = true) private GoogleMailApiName apiName; - @UriPath(enums = "attachments,create,delete,get,getProfile,gmailImport,insert,list,modify,patch,send,stop,trash,untrash,update,watch") @Metadata(required = true) private String methodName; - @UriParam private String clientId; - @UriParam(label = "security", secret = true) private String clientSecret; - @UriParam(label = "security", secret = true) private String accessToken; - @UriParam(label = "security", secret = true) private String refreshToken; - @UriParam private String applicationName; diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailEndpoint.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailEndpoint.java index 9c5b28f..baa2192 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailEndpoint.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/GoogleMailEndpoint.java @@ -45,7 +45,6 @@ import org.apache.camel.support.component.ApiMethodPropertiesHelper; category = { Category.CLOUD, Category.API, Category.MAIL }) public class GoogleMailEndpoint extends AbstractApiEndpoint<GoogleMailApiName, GoogleMailConfiguration> { - // TODO create and manage API proxy private Object apiProxy; @UriParam diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamComponent.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamComponent.java index 4f8ea3e..9cd28eb 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamComponent.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamComponent.java @@ -88,6 +88,7 @@ public class GoogleMailStreamComponent extends DefaultComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final GoogleMailStreamConfiguration configuration = this.configuration.copy(); + configuration.setIndex(remaining); GoogleMailStreamEndpoint endpoint = new GoogleMailStreamEndpoint(uri, this, configuration); setProperties(endpoint, parameters); return endpoint; diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConfiguration.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConfiguration.java index 0ad925d..a0e848a 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConfiguration.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConfiguration.java @@ -28,31 +28,22 @@ import org.apache.camel.spi.UriPath; public class GoogleMailStreamConfiguration implements Cloneable { @UriPath private String index; - @UriParam private String clientId; - - @UriParam + @UriParam(label = "security", secret = true) private String clientSecret; - - @UriParam + @UriParam(label = "security", secret = true) private String accessToken; - - @UriParam + @UriParam(label = "security", secret = true) private String refreshToken; - @UriParam private String applicationName; - @UriParam(defaultValue = "is:unread") private String query = "is:unread"; - @UriParam(defaultValue = "10") private long maxResults = 10L; - @UriParam private String labels; - @UriParam private boolean markAsRead; @@ -117,7 +108,7 @@ public class GoogleMailStreamConfiguration implements Cloneable { } /** - * Specifies an index for the endpoint + * Currently not in use */ public void setIndex(String index) { this.index = index; diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java index c7e3f7b..4d4f5e2 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.google.mail.stream; -import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -131,9 +130,6 @@ public class GoogleMailStreamConsumer extends ScheduledBatchPollingConsumer { /** * Strategy to delete the message after being processed. - * - * @param exchange the exchange - * @throws IOException */ protected void processCommit(Exchange exchange, String unreadLabelId) { try { @@ -159,9 +155,6 @@ public class GoogleMailStreamConsumer extends ScheduledBatchPollingConsumer { /** * Strategy when processing the exchange failed. - * - * @param exchange the exchange - * @throws IOException */ protected void processRollback(Exchange exchange, String unreadLabelId) { try { diff --git a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamEndpoint.java b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamEndpoint.java index c897594..8c47b31 100644 --- a/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamEndpoint.java +++ b/components/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamEndpoint.java @@ -27,6 +27,7 @@ import com.google.api.services.gmail.model.ListLabelsResponse; import com.google.api.services.gmail.model.MessagePart; import com.google.api.services.gmail.model.MessagePartHeader; import com.google.common.base.Splitter; +import org.apache.camel.Category; import org.apache.camel.Consumer; import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; @@ -47,7 +48,7 @@ import org.apache.camel.util.ObjectHelper; title = "Google Mail Stream", syntax = "google-mail-stream:index", consumerOnly = true, - label = "api,cloud,mail") + category = { Category.CLOUD, Category.API, Category.MAIL }) public class GoogleMailStreamEndpoint extends ScheduledPollEndpoint { @UriParam @@ -108,7 +109,6 @@ public class GoogleMailStreamEndpoint extends ScheduledPollEndpoint { } public Exchange createExchange(ExchangePattern pattern, com.google.api.services.gmail.model.Message mail) { - Exchange exchange = super.createExchange(pattern); Message message = exchange.getIn(); exchange.getIn().setHeader(GoogleMailStreamConstants.MAIL_ID, mail.getId()); diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 810f0e1..e18e72f 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -1608,7 +1608,7 @@ public interface ComponentsBuilderFactory { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail */ diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleMailStreamComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleMailStreamComponentBuilderFactory.java index c4cf6b3..7313287 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleMailStreamComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GoogleMailStreamComponentBuilderFactory.java @@ -34,7 +34,7 @@ public interface GoogleMailStreamComponentBuilderFactory { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail */ @@ -49,19 +49,6 @@ public interface GoogleMailStreamComponentBuilderFactory { extends ComponentBuilder<GoogleMailStreamComponent> { /** - * OAuth 2 access token. This typically expires after an hour so - * refreshToken is recommended for long term usage. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamComponentBuilder accessToken( - java.lang.String accessToken) { - doSetProperty("accessToken", accessToken); - return this; - } - /** * Google mail application name. Example would be camel-google-mail/1.0. * * The option is a: <code>java.lang.String</code> type. @@ -105,18 +92,6 @@ public interface GoogleMailStreamComponentBuilderFactory { return this; } /** - * Client secret of the mail application. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamComponentBuilder clientSecret( - java.lang.String clientSecret) { - doSetProperty("clientSecret", clientSecret); - return this; - } - /** * Comma separated list of labels to take into account. * * The option is a: <code>java.lang.String</code> type. @@ -164,20 +139,6 @@ public interface GoogleMailStreamComponentBuilderFactory { return this; } /** - * OAuth 2 refresh token. Using this, the Google Calendar component can - * obtain a new accessToken whenever the current one expires - a - * necessity if the application is long-lived. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamComponentBuilder refreshToken( - java.lang.String refreshToken) { - doSetProperty("refreshToken", refreshToken); - return this; - } - /** * Whether the component should use basic property binding (Camel 2.x) * or the newer property binding with additional capabilities. * @@ -218,6 +179,45 @@ public interface GoogleMailStreamComponentBuilderFactory { doSetProperty("configuration", configuration); return this; } + /** + * OAuth 2 access token. This typically expires after an hour so + * refreshToken is recommended for long term usage. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamComponentBuilder accessToken( + java.lang.String accessToken) { + doSetProperty("accessToken", accessToken); + return this; + } + /** + * Client secret of the mail application. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamComponentBuilder clientSecret( + java.lang.String clientSecret) { + doSetProperty("clientSecret", clientSecret); + return this; + } + /** + * OAuth 2 refresh token. Using this, the Google Calendar component can + * obtain a new accessToken whenever the current one expires - a + * necessity if the application is long-lived. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamComponentBuilder refreshToken( + java.lang.String refreshToken) { + doSetProperty("refreshToken", refreshToken); + return this; + } } class GoogleMailStreamComponentBuilderImpl @@ -242,19 +242,19 @@ public interface GoogleMailStreamComponentBuilderFactory { String name, Object value) { switch (name) { - case "accessToken": getOrCreateConfiguration((GoogleMailStreamComponent) component).setAccessToken((java.lang.String) value); return true; case "applicationName": getOrCreateConfiguration((GoogleMailStreamComponent) component).setApplicationName((java.lang.String) value); return true; case "bridgeErrorHandler": ((GoogleMailStreamComponent) component).setBridgeErrorHandler((boolean) value); return true; case "clientId": getOrCreateConfiguration((GoogleMailStreamComponent) component).setClientId((java.lang.String) value); return true; - case "clientSecret": getOrCreateConfiguration((GoogleMailStreamComponent) component).setClientSecret((java.lang.String) value); return true; case "labels": getOrCreateConfiguration((GoogleMailStreamComponent) component).setLabels((java.lang.String) value); return true; case "markAsRead": getOrCreateConfiguration((GoogleMailStreamComponent) component).setMarkAsRead((boolean) value); return true; case "maxResults": getOrCreateConfiguration((GoogleMailStreamComponent) component).setMaxResults((long) value); return true; case "query": getOrCreateConfiguration((GoogleMailStreamComponent) component).setQuery((java.lang.String) value); return true; - case "refreshToken": getOrCreateConfiguration((GoogleMailStreamComponent) component).setRefreshToken((java.lang.String) value); return true; case "basicPropertyBinding": ((GoogleMailStreamComponent) component).setBasicPropertyBinding((boolean) value); return true; case "clientFactory": ((GoogleMailStreamComponent) component).setClientFactory((org.apache.camel.component.google.mail.GoogleMailClientFactory) value); return true; case "configuration": ((GoogleMailStreamComponent) component).setConfiguration((org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration) value); return true; + case "accessToken": getOrCreateConfiguration((GoogleMailStreamComponent) component).setAccessToken((java.lang.String) value); return true; + case "clientSecret": getOrCreateConfiguration((GoogleMailStreamComponent) component).setClientSecret((java.lang.String) value); return true; + case "refreshToken": getOrCreateConfiguration((GoogleMailStreamComponent) component).setRefreshToken((java.lang.String) value); return true; default: return false; } } diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json b/core/camel-componentdsl/src/generated/resources/metadata.json index 708be35..dc1bd98 100644 --- a/core/camel-componentdsl/src/generated/resources/metadata.json +++ b/core/camel-componentdsl/src/generated/resources/metadata.json @@ -3111,7 +3111,7 @@ "description": "Poll for incoming messages in Google Mail.", "deprecated": false, "firstVersion": "2.22.0", - "label": "api,cloud,mail", + "label": "cloud,api,mail", "javaType": "org.apache.camel.component.google.mail.stream.GoogleMailStreamComponent", "supportLevel": "Stable", "groupId": "org.apache.camel", diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index b0f198f..1bacdf9 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -6132,14 +6132,14 @@ public class StaticEndpointBuilders { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail * * Syntax: <code>google-mail-stream:index</code> * * Path parameter: index - * Specifies an index for the endpoint + * Currently not in use * * @param path index */ @@ -6151,14 +6151,14 @@ public class StaticEndpointBuilders { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail * * Syntax: <code>google-mail-stream:index</code> * * Path parameter: index - * Specifies an index for the endpoint + * Currently not in use * * @param componentName to use a custom component name for the endpoint * instead of the default name diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleMailStreamEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleMailStreamEndpointBuilderFactory.java index 74d2565..624ea28 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleMailStreamEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleMailStreamEndpointBuilderFactory.java @@ -47,18 +47,6 @@ public interface GoogleMailStreamEndpointBuilderFactory { return (AdvancedGoogleMailStreamEndpointBuilder) this; } /** - * OAuth 2 access token. This typically expires after an hour so - * refreshToken is recommended for long term usage. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamEndpointBuilder accessToken(String accessToken) { - doSetProperty("accessToken", accessToken); - return this; - } - /** * Google mail application name. Example would be camel-google-mail/1.0. * * The option is a: <code>java.lang.String</code> type. @@ -120,17 +108,6 @@ public interface GoogleMailStreamEndpointBuilderFactory { return this; } /** - * Client secret of the mail application. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamEndpointBuilder clientSecret(String clientSecret) { - doSetProperty("clientSecret", clientSecret); - return this; - } - /** * Comma separated list of labels to take into account. * * The option is a: <code>java.lang.String</code> type. @@ -202,19 +179,6 @@ public interface GoogleMailStreamEndpointBuilderFactory { return this; } /** - * OAuth 2 refresh token. Using this, the Google Calendar component can - * obtain a new accessToken whenever the current one expires - a - * necessity if the application is long-lived. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: consumer - */ - default GoogleMailStreamEndpointBuilder refreshToken(String refreshToken) { - doSetProperty("refreshToken", refreshToken); - return this; - } - /** * If the polling consumer did not poll any files, you can enable this * option to send an empty message (no body) instead. * @@ -628,6 +592,42 @@ public interface GoogleMailStreamEndpointBuilderFactory { doSetProperty("useFixedDelay", useFixedDelay); return this; } + /** + * OAuth 2 access token. This typically expires after an hour so + * refreshToken is recommended for long term usage. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamEndpointBuilder accessToken(String accessToken) { + doSetProperty("accessToken", accessToken); + return this; + } + /** + * Client secret of the mail application. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamEndpointBuilder clientSecret(String clientSecret) { + doSetProperty("clientSecret", clientSecret); + return this; + } + /** + * OAuth 2 refresh token. Using this, the Google Calendar component can + * obtain a new accessToken whenever the current one expires - a + * necessity if the application is long-lived. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + */ + default GoogleMailStreamEndpointBuilder refreshToken(String refreshToken) { + doSetProperty("refreshToken", refreshToken); + return this; + } } /** @@ -791,14 +791,14 @@ public interface GoogleMailStreamEndpointBuilderFactory { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail * * Syntax: <code>google-mail-stream:index</code> * * Path parameter: index - * Specifies an index for the endpoint + * Currently not in use * * @param path index */ @@ -809,14 +809,14 @@ public interface GoogleMailStreamEndpointBuilderFactory { * Google Mail Stream (camel-google-mail) * Poll for incoming messages in Google Mail. * - * Category: api,cloud,mail + * Category: cloud,api,mail * Since: 2.22 * Maven coordinates: org.apache.camel:camel-google-mail * * Syntax: <code>google-mail-stream:index</code> * * Path parameter: index - * Specifies an index for the endpoint + * Currently not in use * * @param componentName to use a custom component name for the endpoint * instead of the default name diff --git a/docs/components/modules/ROOT/pages/google-mail-stream-component.adoc b/docs/components/modules/ROOT/pages/google-mail-stream-component.adoc index 7a34fe5..7f1aa5e 100644 --- a/docs/components/modules/ROOT/pages/google-mail-stream-component.adoc +++ b/docs/components/modules/ROOT/pages/google-mail-stream-component.adoc @@ -62,19 +62,19 @@ The Google Mail Stream component supports 13 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *basicPropertyBinding* (advanced) | *Deprecated* Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean | *clientFactory* (advanced) | The client Factory | | GoogleMailClientFactory | *configuration* (advanced) | The configuration | | GoogleMailStreamConfiguration +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |=== // component options: END @@ -96,7 +96,7 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *index* | Specifies an index for the endpoint | | String +| *index* | Currently not in use | | String |=== @@ -106,16 +106,13 @@ with the following path and query parameters: [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type -| *accessToken* (consumer) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String | *applicationName* (consumer) | Google mail application name. Example would be camel-google-mail/1.0 | | String | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *clientId* (consumer) | Client ID of the mail application | | String -| *clientSecret* (consumer) | Client secret of the mail application | | String | *labels* (consumer) | Comma separated list of labels to take into account | | String | *markAsRead* (consumer) | Mark the message as read once it has been consumed | false | boolean | *maxResults* (consumer) | Max results to be returned | 10 | long | *query* (consumer) | The query to execute on gmail box | is:unread | String -| *refreshToken* (consumer) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern @@ -136,6 +133,9 @@ with the following path and query parameters: | *startScheduler* (scheduler) | Whether the scheduler should be auto started. | true | boolean | *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit | *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean +| *accessToken* (security) | OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | | String +| *clientSecret* (security) | Client secret of the mail application | | String +| *refreshToken* (security) | OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | | String |===