|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.stackmob.sdk.api.StackMobDatastore
public class StackMobDatastore
Make calls to StackMob's API directly. This class lets you call CRUD methods, as well as talk to any custom APIs you have.
| Constructor Summary | |
|---|---|
StackMobDatastore(ExecutorService executor,
StackMobSession session,
String host,
StackMobRedirectedCallback redirectedCallback)
|
|
| Method Summary | ||
|---|---|---|
void |
count(StackMobQuery query,
StackMobRawCallback callback)
retrieve the number of objects for a query on the StackMob platform |
|
void |
count(String path,
StackMobRawCallback callback)
retrieve the number of objects for a schema on the StackMob platform |
|
void |
delete(String path,
String id,
StackMobRawCallback callback)
do a DELETE request to the StackMob platform |
|
|
deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobRawCallback callback)
atomically remove elements from an array or has many relationship |
|
|
deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobRawCallback callback)
atomically remove elements from an array or has many relationship |
|
void |
get(StackMobQuery query,
StackMobOptions options,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
void |
get(StackMobQuery query,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
void |
get(String path,
StackMobOptions options,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
void |
get(String path,
StackMobRawCallback callback)
do a get request on the StackMob platform |
|
void |
post(String path,
Object requestObject,
StackMobOptions options,
StackMobRawCallback callback)
do a post request on the StackMob platform for a single object |
|
void |
post(String path,
Object requestObject,
StackMobRawCallback callback)
do a post request on the StackMob platform for a single object |
|
void |
post(String path,
String body,
StackMobOptions options,
StackMobRawCallback callback)
do a POST request on the StackMob platform for a single object |
|
void |
post(String path,
String body,
StackMobRawCallback callback)
do a post request on the StackMob platform for a single object |
|
|
postBulk(String path,
List<T> requestObjects,
StackMobRawCallback callback)
do a post request on the StackMob platform with a list of objects |
|
void |
postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobRawCallback callback)
post a new related object to an existing object. |
|
void |
postRelated(String path,
String primaryId,
String relatedField,
String relatedObject,
StackMobRawCallback callback)
post a new related object to an existing object. |
|
|
postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobRawCallback callback)
post a list of new related objects to an existing object. |
|
void |
put(String path,
String id,
Object requestObject,
StackMobRawCallback callback)
do a PUT request on the StackMob platform |
|
void |
put(String path,
String id,
String body,
StackMobRawCallback callback)
do a put request on the StackMob platform |
|
void |
putAndUpdateAtomicCounters(String path,
String id,
Object requestObject,
List<String> counterFields,
StackMobRawCallback callback)
do a PUT request on the StackMob platform, treating some of the fields as counters to be incremented rather than as values to set |
|
|
putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobRawCallback callback)
do a an atomic put request on the StackMob platform with the contents of the has-many relation |
|
void |
setSession(StackMobSession session)
set a specific session |
|
void |
updateAtomicCounter(String path,
String id,
String field,
int value,
StackMobRawCallback callback)
do an atomic update on a an integer field in a particular object and schema |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StackMobDatastore(ExecutorService executor,
StackMobSession session,
String host,
StackMobRedirectedCallback redirectedCallback)
| Method Detail |
|---|
public void setSession(StackMobSession session)
session - the session to set
public void get(String path,
StackMobRawCallback callback)
path - the path to getcallback - callback to be called when the server returns. may execute in a separate thread
public void get(String path,
StackMobOptions options,
StackMobRawCallback callback)
path - the path to getoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate thread
public void get(StackMobQuery query,
StackMobRawCallback callback)
query - the query to runcallback - callback to be called when the server returns. may execute in a separate thread
public void get(StackMobQuery query,
StackMobOptions options,
StackMobRawCallback callback)
query - the query to runoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate thread
public void post(String path,
Object requestObject,
StackMobRawCallback callback)
path - the path to getrequestObject - the object to serialize and send in the POST body. this object will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public void post(String path,
Object requestObject,
StackMobOptions options,
StackMobRawCallback callback)
path - the path to getrequestObject - the object to serialize and send in the POST body. this object will be serialized with Gsonoptions - additional options, such as headers, to modify the requestcallback - callback to be called when the server returns. may execute in a separate thread
public void post(String path,
String body,
StackMobRawCallback callback)
path - the path to getbody - the json bodycallback - callback to be called when the server returns. may execute in a separate thread
public void post(String path,
String body,
StackMobOptions options,
StackMobRawCallback callback)
path - the path to getbody - the json bodyoptions - any additional headers to sendcallback - callback to be called when the server returns. may execute in a separate thread
public <T> void postBulk(String path,
List<T> requestObjects,
StackMobRawCallback callback)
path - the path to getrequestObjects - List of objects to serialize and send in the POST body. the list will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public void postRelated(String path,
String primaryId,
String relatedField,
Object relatedObject,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedObject - related object to postcallback - callback to be called when the server returns. may execute in a separate thread
public void postRelated(String path,
String primaryId,
String relatedField,
String relatedObject,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedObject - related object to postcallback - callback to be called when the server returns. may execute in a separate thread
public <T> void postRelatedBulk(String path,
String primaryId,
String relatedField,
List<T> relatedObjects,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedObjects - list of related objects to post. the list will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public void put(String path,
String id,
Object requestObject,
StackMobRawCallback callback)
path - the path to PUTid - the id of the object to PUTrequestObject - the object to serialize and send in the PUT body. this object will be serialized with Gsoncallback - callback to be called when the server returns. may execute in a separate thread
public void put(String path,
String id,
String body,
StackMobRawCallback callback)
path - the path to putid - the id of the object to putbody - the json bodycallback - callback to be called when the server returns. may execute in a separate thread
public void putAndUpdateAtomicCounters(String path,
String id,
Object requestObject,
List<String> counterFields,
StackMobRawCallback callback)
path - the path to putid - the id of the object to putrequestObject - the object to serialize and send in the PUT body. this object will be serialized with GsoncounterFields - a list of the fields in the object to be treated as counters being incrementedcallback - callback to be called when the server returns. may execute in a separate thread
public void updateAtomicCounter(String path,
String id,
String field,
int value,
StackMobRawCallback callback)
path - the path to putid - the id of the object to putfield - the field to incrementvalue - the value to increment bycallback - callback to be called when the server returns. may execute in a separate thread
public <T> void putRelated(String path,
String primaryId,
String relatedField,
List<T> relatedIds,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationrelatedField - name of the relationrelatedIds - list of ids to atomically add to the relation. The type should be the same type as the primary
key field of the related objectcallback - callback to be called when the server returns. may execute in a separate thread
public void delete(String path,
String id,
StackMobRawCallback callback)
path - the path to deleteid - the id of the object to putcallback - callback to be called when the server returns. may execute in a separate thread
public <T> void deleteIdsFrom(String path,
String primaryId,
String field,
List<T> idsToDelete,
boolean cascadeDeletes,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationfield - name of the relation or array field to delete fromidsToDelete - list of ids to atomically remove from field.
ids should be same type as the primary id of the related type (most likely String or Integer)cascadeDeletes - true if related objects specified in idsToDelete should also be deletedcallback - callback to be called when the server returns. may execute in a separate thread
public <T> void deleteIdFrom(String path,
String primaryId,
String field,
T idToDelete,
boolean cascadeDelete,
StackMobRawCallback callback)
path - the path to getprimaryId - id of the object with the relationfield - name of the relation or array field to delete fromidToDelete - id to atomically remove from field.
should be same type as the primary id of the related type (most likely String or Integer)cascadeDelete - true if related object specified in idToDelete should also be deletedcallback - callback to be called when the server returns. may execute in a separate thread
public void count(String path,
StackMobRawCallback callback)
path - the path to getcallback - callback to be called when the server returns. may execute in a separate thread
public void count(StackMobQuery query,
StackMobRawCallback callback)
query - the query to sendcallback - callback to be called when the server returns. may execute in a separate thread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||