public class

DropboxConnector

extends Object
java.lang.Object
   ↳ org.mule.modules.dropbox.DropboxConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Dropbox Cloud Connector. The Dropbox Connector will allow to use the Dropbox REST API. Almost every operation that can be done via the API can be done thru this connector.

Summary

Constants
int MAX_UPLOAD_BUFFER_LEN
String ROOT_PARAM
Fields
private String accessToken
private String accessTokenIdentifier
private WebResource apiResource
private String appKey Application key
private String appSecret Application secret
private WebResource contentResource
private String contentServer URL of the Dropbox server content API
private JerseyUtil jerseyUtil
private JerseyUtil jerseyUtilUpload
private String server URL of the Dropbox server API
Public Constructors
DropboxConnector()
Public Methods
Item copy(String from, String to)
Copies a file or folder to a new location.
Item createFolder(String path)
Create new folder on Dropbox
Item delete(String path)
Deletes a file or folder.
InputStream downloadFile(String path, boolean delete)
Downloads a file from Dropbox
String getAccessToken()
AccountInformation getAccount()
Requests the account's information.
String getAppKey()
String getAppSecret()
String getContentServer()
Link getLink(String path, Boolean shortUrl)
Creates and returns a Dropbox link to files or folders users can use to view a preview of the file in a web browser.
String getOAuthTokenAccessIdentifier()
String getServer()
void init()
This method initiates the dropbox client and the auth callback.
Item list(String path)
Lists the content of the remote directory
Item move(String from, String to)
Moves a file or folder to a new location.
void setAccessToken(String accessToken)
void setAppKey(String appKey)
void setAppSecret(String appSecret)
void setContentServer(String contentServer)
void setServer(String server)
Item uploadLongStream(InputStream fileData, Boolean overwrite, String path, String filename)
Upload file to Dropbox.
Item uploadStream(InputStream fileData, Boolean overwrite, String path, String filename)
Upload file to Dropbox.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final int MAX_UPLOAD_BUFFER_LEN

Constant Value: 4194304 (0x00400000)

private static final String ROOT_PARAM

Constant Value: "dropbox"

Fields

private String accessToken

private String accessTokenIdentifier

private WebResource apiResource

private String appKey

Application key

private String appSecret

Application secret

private WebResource contentResource

private String contentServer

URL of the Dropbox server content API

private JerseyUtil jerseyUtil

private JerseyUtil jerseyUtilUpload

private String server

URL of the Dropbox server API

Public Constructors

public DropboxConnector ()

Public Methods

public Item copy (String from, String to)

Copies a file or folder to a new location.

Parameters
from Specifies the file or folder to be copied from, relative to root.
to Specifies the destination path, including the new name for the file or folder, relative to root.
Returns
  • Item with the metadata of the copied object
Throws
Exception exception

public Item createFolder (String path)

Create new folder on Dropbox

Parameters
path Full path of the folder to be created
Returns
  • Item with the metadata of the created folder
Throws
Exception exception

public Item delete (String path)

Deletes a file or folder.

Parameters
path Full path to the file to be deleted
Returns
  • Item with the metadata of the deleted object
Throws
Exception exception

public InputStream downloadFile (String path, boolean delete)

Downloads a file from Dropbox

Parameters
path Path to the file
delete Delete the file on the Dropbox after download (ignored if moveTo is set)
Returns
  • Stream containing the downloaded file data
Throws
Exception exception

public String getAccessToken ()

public AccountInformation getAccount ()

Requests the account's information.

Returns
  • AccountInformation. A Dropbox account's information.
Throws
Exception exception

public String getAppKey ()

public String getAppSecret ()

public String getContentServer ()

public Link getLink (String path, Boolean shortUrl)

Creates and returns a Dropbox link to files or folders users can use to view a preview of the file in a web browser.

Parameters
path The path to the file or folder you want to link to.
shortUrl Boolean indicating if the url returned will be shortened using the Dropbox url shortener (when true) or will link directly to the file's preview page (when false).
Returns
  • Link. A Dropbox link to the given path.
Throws
Exception exception

public String getOAuthTokenAccessIdentifier ()

Throws
Exception

public String getServer ()

public void init ()

This method initiates the dropbox client and the auth callback.

Throws
MuleException

public Item list (String path)

Lists the content of the remote directory

Parameters
path Path to the remote directory
Returns
  • List of files and/or folders
Throws
Exception exception

public Item move (String from, String to)

Moves a file or folder to a new location.

Parameters
from Specifies the file or folder to be moved from, relative to root.
to Specifies the destination path, including the new name for the file or folder, relative to root.
Returns
  • Item with the metadata of the moved object
Throws
Exception exception

public void setAccessToken (String accessToken)

Parameters
accessToken

public void setAppKey (String appKey)

Parameters
appKey

public void setAppSecret (String appSecret)

Parameters
appSecret

public void setContentServer (String contentServer)

Parameters
contentServer

public void setServer (String server)

Parameters
server

public Item uploadLongStream (InputStream fileData, Boolean overwrite, String path, String filename)

Upload file to Dropbox. The payload is an InputStream containing bytes of the data to be uploaded. This version of the method supports streams of arbitrary length

Parameters
fileData File to be uploaded
overwrite Overwrite file in case it already exists
path The destination path
filename The destination file name
Returns
  • Item with the metadata of the uploaded object
Throws
Exception exception

public Item uploadStream (InputStream fileData, Boolean overwrite, String path, String filename)

Upload file to Dropbox. The payload is an InputStream containing bytes of the data to be uploaded. You can upload files of up to 150MB with this method. Use upload-long-stream for larger files

Parameters
fileData File to be uploaded
overwrite Overwrite file in case it already exists
path The destination path
filename The destination file name
Returns
  • Item with the metadata of the uploaded object
Throws
Exception exception