You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

Camel Dropbox component

Available as of Camel x.xx

The dropbox: component allows you to treat Dropbox remote folders as a producer or consumer of messages. Using the Dropbox Java Core API (reference version for this component is 1.7.x), this camel component has the following features:

  • As a consumer, download files and search files by queries
  • As a producer, download files, move files between remote directories, delete files/dir, upload files and search files by queries

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

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

URI format

dropbox://[operation]?[options]

Where operation is the specific action (typically is a CRUD action) to perform on Dropbox remote folder.

Operation 

Unknown macro: {div}

Operation

Description

del

deletes files or directories on Dropbox

get

download files from Dropbox

move

move files from folders on Dropbox

put

upload files on Dropbox

search

search files on Dropbox based on string queries

Operations require additional options to work, some are mandatory for the specific operation.

Options

In order to work with Dropbox API you need to obtain an accessToken and a clientIdentifier
You can refer to the Dropbox documentation that expalins how to get them  

Below are listed the mandatory options for all operations:

 

Unknown macro: {div}

Property

Mandatory

Description

accessToken

true

The access token to make API requests for a specific Dropbox user

clientIdentifier

true

Name of the app registered to make API requests

Del operation

Delete files on Dropbox.

Works only as Camel producer.

Below are listed the options for this operation:

Unknown macro: {div}

Property

Mandatory

Description

remotePath

true

Folder or file to delete on Dropbox

Samples

from("direct:start").to("dropbox://del?accessToken=XXX&clientIdentifier=XXX&remotePath=/root/folder1").to("mock:result");

from("direct:start").to("dropbox://del?accessToken=XXX&clientIdentifier=XXX&remotePath=/root/folder1/file1.tar.gz").to("mock:result");

Result Message Headers

The following headers are set on message result:

Unknown macro: {div}

Property

Value

DELETED_PATH

name of the path deleted on dropbox

Result Message Body

The following objects are set on message body result:

Unknown macro: {div}

Object type

Description

String

name of the path deleted on dropbox

Get (download) operation

Download files from Dropbox.

Works as Camel producer or Camel consumer.

Below are listed the options for this operation:

Unknown macro: {div}

Property

Mandatory

Description

remotePath

true

Folder or file to download from Dropbox

Samples

from("direct:start").to("dropbox://get?accessToken=XXX&clientIdentifier=XXX&remotePath=/root/folder1/file1.tar.gz").to("file:///home/kermit/?fileName=file1.tar.gz");

from("direct:start").to("dropbox://get?accessToken=XXX&clientIdentifier=XXX&remotePath=/root/folder1").to("mock:result");

from("dropbox://get?accessToken=XXX&clientIdentifier=XXX&remotePath=/root/folder1").to("file:///home/kermit/");

Result Message Headers

The following headers are set on message result:

Unknown macro: {div}

Property

Value

DOWNLOADED_FILE

in case of single file download, path of the remote file downloaded

DOWNLOADED_FILES

in case of multiple files download, path of the remote files downloaded

Result Message Body

The following objects are set on message body result:

Unknown macro: {div}

Object type

Description

ByteArrayOutputStream

in case of single file download, stream representing the file downloaded

Map<String, ByteArrayOutputStream>

in case of multiple files download, a map with as key the path of the remote file downloaded and as value the stream representing the file downloaded

  • No labels