public class FHSyncClient extends Object
| Constructor and Description |
|---|
FHSyncClient() |
| Modifier and Type | Method and Description |
|---|---|
JSONObject |
create(String pDataId,
JSONObject pData)
Creates a new data record in dataset with pDataId.
|
JSONObject |
delete(String pDataId,
String pUID)
Deletes a data record in the dataset with pDataId.
|
void |
destroy()
Stops all sync processes for all the datasets managed by the sync client.
|
void |
forceSync(String pDataId)
Causes the sync framework to schedule for immediate execution a sync.
|
static FHSyncClient |
getInstance()
Gets the singleton instance of the sync client.
|
void |
init(android.content.Context pContext,
FHSyncConfig pConfig,
FHSyncListener pListener)
Initializes the sync client.
|
JSONObject |
list(String pDataId)
Lists all the data in the dataset with pDataId.
|
void |
listCollisions(String pDataId,
FHActCallback pCallback)
Lists sync collisions in dataset with id pDataId.
|
void |
manage(String pDataId,
FHSyncConfig pConfig,
JSONObject pQueryParams)
Uses the sync client to manage a dataset.
|
void |
manage(String pDataId,
FHSyncConfig pConfig,
JSONObject pQueryParams,
JSONObject pMetaData)
Uses the sync client to manage a dataset.
|
void |
pauseSync()
This method will pause synchronization.
|
JSONObject |
read(String pDataId,
String pUID)
Reads a data record with pUID in dataset with pDataId.
|
void |
removeCollision(String pDataId,
String pCollisionHash,
FHActCallback pCallback)
Removes a sync collision record in the dataset with id pDataId.
|
void |
resumeSync(FHSyncListener listener)
This method will begin synchronization.
|
void |
setListener(FHSyncListener pListener)
Re-sets the sync listener.
|
void |
stop(String pDataId)
Stops the sync process for dataset with id pDataId.
|
JSONObject |
update(String pDataId,
String pUID,
JSONObject pData)
Updates an existing data record in dataset with pDataId.
|
protected static final String LOG_TAG
public static FHSyncClient getInstance()
public void init(android.content.Context pContext,
FHSyncConfig pConfig,
FHSyncListener pListener)
pContext - The app contextpConfig - The sync configurationpListener - The sync listenerpublic void setListener(FHSyncListener pListener)
pListener - the new sync listenerpublic void manage(String pDataId, FHSyncConfig pConfig, JSONObject pQueryParams)
pDataId - The id of the dataset.pConfig - The sync configuration for the dataset. If not specified,
the sync configuration passed in the initDev method will be usedpQueryParams - Query parameters for the datasetIllegalStateException - thrown if FHSyncClient isn't initialised.public void manage(String pDataId, FHSyncConfig pConfig, JSONObject pQueryParams, JSONObject pMetaData)
pDataId - The id of the dataset.pConfig - The sync configuration for the dataset. If not specified,
the sync configuration passed in the initDev method will be usedpQueryParams - Query parameters for the datasetpMetaData - Meta for the datasetIllegalStateException - thrown if FHSyncClient isn't initialised.public void forceSync(String pDataId)
pDataId - The id of the datasetpublic JSONObject list(String pDataId)
pDataId - The id of the datasetpublic JSONObject read(String pDataId, String pUID)
pDataId - the id of the datasetpUID - the id of the data recordpublic JSONObject create(String pDataId, JSONObject pData) throws DataSetNotFound
pDataId - the id of the datasetpData - the actual dataDataSetNotFound - if the dataId is not knownpublic JSONObject update(String pDataId, String pUID, JSONObject pData) throws DataSetNotFound
pDataId - the id of the datasetpUID - the id of the data recordpData - the new content of the data recordDataSetNotFound - if the dataId is not knownpublic JSONObject delete(String pDataId, String pUID) throws DataSetNotFound
pDataId - the id of the datasetpUID - the id of the data recordDataSetNotFound - if the dataId is not knownpublic void listCollisions(String pDataId, FHActCallback pCallback) throws FHNotReadyException
pDataId - the id of the datasetpCallback - the callback functionFHNotReadyException - if FH is not initialized.public void removeCollision(String pDataId, String pCollisionHash, FHActCallback pCallback) throws FHNotReadyException
pDataId - the id of the datasetpCollisionHash - the hash value of the collision recordpCallback - the callback functionFHNotReadyException - thrown if FH is not initialized.public void resumeSync(FHSyncListener listener)
Activity.onResume() block.listener - the listener to. If null the current listener will be
used.public void pauseSync()
Activity.onPause() block.public void stop(String pDataId)
pDataId - the id of the datasetpublic void destroy()
Copyright © 2016 Red Hat. All rights reserved.