Google Drive

Since Camel 2.14

Both producer and consumer are supported

The Google Drive component provides access to the Google Drive file storage service via the Google Drive Web APIs.

Google Drive uses the OAuth 2.0 protocol for authenticating a Google account and authorizing access to user data. Before you can use this component, you will need to create an account and generate OAuth credentials. Credentials comprise of a clientId, clientSecret, and a refreshToken. A handy resource for generating a long-lived refreshToken is the OAuth playground.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-google-drive</artifactId>
        <!-- use the same version as your Camel core version -->
        <version>x.x.x</version>
</dependency>

URI Format

The GoogleDrive Component uses the following URI format:

google-drive://endpoint-prefix/endpoint?[options]

Component options

The Google Drive component supports 11 options, which are listed below.

Name Description Default Type

applicationName (common)

Google drive application name. Example would be camel-google-drive/1.0

String

clientId (common)

Client ID of the drive application

String

configuration (common)

To use the shared configuration

GoogleDriveConfiguration

scopes (common)

Specifies the level of permissions you want a drive application to have to a user account. See https://developers.google.com/drive/web/scopes for more info.

List

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

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

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)

To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory

GoogleDriveClientFactory

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 drive 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

The Google Drive endpoint is configured using URI syntax:

google-drive:apiName/methodName

with the following path and query parameters:

Path Parameters (2 parameters):

Name Description Default Type

apiName

Required What kind of operation to perform. There are 13 enums and the value can be one of: DRIVE_ABOUT, DRIVE_APPS, DRIVE_CHANGES, DRIVE_CHANNELS, DRIVE_CHILDREN, DRIVE_COMMENTS, DRIVE_FILES, DRIVE_PARENTS, DRIVE_PERMISSIONS, DRIVE_PROPERTIES, DRIVE_REALTIME, DRIVE_REPLIES, DRIVE_REVISIONS

GoogleDriveApiName

methodName

Required What sub operation to use for the selected operation. There are 13 enums and the value can be one of: copy, delete, get, getIdForEmail, insert, list, patch, stop, touch, trash, untrash, update, watch

String

Query Parameters (30 parameters):

Name Description Default Type

applicationName (common)

Google drive application name. Example would be camel-google-drive/1.0

String

clientFactory (common)

To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory

GoogleDriveClientFactory

clientId (common)

Client ID of the drive application

String

inBody (common)

Sets the name of a parameter to be passed in the exchange In Body

String

scopes (common)

Specifies the level of permissions you want a drive application to have to a user account. See https://developers.google.com/drive/web/scopes for more info.

List

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

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

pollStrategy (consumer)

A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.

PollingConsumerPollStrategy

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

basicPropertyBinding (advanced)

Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities

false

boolean

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

backoffErrorThreshold (scheduler)

The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.

int

backoffIdleThreshold (scheduler)

The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.

int

backoffMultiplier (scheduler)

To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.

int

delay (scheduler)

Milliseconds before the next poll.

500

long

greedy (scheduler)

If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.

false

boolean

initialDelay (scheduler)

Milliseconds before the first poll starts.

1000

long

repeatCount (scheduler)

Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever.

0

long

runLoggingLevel (scheduler)

The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. There are 6 enums and the value can be one of: TRACE, DEBUG, INFO, WARN, ERROR, OFF

TRACE

LoggingLevel

scheduledExecutorService (scheduler)

Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool.

ScheduledExecutorService

scheduler (scheduler)

To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler

none

Object

schedulerProperties (scheduler)

To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler.

Map

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 drive 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

API Parameters (12 APIs):

The Google Drive endpoint is an API based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:

google-drive:apiName/methodName

There are 12 API names as listed in the table below:

API Name Type Description

drive-apps

Both

The apps collection of methods

drive-changes

Both

The changes collection of methods

drive-channels

Both

The channels collection of methods

drive-children

Both

The children collection of methods

drive-comments

Both

The comments collection of methods

drive-files

Both

The files collection of methods

drive-parents

Both

The parents collection of methods

drive-permissions

Both

The permissions collection of methods

drive-properties

Both

The properties collection of methods

drive-realtime

Both

The realtime collection of methods

drive-replies

Both

The replies collection of methods

drive-revisions

Both

The revisions collection of methods

Each API is documented in the following sections to come.

API: drive-apps

Both producer and consumer are supported

The drive-apps API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Apps.Get get(String appId);

The drive-apps API is defined in the syntax as follows:

google-drive:drive-apps/methodName?[parameters]

The 1 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

get

Gets a specific app

The drive-apps API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

get

appId

The ID of the app

String

In addition to the parameters above, the drive-apps API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-changes

Both producer and consumer are supported

The drive-changes API has 2 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Changes.Get get(String changeId);

com.google.api.services.drive.Drive.Changes.Watch watch(com.google.api.services.drive.model.Channel content);

The drive-changes API is defined in the syntax as follows:

google-drive:drive-changes/methodName?[parameters]

The 2 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

get

Deprecated - Use changes

watch

Subscribe to changes for a user

The drive-changes API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

get

changeId

The ID of the change

String

watch

contentChannel

The com.google.api.services.drive.model.Channel

Channel

In addition to the parameters above, the drive-changes API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-channels

Both producer and consumer are supported

The drive-channels API has 1 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Channels.Stop stop(com.google.api.services.drive.model.Channel content);

The drive-channels API is defined in the syntax as follows:

google-drive:drive-channels/methodName?[parameters]

The 1 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

stop

Stop watching resources through this channel

The drive-channels API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

stop

contentChannel

The com.google.api.services.drive.model.Channel

Channel

In addition to the parameters above, the drive-channels API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-children

Both producer and consumer are supported

The drive-children API has 4 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Children.Delete delete(String folderId, String childId);

com.google.api.services.drive.Drive.Children.Get get(String folderId, String childId);

com.google.api.services.drive.Drive.Children.Insert insert(String folderId, com.google.api.services.drive.model.ChildReference content);

com.google.api.services.drive.Drive.Children.List list(String folderId);

The drive-children API is defined in the syntax as follows:

google-drive:drive-children/methodName?[parameters]

The 4 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Removes a child from a folder

get

Gets a specific child reference

insert

Inserts a file into a folder

list

Lists a folder’s children

The drive-children API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

childId

The ID of the child

String

delete

folderId

The ID of the folder

String

get

childId

The ID of the child

String

get

folderId

The ID of the folder

String

insert

content

The com.google.api.services.drive.model.ChildReference

ChildReference

insert

folderId

The ID of the folder

String

list

folderId

The ID of the folder

String

In addition to the parameters above, the drive-children API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-comments

Both producer and consumer are supported

The drive-comments API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Comments.Delete delete(String fileId, String commentId);

com.google.api.services.drive.Drive.Comments.Get get(String fileId, String commentId);

com.google.api.services.drive.Drive.Comments.Insert insert(String fileId, com.google.api.services.drive.model.Comment content);

com.google.api.services.drive.Drive.Comments.List list(String fileId);

com.google.api.services.drive.Drive.Comments.Patch patch(String fileId, String commentId, com.google.api.services.drive.model.Comment content);

com.google.api.services.drive.Drive.Comments.Update update(String fileId, String commentId, com.google.api.services.drive.model.Comment content);

The drive-comments API is defined in the syntax as follows:

google-drive:drive-comments/methodName?[parameters]

The 6 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Deletes a comment

get

Gets a comment by ID

insert

Creates a new comment on the given file

list

Lists a file’s comments

patch

Updates an existing comment

update

Updates an existing comment

The drive-comments API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

commentId

The ID of the comment

String

delete

fileId

The ID of the file

String

get

commentId

The ID of the comment

String

get

fileId

The ID of the file

String

insert

content

The com.google.api.services.drive.model.Comment

Comment

insert

fileId

The ID of the file

String

list

fileId

The ID of the file

String

patch

commentId

The ID of the comment

String

patch

content

The com.google.api.services.drive.model.Comment

Comment

patch

fileId

The ID of the file

String

update

commentId

The ID of the comment

String

update

content

The com.google.api.services.drive.model.Comment

Comment

update

fileId

The ID of the file

String

In addition to the parameters above, the drive-comments API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-files

Both producer and consumer are supported

The drive-files API has 11 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Files.Copy copy(String fileId, com.google.api.services.drive.model.File content);

com.google.api.services.drive.Drive.Files.Delete delete(String fileId);

com.google.api.services.drive.Drive.Files.Export export(String fileId, String mimeType);

com.google.api.services.drive.Drive.Files.Get get(String fileId);

com.google.api.services.drive.Drive.Files.Insert insert(com.google.api.services.drive.model.File content);

com.google.api.services.drive.Drive.Files.Insert insert(com.google.api.services.drive.model.File content, com.google.api.client.http.AbstractInputStreamContent mediaContent);

com.google.api.services.drive.Drive.Files.Patch patch(String fileId, com.google.api.services.drive.model.File content);

com.google.api.services.drive.Drive.Files.Touch touch(String fileId);

com.google.api.services.drive.Drive.Files.Trash trash(String fileId);

com.google.api.services.drive.Drive.Files.Untrash untrash(String fileId);

com.google.api.services.drive.Drive.Files.Update update(String fileId, com.google.api.services.drive.model.File content);

com.google.api.services.drive.Drive.Files.Update update(String fileId, com.google.api.services.drive.model.File content, com.google.api.client.http.AbstractInputStreamContent mediaContent);

com.google.api.services.drive.Drive.Files.Watch watch(String fileId, com.google.api.services.drive.model.Channel content);

The drive-files API is defined in the syntax as follows:

google-drive:drive-files/methodName?[parameters]

The 11 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

copy

Creates a copy of the specified file

delete

Permanently deletes a file by ID

export

Exports a Google Doc to the requested MIME type and returns the exported content

get

Gets a file’s metadata by ID

insert

Insert a new file

patch

Updates file metadata and/or content

touch

Set the file’s updated time to the current server time

trash

Moves a file to the trash

untrash

Restores a file from the trash

update

Updates file metadata and/or content

watch

Subscribe to changes on a file

The drive-files API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

copy

content

The com.google.api.services.drive.model.File

File

copy

fileId

The ID of the file to copy

String

delete

fileId

The ID of the file to delete

String

export

fileId

The ID of the file

String

export

mimeType

The MIME type of the format requested for this export

String

get

fileId

The ID for the file in question

String

insert

content

The com.google.api.services.drive.model.File media metadata or null if none

File

insert

mediaContent

The media HTTP content or null if none

AbstractInputStreamContent

patch

content

The com.google.api.services.drive.model.File

File

patch

fileId

The ID of the file to update

String

touch

fileId

The ID of the file to update

String

trash

fileId

The ID of the file to trash

String

untrash

fileId

The ID of the file to untrash

String

update

content

The com.google.api.services.drive.model.File media metadata or null if none

File

update

fileId

The ID of the file to update

String

update

mediaContent

The media HTTP content or null if none

AbstractInputStreamContent

watch

contentChannel

The com.google.api.services.drive.model.Channel

Channel

watch

fileId

The ID for the file in question

String

In addition to the parameters above, the drive-files API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-parents

Both producer and consumer are supported

The drive-parents API has 4 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Parents.Delete delete(String fileId, String parentId);

com.google.api.services.drive.Drive.Parents.Get get(String fileId, String parentId);

com.google.api.services.drive.Drive.Parents.Insert insert(String fileId, com.google.api.services.drive.model.ParentReference content);

com.google.api.services.drive.Drive.Parents.List list(String fileId);

The drive-parents API is defined in the syntax as follows:

google-drive:drive-parents/methodName?[parameters]

The 4 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Removes a parent from a file

get

Gets a specific parent reference

insert

Adds a parent folder for a file

list

Lists a file’s parents

The drive-parents API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

fileId

The ID of the file

String

delete

parentId

The ID of the parent

String

get

fileId

The ID of the file

String

get

parentId

The ID of the parent

String

insert

content

The com.google.api.services.drive.model.ParentReference

ParentReference

insert

fileId

The ID of the file

String

list

fileId

The ID of the file

String

In addition to the parameters above, the drive-parents API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-permissions

Both producer and consumer are supported

The drive-permissions API has 7 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Permissions.Delete delete(String fileId, String permissionId);

com.google.api.services.drive.Drive.Permissions.Get get(String fileId, String permissionId);

com.google.api.services.drive.Drive.Permissions.GetIdForEmail getIdForEmail(String email);

com.google.api.services.drive.Drive.Permissions.Insert insert(String fileId, com.google.api.services.drive.model.Permission content);

com.google.api.services.drive.Drive.Permissions.List list(String fileId);

com.google.api.services.drive.Drive.Permissions.Patch patch(String fileId, String permissionId, com.google.api.services.drive.model.Permission content);

com.google.api.services.drive.Drive.Permissions.Update update(String fileId, String permissionId, com.google.api.services.drive.model.Permission content);

The drive-permissions API is defined in the syntax as follows:

google-drive:drive-permissions/methodName?[parameters]

The 7 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Deletes a permission from a file or Team Drive

get

Gets a permission by ID

getIdForEmail

Returns the permission ID for an email address

insert

Inserts a permission for a file or Team Drive

list

Lists a file’s or Team Drive’s permissions

patch

Updates a permission using patch semantics

update

Updates a permission

The drive-permissions API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

fileId

The ID for the file or Team Drive

String

delete

permissionId

The ID for the permission

String

get

fileId

The ID for the file or Team Drive

String

get

permissionId

The ID for the permission

String

getIdForEmail

email

The email address for which to return a permission ID

String

insert

content

The com.google.api.services.drive.model.Permission

Permission

insert

fileId

The ID for the file or Team Drive

String

list

fileId

The ID for the file or Team Drive

String

patch

content

The com.google.api.services.drive.model.Permission

Permission

patch

fileId

The ID for the file or Team Drive

String

patch

permissionId

The ID for the permission

String

update

content

The com.google.api.services.drive.model.Permission

Permission

update

fileId

The ID for the file or Team Drive

String

update

permissionId

The ID for the permission

String

In addition to the parameters above, the drive-permissions API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-properties

Both producer and consumer are supported

The drive-properties API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Properties.Delete delete(String fileId, String propertyKey);

com.google.api.services.drive.Drive.Properties.Get get(String fileId, String propertyKey);

com.google.api.services.drive.Drive.Properties.Insert insert(String fileId, com.google.api.services.drive.model.Property content);

com.google.api.services.drive.Drive.Properties.List list(String fileId);

com.google.api.services.drive.Drive.Properties.Patch patch(String fileId, String propertyKey, com.google.api.services.drive.model.Property content);

com.google.api.services.drive.Drive.Properties.Update update(String fileId, String propertyKey, com.google.api.services.drive.model.Property content);

The drive-properties API is defined in the syntax as follows:

google-drive:drive-properties/methodName?[parameters]

The 6 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Deletes a property

get

Gets a property by its key

insert

Adds a property to a file, or updates it if it already exists

list

Lists a file’s properties

patch

Updates a property, or adds it if it doesn’t exist

update

Updates a property, or adds it if it doesn’t exist

The drive-properties API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

fileId

The ID of the file

String

delete

propertyKey

The key of the property

String

get

fileId

The ID of the file

String

get

propertyKey

The key of the property

String

insert

content

The com.google.api.services.drive.model.Property

Property

insert

fileId

The ID of the file

String

list

fileId

The ID of the file

String

patch

content

The com.google.api.services.drive.model.Property

Property

patch

fileId

The ID of the file

String

patch

propertyKey

The key of the property

String

update

content

The com.google.api.services.drive.model.Property

Property

update

fileId

The ID of the file

String

update

propertyKey

The key of the property

String

In addition to the parameters above, the drive-properties API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-realtime

Both producer and consumer are supported

The drive-realtime API has 2 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Realtime.Get get(String fileId);

com.google.api.services.drive.Drive.Realtime.Update update(String fileId);

com.google.api.services.drive.Drive.Realtime.Update update(String fileId, com.google.api.client.http.AbstractInputStreamContent mediaContent);

The drive-realtime API is defined in the syntax as follows:

google-drive:drive-realtime/methodName?[parameters]

The 2 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

get

Exports the contents of the Realtime API data model associated with this file as JSON

update

Overwrites the Realtime API data model associated with this file with the provided JSON data model

The drive-realtime API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

get

fileId

The ID of the file that the Realtime API data model is associated with

String

update

fileId

The ID of the file that the Realtime API data model is associated with

String

update

mediaContent

The media HTTP content or null if none

AbstractInputStreamContent

In addition to the parameters above, the drive-realtime API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-replies

Both producer and consumer are supported

The drive-replies API has 6 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Replies.Delete delete(String fileId, String commentId, String replyId);

com.google.api.services.drive.Drive.Replies.Get get(String fileId, String commentId, String replyId);

com.google.api.services.drive.Drive.Replies.Insert insert(String fileId, String commentId, com.google.api.services.drive.model.CommentReply content);

com.google.api.services.drive.Drive.Replies.List list(String fileId, String commentId);

com.google.api.services.drive.Drive.Replies.Patch patch(String fileId, String commentId, String replyId, com.google.api.services.drive.model.CommentReply content);

com.google.api.services.drive.Drive.Replies.Update update(String fileId, String commentId, String replyId, com.google.api.services.drive.model.CommentReply content);

The drive-replies API is defined in the syntax as follows:

google-drive:drive-replies/methodName?[parameters]

The 6 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Deletes a reply

get

Gets a reply

insert

Creates a new reply to the given comment

list

Lists all of the replies to a comment

patch

Updates an existing reply

update

Updates an existing reply

The drive-replies API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

commentId

The ID of the comment

String

delete

fileId

The ID of the file

String

delete

replyId

The ID of the reply

String

get

commentId

The ID of the comment

String

get

fileId

The ID of the file

String

get

replyId

The ID of the reply

String

insert

commentId

The ID of the comment

String

insert

content

The com.google.api.services.drive.model.CommentReply

CommentReply

insert

fileId

The ID of the file

String

list

commentId

The ID of the comment

String

list

fileId

The ID of the file

String

patch

commentId

The ID of the comment

String

patch

content

The com.google.api.services.drive.model.CommentReply

CommentReply

patch

fileId

The ID of the file

String

patch

replyId

The ID of the reply

String

update

commentId

The ID of the comment

String

update

content

The com.google.api.services.drive.model.CommentReply

CommentReply

update

fileId

The ID of the file

String

update

replyId

The ID of the reply

String

In addition to the parameters above, the drive-replies API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

API: drive-revisions

Both producer and consumer are supported

The drive-revisions API has 5 method(s) which is represented by the following method signatures (an API method may have multiple signatures due to overloading):

com.google.api.services.drive.Drive.Revisions.Delete delete(String fileId, String revisionId);

com.google.api.services.drive.Drive.Revisions.Get get(String fileId, String revisionId);

com.google.api.services.drive.Drive.Revisions.List list(String fileId);

com.google.api.services.drive.Drive.Revisions.Patch patch(String fileId, String revisionId, com.google.api.services.drive.model.Revision content);

com.google.api.services.drive.Drive.Revisions.Update update(String fileId, String revisionId, com.google.api.services.drive.model.Revision content);

The drive-revisions API is defined in the syntax as follows:

google-drive:drive-revisions/methodName?[parameters]

The 5 method(s) is listed in the table below. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

delete

Removes a revision

get

Gets a specific revision

list

Lists a file’s revisions

patch

Updates a revision

update

Updates a revision

The drive-revisions API method(s) has the following set of parameters listed in the table below:

Method Parameter Description Type

delete

fileId

The ID of the file

String

delete

revisionId

The ID of the revision

String

get

fileId

The ID of the file

String

get

revisionId

The ID of the revision

String

list

fileId

The ID of the file

String

patch

content

The com.google.api.services.drive.model.Revision

Revision

patch

fileId

The ID for the file

String

patch

revisionId

The ID for the revision

String

update

content

The com.google.api.services.drive.model.Revision

Revision

update

fileId

The ID for the file

String

update

revisionId

The ID for the revision

String

In addition to the parameters above, the drive-revisions API can also use from the 30 endpoint query option which is listed in the Query Parameters section.

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleDrive.myParameterNameHere header.

More Information

For more information on the endpoints and options see API documentation at: https://developers.google.com/drive/v2/reference/

Spring Boot Auto-Configuration

When using google-drive with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-google-drive-starter</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>

The component supports 12 options, which are listed below.

Name Description Default Type

camel.component.google-drive.access-token

OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage.

String

camel.component.google-drive.application-name

Google drive application name. Example would be camel-google-drive/1.0

String

camel.component.google-drive.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.google-drive.bridge-error-handler

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

camel.component.google-drive.client-factory

To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory. The option is a org.apache.camel.component.google.drive.GoogleDriveClientFactory type.

GoogleDriveClientFactory

camel.component.google-drive.client-id

Client ID of the drive application

String

camel.component.google-drive.client-secret

Client secret of the drive application

String

camel.component.google-drive.configuration

To use the shared configuration. The option is a org.apache.camel.component.google.drive.GoogleDriveConfiguration type.

GoogleDriveConfiguration

camel.component.google-drive.enabled

Whether to enable auto configuration of the google-drive component. This is enabled by default.

Boolean

camel.component.google-drive.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.google-drive.refresh-token

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

camel.component.google-drive.scopes

Specifies the level of permissions you want a drive application to have to a user account. See https://developers.google.com/drive/web/scopes for more info.

List