|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rackspacecloud.client.cloudfiles.FilesClient
public class FilesClient
A client for Cloud Files. Here follows a basic example of logging in, creating a container and an object, retrieving the object, and then deleting both the object and container. For more examples, see the code in com.rackspacecloud.client.cloudfiles.sample, which contains a series of examples.
// Create the client object for username "jdoe", password "johnsdogsname".
FilesClient myClient = FilesClient("jdoe", "johnsdogsname");
// Log in (login()
will return false if the login was unsuccessful.
assert(myClient.login());
// Make sure there are no containers in the account
assert(myClient.listContainers.length() == 0);
// Create the container
assert(myClient.createContainer("myContainer"));
// Now we should have one
assert(myClient.listContainers.length() == 1);
// Upload the file "alpaca.jpg"
assert(myClient.storeObject("myContainer", new File("alapca.jpg"), "image/jpeg"));
// Download "alpaca.jpg"
FilesObject obj = myClient.getObject("myContainer", "alpaca.jpg");
byte data[] = obj.getObject();
// Clean up after ourselves.
// Note: Order here is important, you can't delete non-empty containers.
assert(myClient.deleteObject("myContainer", "alpaca.jpg"));
assert(myClient.deleteContainer("myContainer");
Field Summary | |
---|---|
protected java.lang.String |
apikey
|
protected java.lang.String |
authenticationURL
|
protected java.lang.String |
authToken
|
protected org.apache.http.client.HttpClient |
client
|
protected int |
connectionTimeOut
|
protected java.lang.String |
email
|
protected boolean |
isLoggedin
|
protected static org.apache.log4j.Logger |
logger
|
protected java.lang.String |
storageURL
|
protected boolean |
useETag
|
static java.lang.String |
VERSION
|
Constructor Summary | |
---|---|
FilesClient()
This method uses the default connection time out of CONNECTON_TIMEOUT and username, password, and account from FilesUtil |
|
FilesClient(org.apache.http.client.HttpClient client,
java.lang.String email,
java.lang.String apikey,
java.lang.String authUrl,
int connectionTimeOut)
|
|
FilesClient(java.lang.String email,
java.lang.String apikey)
Mosso-style authentication (No accounts). |
|
FilesClient(java.lang.String email,
java.lang.String apikey,
java.lang.String authUrl)
This method uses the default connection time out of CONNECTON_TIMEOUT. |
|
FilesClient(java.lang.String email,
java.lang.String apikey,
java.lang.String authUrl,
int connectionTimeOut)
|
Method Summary | |
---|---|
boolean |
containerExists(java.lang.String container)
Convenience method to test for the existence of a container in Cloud Files. |
java.lang.String |
copyObject(java.lang.String sourceContainer,
java.lang.String sourceObjName,
java.lang.String destContainer,
java.lang.String destObjName)
This method copies the object found in the source container with the source object name to the destination container with the destination object name. |
void |
createContainer(java.lang.String name)
Creates a container |
void |
createFullPath(java.lang.String container,
java.lang.String path)
Create all of the path elements for the entire tree for a given path. |
boolean |
createManifestObject(java.lang.String container,
java.lang.String contentType,
java.lang.String name,
java.lang.String manifest,
IFilesTransferCallback callback)
Create a manifest on the server, including metadata |
boolean |
createManifestObject(java.lang.String container,
java.lang.String contentType,
java.lang.String name,
java.lang.String manifest,
java.util.Map<java.lang.String,java.lang.String> metadata)
Create a manifest on the server, including metadata |
boolean |
createManifestObject(java.lang.String container,
java.lang.String contentType,
java.lang.String name,
java.lang.String manifest,
java.util.Map<java.lang.String,java.lang.String> metadata,
IFilesTransferCallback callback)
Create a manifest on the server, including metadata |
void |
createPath(java.lang.String container,
java.lang.String path)
Creates a path (but not any of the sub portions of the path) |
boolean |
deleteContainer(java.lang.String name)
Deletes a container |
void |
deleteObject(java.lang.String container,
java.lang.String objName)
Delete the given object from it's container. |
FilesAccountInfo |
getAccountInfo()
Gets information for the given account. |
java.lang.String |
getAuthenticationURL()
The URL we will use for Authentication |
java.lang.String |
getAuthToken()
|
int |
getConnectionTimeOut()
|
FilesContainerInfo |
getContainerInfo(java.lang.String container)
Get basic information on a container (number of items and the total size). |
byte[] |
getObject(java.lang.String container,
java.lang.String objName)
Get the content of the given object |
java.io.InputStream |
getObjectAsRangedStream(java.lang.String container,
java.lang.String objName,
long offset,
long length)
|
java.io.InputStream |
getObjectAsStream(java.lang.String container,
java.lang.String objName)
Get's the given object's content as a stream |
FilesObjectMetaData |
getObjectMetaData(java.lang.String container,
java.lang.String objName)
Get an object's metadata |
java.lang.String |
getPassword()
The password the client will use for the login. |
java.lang.String |
getStorageToken()
Deprecated. |
java.lang.String |
getStorageURL()
|
boolean |
getUseETag()
|
java.lang.String |
getUserAgent()
|
java.lang.String |
getUserName()
The username we are logged in with. |
boolean |
isLoggedin()
Has this instance of the client authenticated itself? |
static boolean |
isValidContainerName(java.lang.String name)
|
static boolean |
isValidObjectName(java.lang.String name)
|
java.util.List<FilesContainer> |
listContainers()
List the containers available in an account. |
java.util.List<FilesContainer> |
listContainers(int limit)
List the containers available in an account. |
java.util.List<FilesContainer> |
listContainers(int limit,
java.lang.String marker)
List the containers available in an account. |
java.util.List<FilesContainerInfo> |
listContainersInfo()
List all of the containers available in an account, ordered by container name. |
java.util.List<FilesContainerInfo> |
listContainersInfo(int limit)
List the containers available in an account, ordered by container name. |
java.util.List<FilesContainerInfo> |
listContainersInfo(int limit,
java.lang.String marker)
List the containers available in an account, ordered by container name. |
java.util.List<FilesObject> |
listObjects(java.lang.String container)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
java.lang.Character delimiter)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
int limit)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
int limit,
java.lang.String marker)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
java.lang.String path)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
java.lang.String path,
java.lang.Character delimiter)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
java.lang.String path,
int limit)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjects(java.lang.String container,
java.lang.String path,
int limit,
java.lang.String marker)
List the objects in a container in lexicographic order. |
java.util.List<FilesObject> |
listObjectsStartingWith(java.lang.String container,
java.lang.String startsWith,
java.lang.String path,
int limit,
java.lang.String marker)
List all of the objects in a container with the given starting string. |
java.util.List<FilesObject> |
listObjectsStartingWith(java.lang.String container,
java.lang.String startsWith,
java.lang.String path,
int limit,
java.lang.String marker,
java.lang.Character delimiter)
List all of the objects in a container with the given starting string. |
boolean |
login()
Log in to CloudFiles. |
boolean |
login(java.lang.String authToken,
java.lang.String storageURL)
Log in to CloudFiles. |
static java.lang.String |
md5Sum(byte[] data)
Calculates the MD5 checksum of an array of data |
static java.lang.String |
md5Sum(java.io.File f)
Calculates the MD5 checksum of a file, returned as a hex encoded string |
static java.lang.String |
sanitizeAndPreserveSlashes(java.lang.String str)
|
static java.lang.String |
sanitizeForURI(java.lang.String str)
Encode any unicode characters that will cause us problems. |
void |
setAuthenticationURL(java.lang.String authenticationURL)
Changes the URL of the authentication service. |
void |
setConnectionTimeOut(int connectionTimeOut)
The timeout we will use for communicating with the server (in milliseconds) |
void |
setPassword(java.lang.String password)
Set's the password for this client. |
void |
setUseETag(boolean useETag)
|
void |
setUserAgent(java.lang.String userAgent)
|
void |
setUserName(java.lang.String email)
Set's the username for this client. |
boolean |
storeObject(java.lang.String container,
byte[] obj,
java.lang.String contentType,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> metadata)
Store a file on the server, including metadata |
boolean |
storeObject(java.lang.String container,
byte[] obj,
java.lang.String contentType,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> metadata,
IFilesTransferCallback callback)
Store a file on the server, including metadata |
java.lang.String |
storeObject(java.lang.String container,
java.io.File obj,
java.lang.String contentType)
Copies the file to Cloud Files, keeping the original file name in Cloud Files. |
java.lang.String |
storeObjectAs(java.lang.String container,
java.io.File obj,
java.lang.String contentType,
java.lang.String name)
Store a file on the server |
java.lang.String |
storeObjectAs(java.lang.String container,
java.io.File obj,
java.lang.String contentType,
java.lang.String name,
IFilesTransferCallback callback)
Store a file on the server |
java.lang.String |
storeObjectAs(java.lang.String container,
java.io.File obj,
java.lang.String contentType,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> metadata)
Store a file on the server, including metadata |
java.lang.String |
storeObjectAs(java.lang.String container,
java.io.File obj,
java.lang.String contentType,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> metadata,
IFilesTransferCallback callback)
Store a file on the server, including metadata |
java.lang.String |
storeObjectAs(java.lang.String container,
java.lang.String name,
org.apache.http.HttpEntity entity,
java.util.Map<java.lang.String,java.lang.String> metadata,
java.lang.String md5sum)
|
java.lang.String |
storeStreamedObject(java.lang.String container,
java.io.InputStream data,
java.lang.String contentType,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> metadata)
Store a file on the server, including metadata, with the contents coming from an input stream. |
static java.lang.String |
unencodeURI(java.lang.String str)
|
boolean |
updateObjectManifest(java.lang.String container,
java.lang.String object,
java.lang.String manifest)
|
boolean |
updateObjectMetadata(java.lang.String container,
java.lang.String object,
java.util.Map<java.lang.String,java.lang.String> metadata)
|
boolean |
updateObjectMetadataAndManifest(java.lang.String container,
java.lang.String object,
java.util.Map<java.lang.String,java.lang.String> metadata,
java.lang.String manifest)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
protected java.lang.String email
protected java.lang.String apikey
protected java.lang.String authenticationURL
protected int connectionTimeOut
protected java.lang.String storageURL
protected java.lang.String authToken
protected boolean isLoggedin
protected boolean useETag
protected org.apache.http.client.HttpClient client
protected static org.apache.log4j.Logger logger
Constructor Detail |
---|
public FilesClient(org.apache.http.client.HttpClient client, java.lang.String email, java.lang.String apikey, java.lang.String authUrl, int connectionTimeOut)
client
- The HttpClient to talk to Swiftemail
- The username to log in toapikey
- The passwordauthUrl
- The Cloud Files account to useconnectionTimeOut
- The connection timeout, in ms.public FilesClient(java.lang.String email, java.lang.String apikey, java.lang.String authUrl, int connectionTimeOut)
email
- The username to log in toapikey
- The passwordauthUrl
- The Cloud Files account to useconnectionTimeOut
- The connection timeout, in ms.public FilesClient(java.lang.String email, java.lang.String apikey, java.lang.String authUrl)
account
is null, "Mosso Style" authentication is assumed, otherwise standard Cloud Files authentication is used.
email
- apikey
- authUrl
- public FilesClient(java.lang.String email, java.lang.String apikey)
email
- Your CloudFiles usernameapikey
- Your CloudFiles API Access Keypublic FilesClient()
Method Detail |
---|
public boolean login() throws java.io.IOException, org.apache.http.HttpException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocolpublic boolean login(java.lang.String authToken, java.lang.String storageURL) throws java.io.IOException, org.apache.http.HttpException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocolpublic java.util.List<FilesContainerInfo> listContainersInfo() throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesContainerInfo> listContainersInfo(int limit) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
limit
- The maximum number of containers to return. -1 returns an unlimited number.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesContainerInfo> listContainersInfo(int limit, java.lang.String marker) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
limit
- The maximum number of containers to return. -1 returns an unlimited number.marker
- Return containers that occur after this lexicographically.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesContainer> listContainers() throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesContainer> listContainers(int limit) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
limit
- The maximum number of containers to return. -1 denotes no limit.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesContainer> listContainers(int limit, java.lang.String marker) throws java.io.IOException, org.apache.http.HttpException, FilesException
limit
- The maximum number of containers to return. -1 denotes no limit.marker
- Only return containers after this container. Null denotes starting at the beginning (lexicographically).
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjectsStartingWith(java.lang.String container, java.lang.String startsWith, java.lang.String path, int limit, java.lang.String marker) throws java.io.IOException, FilesException
container
- The container namestartsWith
- The string to start withpath
- Only look for objects in this pathlimit
- Return at most limit
objectsmarker
- Returns objects lexicographically greater than marker
. Used in conjunction with limit
to paginate the list.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjectsStartingWith(java.lang.String container, java.lang.String startsWith, java.lang.String path, int limit, java.lang.String marker, java.lang.Character delimiter) throws java.io.IOException, FilesException
container
- The container namestartsWith
- The string to start withpath
- Only look for objects in this pathlimit
- Return at most limit
objectsmarker
- Returns objects lexicographically greater than marker
. Used in conjunction with limit
to paginate the list.delimiter
- Use this argument as the delimiter that separates "directories"
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjects(java.lang.String container) throws java.io.IOException, FilesAuthorizationException, FilesException
container
- The container name
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjects(java.lang.String container, java.lang.Character delimiter) throws java.io.IOException, FilesAuthorizationException, FilesException
container
- The container namedelimiter
- Use this argument as the delimiter that separates "directories"
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjects(java.lang.String container, int limit) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namelimit
- Return at most limit
objects
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjects(java.lang.String container, java.lang.String path) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namepath
- Only look for objects in this path
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
public java.util.List<FilesObject> listObjects(java.lang.String container, java.lang.String path, java.lang.Character delimiter) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namepath
- Only look for objects in this pathdelimiter
- Use this argument as the delimiter that separates "directories"
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
public java.util.List<FilesObject> listObjects(java.lang.String container, java.lang.String path, int limit) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namepath
- Only look for objects in this pathlimit
- Return at most limit
objects
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public java.util.List<FilesObject> listObjects(java.lang.String container, java.lang.String path, int limit, java.lang.String marker) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namepath
- Only look for objects in this pathlimit
- Return at most limit
objectsmarker
- Returns objects lexicographically greater than marker
. Used in conjunction with limit
to paginate the list.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
public java.util.List<FilesObject> listObjects(java.lang.String container, int limit, java.lang.String marker) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
container
- The container namelimit
- Return at most limit
objectsmarker
- Returns objects lexicographically greater than marker
. Used in conjunction with limit
to paginate the list.
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public boolean containerExists(java.lang.String container) throws java.io.IOException, org.apache.http.HttpException
container
-
java.io.IOException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocolpublic FilesAccountInfo getAccountInfo() throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
- There was another error in the request to the server.
FilesAuthorizationException
- The client's login was invalid.public FilesContainerInfo getContainerInfo(java.lang.String container) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The container to get information for
java.io.IOException
- There was a socket level exception while talking to CloudFiles
org.apache.http.HttpException
- There was an protocol level exception while talking to Cloudfiles
FilesNotFoundException
- The container was not found
FilesAuthorizationException
- The client was not logged in or the log in expired.
FilesException
public void createContainer(java.lang.String name) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesException
name
- The name of the container to be created
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
- The client was not property logged in
FilesInvalidNameException
- The container name was invalid
FilesException
public boolean deleteContainer(java.lang.String name) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesInvalidNameException, FilesNotFoundException, FilesContainerNotEmptyException
name
- The name of the container
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
- The user is not Logged in
FilesInvalidNameException
- The container name is invalid
FilesNotFoundException
- The container doesn't exist
FilesContainerNotEmptyException
- The container was not emptypublic void createPath(java.lang.String container, java.lang.String path) throws org.apache.http.HttpException, java.io.IOException, FilesException
container
- The name of the container.path
- The name of the Path
org.apache.http.HttpException
- There was an error at the protocol layer while talking to CloudFiles
java.io.IOException
- There was an error at the socket layer while talking to CloudFiles
FilesException
- There was another error while taking to the CloudFiles serverpublic void createFullPath(java.lang.String container, java.lang.String path) throws org.apache.http.HttpException, java.io.IOException, FilesException
createFullPath("myContainer", "foo/bar/baz")
creates the paths "foo", "foo/bar" and "foo/bar/baz".
container
- The name of the containerpath
- The full name of the path
org.apache.http.HttpException
- There was an error at the protocol layer while talking to CloudFiles
java.io.IOException
- There was an error at the socket layer while talking to CloudFiles
FilesException
- There was another error while taking to the CloudFiles serverpublic boolean createManifestObject(java.lang.String container, java.lang.String contentType, java.lang.String name, java.lang.String manifest, IFilesTransferCallback callback) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containercontentType
- The MIME type of the filename
- The name of the file on the servermanifest
- Set manifest content herecallback
- The object to which any callbacks will be sent (null if you don't want callbacks)
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public boolean createManifestObject(java.lang.String container, java.lang.String contentType, java.lang.String name, java.lang.String manifest, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containercontentType
- The MIME type of the filename
- The name of the file on the servermanifest
- Set manifest content heremetadata
- A map with the metadata as key names and values as the metadata values
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public boolean createManifestObject(java.lang.String container, java.lang.String contentType, java.lang.String name, java.lang.String manifest, java.util.Map<java.lang.String,java.lang.String> metadata, IFilesTransferCallback callback) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containercontentType
- The MIME type of the filename
- The name of the file on the servermanifest
- Set manifest content heremetadata
- A map with the metadata as key names and values as the metadata valuescallback
- The object to which any callbacks will be sent (null if you don't want callbacks)
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeObjectAs(java.lang.String container, java.io.File obj, java.lang.String contentType, java.lang.String name) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the server
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeObjectAs(java.lang.String container, java.io.File obj, java.lang.String contentType, java.lang.String name, IFilesTransferCallback callback) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the server
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeObjectAs(java.lang.String container, java.io.File obj, java.lang.String contentType, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the servermetadata
- A map with the metadata as key names and values as the metadata values
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
FilesException
public java.lang.String storeObjectAs(java.lang.String container, java.io.File obj, java.lang.String contentType, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metadata, IFilesTransferCallback callback) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the servermetadata
- A map with the metadata as key names and values as the metadata valuescallback
- The callback object that will be called as the data is sent
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeObject(java.lang.String container, java.io.File obj, java.lang.String contentType) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the container to place the file inobj
- The File to transfercontentType
- The file's MIME type
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public boolean storeObject(java.lang.String container, byte[] obj, java.lang.String contentType, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the servermetadata
- A map with the metadata as key names and values as the metadata values
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public boolean storeObject(java.lang.String container, byte[] obj, java.lang.String contentType, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metadata, IFilesTransferCallback callback) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerobj
- The File containing the file to copy overcontentType
- The MIME type of the filename
- The name of the file on the servermetadata
- A map with the metadata as key names and values as the metadata valuescallback
- The object to which any callbacks will be sent (null if you don't want callbacks)
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeStreamedObject(java.lang.String container, java.io.InputStream data, java.lang.String contentType, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containerdata
- Any object that implements InputStreamcontentType
- The MIME type of the filename
- The name of the file on the servermetadata
- A map with the metadata as key names and values as the metadata values
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
public java.lang.String storeObjectAs(java.lang.String container, java.lang.String name, org.apache.http.HttpEntity entity, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.String md5sum) throws java.io.IOException, org.apache.http.HttpException, FilesException
container
- The name of the containername
- The name of the objectentity
- The name of the request entity (make sure to set the Content-Typemetadata
- The metadata for the objectmd5sum
- The 32 character hex encoded MD5 sum of the data
java.io.IOException
- There was a socket level exception talking to CloudFiles
org.apache.http.HttpException
- There was a protocol level error talking to CloudFiles
FilesException
- There was an error talking to CloudFiles.public java.lang.String copyObject(java.lang.String sourceContainer, java.lang.String sourceObjName, java.lang.String destContainer, java.lang.String destObjName) throws org.apache.http.HttpException, java.io.IOException
sourceContainer
- of object to copysourceObjName
- of object to copydestContainer
- where object copy will be copieddestObjName
- of object copy
java.io.IOException
- indicates a socket level error talking to CloudFiles
org.apache.http.HttpException
- indicates a protocol level error talking to CloudFiles
FilesException
- indicates an error talking to CloudFilespublic void deleteObject(java.lang.String container, java.lang.String objName) throws java.io.IOException, FilesNotFoundException, org.apache.http.HttpException, FilesException
container
- The container nameobjName
- The object name
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesException
FilesNotFoundException
public FilesObjectMetaData getObjectMetaData(java.lang.String container, java.lang.String objName) throws java.io.IOException, FilesNotFoundException, org.apache.http.HttpException, FilesAuthorizationException, FilesInvalidNameException
container
- The name of the containerobjName
- The name of the object
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
- The Client's Login was invalid.
FilesInvalidNameException
- The container or object name was not valid
FilesNotFoundException
- The file was not foundpublic byte[] getObject(java.lang.String container, java.lang.String objName) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesInvalidNameException, FilesNotFoundException
container
- The name of the containerobjName
- The name of the object
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
FilesInvalidNameException
FilesNotFoundException
public java.io.InputStream getObjectAsStream(java.lang.String container, java.lang.String objName) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesInvalidNameException, FilesNotFoundException
container
- The name of the containerobjName
- The name of the object
java.io.IOException
- There was an IO error doing network communication
org.apache.http.HttpException
- There was an error with the http protocol
FilesAuthorizationException
FilesNotFoundException
- The container does not exist
FilesInvalidNameException
public java.io.InputStream getObjectAsRangedStream(java.lang.String container, java.lang.String objName, long offset, long length) throws java.io.IOException, org.apache.http.HttpException, FilesAuthorizationException, FilesInvalidNameException, FilesNotFoundException
java.io.IOException
org.apache.http.HttpException
FilesAuthorizationException
FilesInvalidNameException
FilesNotFoundException
public static java.lang.String md5Sum(java.io.File f) throws java.io.IOException
f
- The file
java.io.IOException
public static java.lang.String md5Sum(byte[] data) throws java.io.IOException
data
- The data to checksum
java.io.IOException
public static java.lang.String sanitizeForURI(java.lang.String str)
str
-
public static java.lang.String sanitizeAndPreserveSlashes(java.lang.String str)
public static java.lang.String unencodeURI(java.lang.String str)
public int getConnectionTimeOut()
public void setConnectionTimeOut(int connectionTimeOut)
connectionTimeOut
- The new timeout for this connectionpublic java.lang.String getStorageURL()
@Deprecated public java.lang.String getStorageToken()
public java.lang.String getAuthToken()
public boolean isLoggedin()
public java.lang.String getUserName()
public void setUserName(java.lang.String email)
login()
method is called again.
email
- the usernamepublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
login()
method is called again.
password
- The new passwordpublic java.lang.String getAuthenticationURL()
public void setAuthenticationURL(java.lang.String authenticationURL)
authenticationURL
- The new authentication URLpublic boolean getUseETag()
public void setUseETag(boolean useETag)
useETag
- the useETag to setpublic void setUserAgent(java.lang.String userAgent)
public java.lang.String getUserAgent()
public static boolean isValidContainerName(java.lang.String name)
public static boolean isValidObjectName(java.lang.String name)
public boolean updateObjectManifest(java.lang.String container, java.lang.String object, java.lang.String manifest) throws FilesAuthorizationException, org.apache.http.HttpException, java.io.IOException, FilesInvalidNameException
FilesAuthorizationException
org.apache.http.HttpException
java.io.IOException
FilesInvalidNameException
public boolean updateObjectMetadata(java.lang.String container, java.lang.String object, java.util.Map<java.lang.String,java.lang.String> metadata) throws FilesAuthorizationException, org.apache.http.HttpException, java.io.IOException, FilesInvalidNameException
FilesAuthorizationException
org.apache.http.HttpException
java.io.IOException
FilesInvalidNameException
public boolean updateObjectMetadataAndManifest(java.lang.String container, java.lang.String object, java.util.Map<java.lang.String,java.lang.String> metadata, java.lang.String manifest) throws FilesAuthorizationException, org.apache.http.HttpException, java.io.IOException, FilesInvalidNameException
FilesAuthorizationException
org.apache.http.HttpException
java.io.IOException
FilesInvalidNameException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |