public class

DropboxConnector

extends Object
java.lang.Object
   ↳ com.mulesoft.module.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
String API_CONTENT_URL
String API_VERSION
String ROOT_PARAM
Fields
private String accessToken
private String accessTokenSecret
private String appKey Application key
private String appSecret Application secret
private Client client
private String contentServer URL of the Dropbox server content API
private boolean debug debug mode
private int port Dropbox server port
private String server URL of the Dropbox server API
Public Constructors
DropboxConnector()
Public Methods
String copy(String from, String to)
Copies a file or folder to a new location.
String createFolder(String path)
Create new folder on Dropbox
String delete(String path)
Deletes a file or folder.
InputStream downloadFile(String path, boolean delete)
Downloads a file from Dropbox
String getAccessToken()
String getAccessTokenSecret()
String getAppKey()
String getAppSecret()
String getContentServer()
String 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.
int getPort()
String getServer()
boolean isDebug()
List<String> list(String path)
Lists the content of the remote directory
String move(String from, String to)
Moves a file or folder to a new location.
void setAccessToken(String accessToken)
void setAccessTokenSecret(String accessTokenSecret)
void setAppKey(String appKey)
void setAppSecret(String appSecret)
void setContentServer(String contentServer)
void setDebug(boolean debug)
void setPort(int port)
void setServer(String server)
String uploadFile(InputStream fileDataObj, Boolean overwrite, String path, String filename)
Upload file to Dropbox.
Protected Methods
String getApiContentUrl(String path)
Client getClient()
OAuthClientFilter getOAuthClientFilter(String accessToken, String accessTokenSecret)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final String API_CONTENT_URL

Constant Value: "files/dropbox"

private static final String API_VERSION

Constant Value: "1"

private static final String ROOT_PARAM

Constant Value: "dropbox"

Fields

private String accessToken

private String accessTokenSecret

private String appKey

Application key

private String appSecret

Application secret

private Client client

private String contentServer

URL of the Dropbox server content API

private boolean debug

debug mode

private int port

Dropbox server port

private String server

URL of the Dropbox server API

Public Constructors

public DropboxConnector ()

Public Methods

public String 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
  • http response
Throws
Exception exception

public String createFolder (String path)

Create new folder on Dropbox

Parameters
path Full path of the folder to be created
Returns
  • http response
Throws
Exception exception

public String delete (String path)

Deletes a file or folder.

Parameters
path Full path to the file to be deleted
Returns
  • http response
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 String getAccessTokenSecret ()

public String getAppKey ()

public String getAppSecret ()

public String getContentServer ()

public String 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
  • String. A Dropbox link to the given path.
Throws
Exception exception

public int getPort ()

public String getServer ()

public boolean isDebug ()

public List<String> 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 String 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
  • http response
Throws
Exception exception

public void setAccessToken (String accessToken)

Parameters
accessToken

public void setAccessTokenSecret (String accessTokenSecret)

Parameters
accessTokenSecret

public void setAppKey (String appKey)

Parameters
appKey

public void setAppSecret (String appSecret)

Parameters
appSecret

public void setContentServer (String contentServer)

Parameters
contentServer

public void setDebug (boolean debug)

Parameters
debug

public void setPort (int port)

Parameters
port

public void setServer (String server)

Parameters
server

public String uploadFile (InputStream fileDataObj, Boolean overwrite, String path, String filename)

Upload file to Dropbox. The payload is an InputStream containing bytes of the data to be uploaded.

Parameters
fileDataObj File to be uploaded
overwrite Overwrite file in case it already exists
path The destination path
filename The destination file name
Returns
  • http response
Throws
Exception exception

Protected Methods

protected String getApiContentUrl (String path)

Parameters
path

protected Client getClient ()

protected OAuthClientFilter getOAuthClientFilter (String accessToken, String accessTokenSecret)

Parameters
accessToken
accessTokenSecret