public class CloudStorage extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
RETURN_CODE_EMPTY_QUEUE
Deprecated.
Return code for methods in this class indicating an empty queue
|
static int |
RETURN_CODE_FAIL_OBJECT_MODIFIED
Deprecated.
Return code for methods in this class indicating a failure due to server side
modification of an object (e.g.
|
static int |
RETURN_CODE_FAIL_PERMISSION_VIOLATION
Deprecated.
Return code for methods in this class indicating a failure due to exceeding
server storage quotas
|
static int |
RETURN_CODE_FAIL_QUOTA_EXCEEDED
Deprecated.
Return code for methods in this class indicating a failure due to exceeding
server storage quotas
|
static int |
RETURN_CODE_FAIL_SERVER_ERROR
Deprecated.
Return code for methods in this class indicating a failure due to generic server side
error
|
static int |
RETURN_CODE_SUCCESS
Deprecated.
Return code for methods in this class indicating a successful operation
|
| Modifier and Type | Method and Description |
|---|---|
int |
commit()
Deprecated.
Commit works synchronously and returns one of the return codes above to indicate
the status.
|
void |
commit(CloudResponse<Integer> response)
Deprecated.
A commit version that works asynchronously and returns one of the return codes above to indicate
the status.
|
void |
delete(CloudObject cl)
Deprecated.
Deletes the following object from the cloud storage upon commit
|
void |
deleteAllCloudFilesBefore(long timestamp,
String developerAccount,
String developerPassword)
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
void |
deleteAllCloudFilesForUser()
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
boolean |
deleteCloudFile(String fileId)
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
CloudObject[] |
fetch(String[] cloudIds)
Deprecated.
Fetches the objects from the server.
|
void |
fetch(String[] cloudIds,
CloudResponse<CloudObject[]> response)
Deprecated.
Fetches the objects from the server asynchronously.
|
static CloudStorage |
getInstance()
Deprecated.
Creates an instance of the cloud storage object, only one instance should be used per application.
|
String |
getUrlForCloudFileId(String fileId)
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
CloudObject[] |
queryEquals(String type,
int index,
String value,
int page,
int limit,
int visibilityScope)
Deprecated.
Performs a query to the server finding the objects where the key
value is equal to the given value.
|
void |
queryEquals(String type,
int index,
String value,
int page,
int limit,
int visibilityScope,
CloudResponse<CloudObject[]> response)
Deprecated.
Performs a query to the server finding the objects where the key
value is equal to the given value.
|
int |
queryEqualsCount(String type,
int index,
String value,
int visibilityScope)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
void |
queryEqualsCount(String type,
int index,
String value,
int visibilityScope,
CloudResponse<Integer> response)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
String[] |
queryEqualsKeys(String type,
int index,
String value,
int page,
int limit,
int visibilityScope)
Deprecated.
Equivalent to the standard query but just returns the keys matching the given query
|
void |
queryEqualsKeys(String type,
int index,
String value,
int page,
int limit,
int visibilityScope,
CloudResponse<String[]> response)
Deprecated.
Equivalent to the standard query but just returns the keys matching the given query
|
CloudObject[] |
queryGreaterThan(String type,
int index,
String value,
int page,
int limit,
int visibilityScope)
Deprecated.
Performs a query to the server finding the objects where the key
value is greater than the given value.
|
void |
queryGreaterThan(String type,
int index,
String value,
int page,
int limit,
int visibilityScope,
CloudResponse<CloudObject[]> response)
Deprecated.
Performs a query to the server finding the objects where the key
value is greater than the given value.
|
int |
queryGreaterThanCount(String type,
int index,
String value,
int visibilityScope)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
void |
queryGreaterThanCount(String type,
int index,
String value,
int visibilityScope,
CloudResponse<Integer> response)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
CloudObject[] |
queryLessThan(String type,
int index,
String value,
int page,
int limit,
int visibilityScope)
Deprecated.
Performs a query to the server finding the objects where the key
value is smaller than the given value.
|
void |
queryLessThan(String type,
int index,
String value,
int page,
int limit,
int visibilityScope,
CloudResponse<CloudObject[]> response)
Deprecated.
Performs a query to the server finding the objects where the key
value is smaller than the given value.
|
int |
queryLessThanCount(String type,
int index,
String value,
int visibilityScope)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
void |
queryLessThanCount(String type,
int index,
String value,
int visibilityScope,
CloudResponse<Integer> response)
Deprecated.
Equivalent to the standard query but just returns the total count of entries that will be returned
|
CloudObject[] |
querySorted(String type,
int index,
boolean ascending,
int page,
int limit,
int visibilityScope)
Deprecated.
Performs a query to the server finding the objects where the sort is equal to the given value.
|
void |
querySorted(String type,
int index,
boolean ascending,
int page,
int limit,
int visibilityScope,
CloudResponse<CloudObject[]> response)
Deprecated.
Performs a query to the server finding the objects where the sort is equal to the given value.
|
String[] |
querySortedKeys(String type,
int index,
boolean ascending,
int page,
int limit,
int visibilityScope)
Deprecated.
Performs a query to the server finding the objects where the sort is equal to the given value and returning
the cloud key of these objects.
|
void |
querySortedKeys(String type,
int index,
boolean ascending,
int page,
int limit,
int visibilityScope,
CloudResponse<String[]> response)
Deprecated.
Performs a query to the server finding the objects where the sort is equal to the given value and returning
the cloud key of these objects.
|
int |
refresh(CloudObject[] objects)
Deprecated.
this feature is no longer supported
|
void |
refresh(CloudObject[] objects,
CloudResponse<Integer> response)
Deprecated.
Refresh the given objects with data from the server if they were modified on the server (this is the asynchronous
version of the method).
|
void |
refreshAsync(CloudObject obj)
Deprecated.
Adds the given object to a set of refresh operations in which we don't
really care if the operation is successful
|
void |
rollback()
Deprecated.
Cancels current pending changes
|
void |
save(CloudObject object)
Deprecated.
Adds the given object to the save queue, the operation will only take place once committed
|
String |
uploadCloudFile(String mimeType,
String file)
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
String |
uploadCloudFile(String mimeType,
String filename,
InputStream data,
int dataSize)
Deprecated.
this API is currently deprecated due to Googles cloud storage deprection
|
public static final int RETURN_CODE_SUCCESS
public static final int RETURN_CODE_FAIL_OBJECT_MODIFIED
public static final int RETURN_CODE_FAIL_SERVER_ERROR
public static final int RETURN_CODE_FAIL_QUOTA_EXCEEDED
public static final int RETURN_CODE_EMPTY_QUEUE
public static final int RETURN_CODE_FAIL_PERMISSION_VIOLATION
public static CloudStorage getInstance()
public void save(CloudObject object)
object - the object to save into the cloud, new objects are inserted. existing
objects are updatedpublic void delete(CloudObject cl)
cl - the cloud object to deletepublic void refresh(CloudObject[] objects, CloudResponse<Integer> response)
objects - objects to refreshresponse - object for the responsepublic void refreshAsync(CloudObject obj)
obj - the object to refreshpublic int refresh(CloudObject[] objects)
objects - objects to refreshpublic CloudObject[] fetch(String[] cloudIds) throws CloudException
cloudIds - the object id's to fetchCloudException - thrown for a server side/connection errorpublic void fetch(String[] cloudIds, CloudResponse<CloudObject[]> response)
cloudIds - the object id's to fetchresponse - returns the response from the serverpublic CloudObject[] queryEquals(String type, int index, String value, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic CloudObject[] querySorted(String type, int index, boolean ascending, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index on which the sort is basedascending - indicates if the sort order is ascending or descendingpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic String[] querySortedKeys(String type, int index, boolean ascending, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index on which the sort is basedascending - indicates if the sort order is ascending or descendingpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic String[] queryEqualsKeys(String type, int index, String value, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic int queryEqualsCount(String type, int index, String value, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic int queryGreaterThanCount(String type, int index, String value, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic int queryLessThanCount(String type, int index, String value, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic CloudObject[] queryGreaterThan(String type, int index, String value, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic CloudObject[] queryLessThan(String type, int index, String value, int page, int limit, int visibilityScope) throws CloudException
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*CloudException - thrown for a server side/connection errorpublic void querySorted(String type, int index, boolean ascending, int page, int limit, int visibilityScope, CloudResponse<CloudObject[]> response)
type - the object typeindex - the index on which the sort is basedascending - indicates if the sort order is ascending or descendingpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryEquals(String type, int index, String value, int page, int limit, int visibilityScope, CloudResponse<CloudObject[]> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryEqualsCount(String type, int index, String value, int visibilityScope, CloudResponse<Integer> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryGreaterThanCount(String type, int index, String value, int visibilityScope, CloudResponse<Integer> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void querySortedKeys(String type, int index, boolean ascending, int page, int limit, int visibilityScope, CloudResponse<String[]> response)
type - the object typeindex - the index on which the sort is basedascending - indicates if the sort order is ascending or descendingpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryEqualsKeys(String type, int index, String value, int page, int limit, int visibilityScope, CloudResponse<String[]> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryLessThanCount(String type, int index, String value, int visibilityScope, CloudResponse<Integer> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryGreaterThan(String type, int index, String value, int page, int limit, int visibilityScope, CloudResponse<CloudObject[]> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*public void queryLessThan(String type, int index, String value, int page, int limit, int visibilityScope, CloudResponse<CloudObject[]> response)
type - the object typeindex - the index to query for the given valuevalue - the value of said index to include in the response objectpage - the page of responses (allows for paging)limit - number of responses to fetchvisibilityScope - indicates the scope in which to look as one of the
CloudObject constants ACCESS_*response - array of objects matching the querypublic String uploadCloudFile(String mimeType, String file) throws CloudException, IOException
mimeType - the mimetype of the uploaded filefile - the URL of the local fileCloudException - in case of a server side errorIOException - when a problem occurs with the filepublic String uploadCloudFile(String mimeType, String filename, InputStream data, int dataSize) throws CloudException, IOException
mimeType - the mimetype of the uploaded filefilename - a short name for the file uploaded (not a full path)data - input stream from which to read the filedataSize - the size in bytes of the input stream (this is essential for file upload to work on all devices!)CloudException - in case of a server side errorIOException - when a problem occurs with the filepublic boolean deleteCloudFile(String fileId)
fileId - the file id to deletepublic void deleteAllCloudFilesForUser()
public void deleteAllCloudFilesBefore(long timestamp,
String developerAccount,
String developerPassword)
timestamp - the timestamp since epoch (as in System.currentTimemillis).developerAccount - your developer emaildeveloperPassword - your developer passwordpublic String getUrlForCloudFileId(String fileId)
fileId - the file IDpublic int commit()
public void commit(CloudResponse<Integer> response)
response - response code with status code from the constants in this classpublic void rollback()