Class GeodatabaseSyncTask
- All Implemented Interfaces:
ApiKeyResource
,RemoteResource
,Loadable
Mobile geodatabases are designed for querying and viewing feature data when your app is offline. While offline, users can edit a mobile geodatabase locally and later synchronize changes with its feature service, assuming the associated service supports synchronization. While offline, the geodatabase keeps track of all local edits. When you synchronize the geodatabase with the service, the service receives the geodatabase's local edits, and the geodatabase receives the service's remote edits.
This task allows you to build apps that can download data from an ArcGIS feature service that has been enabled for offline use into a geodatabase. Here are the typical steps to download data from sync-enabled ArcGIS feature service into a geodatabase file on your device:
- Construct and load the
GeodatabaseSyncTask
with a URL to a sync-enabled ArcGIS feature service. - Create a
Geometry
to define the area of interest that you wish to take offline. - Obtain the
GenerateGeodatabaseParameters
for the area of interest by callingcreateDefaultGenerateGeodatabaseParametersAsync(Geometry)
. - Create a
GenerateGeodatabaseJob
by callinggenerateGeodatabase(GenerateGeodatabaseParameters, String)
. Specify a path where the mobile geodatabase (.geodatabase file) is downloaded to. - Start the
GenerateGeodatabaseJob
. Upon job completion, obtain theGeodatabase
from theGenerateGeodatabaseJob.getResult()
.
The geodatabase may contain feature layers, annotation layers, related records, non-spatial tables, and
attachments. You can create, update, or delete this data according to the capabilities of the source feature
service. The geodatabase is registered with the online feature service so that you can synchronize their data
when a network connection to the feature service is available. Your app business logic will determine
whether the synchronization just downloads changes from the feature service (SyncGeodatabaseParameters.SyncDirection.DOWNLOAD
), just
uploads changes made to the geodatabase (SyncGeodatabaseParameters.SyncDirection.UPLOAD
), or uploads and downloads changes
(SyncGeodatabaseParameters.SyncDirection.BIDIRECTIONAL
). Here are the typical steps to synchronize data between the geodatabase file
and the source feature service:
- Create a
GeodatabaseSyncTask
with theGeodatabase.getServiceUrl()
. - Obtain the
SyncGeodatabaseParameters
for the geodatabase by callingcreateDefaultSyncGeodatabaseParametersAsync(Geodatabase)
. - Create a
SyncGeodatabaseJob
by callingsyncGeodatabase(SyncGeodatabaseParameters, Geodatabase)
. Specify the synchronization direction. - Start the
SyncGeodatabaseJob
. Upon job completion, examine theSyncLayerResult
from theSyncGeodatabaseJob.getResult()
to determine whether the synchronization was successful.
When the geodatabase is no longer needed, you should unregister it to clean up the tracking metadata stored on the feature service. Unregistered geodatabases cannot be re-registered. Here are the steps to unregister a geodatabase:
- Create and load a
Geodatabase
from the downloaded geodatabase file usingGeodatabase(String)
. - Examine
Geodatabase.isSyncEnabled()
to check that the geodatabase is sync-enabled. If this is false, no further action is needed. - Create a
GeodatabaseSyncTask
with theGeodatabase.getServiceUrl()
. - Unregister the geodatabase using
unregisterGeodatabaseAsync(Geodatabase)
.
There is another option for working with mobile geodatabases. You can place a copy of a sync-enabled geodatabase
onto your device and register it with the associated service using
registerSyncEnabledGeodatabaseAsync(Geodatabase)
. This will give the geodatabase
its own replica ID and you will be able to synchronize the geodatabase with its service.
If you want to download a portion of a web map and its content, instead of individual ArcGIS feature services,
consider using the OfflineMapTask
. You can then synchronize all
of the map's geodatabase content together using the OfflineMapSyncTask
.
- Since:
- 100.0.0
-
Property Summary
TypePropertyDescriptionThe load error.The load status. -
Constructor Summary
ConstructorDescriptionCreates a geodatabase sync task object using a URL to a sync-enabled ArcGIS feature service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDoneLoadingListener
(Runnable listener) Adds a listener to the loadable resource that is invoked when loading has completed.void
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
Cancels loading metadata for the object.Executes an asynchronous operation to create default parameters to generate and download a geodatabase using theGenerateGeodatabaseJob
.createDefaultSyncGeodatabaseParametersAsync
(Geodatabase geodatabase) Executes an asynchronous operation to create default parameters to synchronize a geodatabase using theSyncGeodatabaseJob
.createDefaultSyncGeodatabaseParametersAsync
(Geodatabase geodatabase, SyncGeodatabaseParameters.SyncDirection syncDirection) Executes an asynchronous operation to create a set of default parameters that can be used to synchronize a geodatabase with the service using the given sync direction.static ListenableFuture
<Boolean> exportDeltaAsync
(Geodatabase geodatabase, String outputPath) Executes an asynchronous operation to generate an upload delta geodatabase file containing all the changes since the last sync.generateGeodatabase
(GenerateGeodatabaseParameters params, String fileNameWithPath) Returns a job to generate and download a geodatabase from an ArcGIS feature service.Gets the API key to access API key enabled services and resources in ArcGIS Online.Gets the credential used to authenticate the user with this task.Metadata about the ArcGIS feature service.Gets the value of theloadError
property.Gets the value of theloadStatus
property.Gets the RequestConfiguration object in use by this task.getUri()
Gets the URL of the ArcGIS feature service.static ListenableFuture
<List<SyncLayerResult>> importDeltaAsync
(Geodatabase geodatabase, String inputPath) Executes an asynchronous operation to import a geodatabase delta and apply it to the given geodatabase.void
Loads the metadata of the loadable resource asynchronously.The load error.The load status.registerSyncEnabledGeodatabaseAsync
(Geodatabase geodatabase) Executes an asynchronous operation to register a copy of a sync-enabled geodatabase with an ArcGIS feature service to allow the copy to sync changes.boolean
removeDoneLoadingListener
(Runnable listener) Removes a done loading listener from the loadable resource.boolean
Removes aLoadStatusChangedListener
from the loadable resource.void
Loads or retries loading metadata for the object asynchronously.void
Sets the API key to access API key enabled services and resources in ArcGIS Online.void
setCredential
(Credential credential) Sets the credential used to authenticate the user with this task.void
setRequestConfiguration
(RequestConfiguration requestConfiguration) Sets configuration parameters used for network requests sent using this task.syncGeodatabase
(SyncGeodatabaseParameters.SyncDirection syncDirection, boolean rollbackOnFailure, Geodatabase geodatabase) Creates aSyncGeodatabaseJob
to synchronize a geodatabase back to its source ArcGIS feature service using the specified sync direction and a rollback on failure boolean value.syncGeodatabase
(SyncGeodatabaseParameters params, Geodatabase geodatabase) Creates aSyncGeodatabaseJob
to synchronize a geodatabase back to its source ArcGIS feature service.unregisterGeodatabaseAsync
(Geodatabase geodatabase) Executes an asynchronous operation to unregister a geodatabase from its source ArcGIS feature service using the geodatabase's sync ID.unregisterGeodatabaseAsync
(UUID syncId) Executes an asynchronous operation to unregister a geodatabase from its source ArcGIS feature service using the geodatabase's sync ID.
-
Property Details
-
loadStatus
- Specified by:
loadStatusProperty
in interfaceLoadable
- See Also:
-
loadError
- Specified by:
loadErrorProperty
in interfaceLoadable
- See Also:
-
-
Constructor Details
-
GeodatabaseSyncTask
Creates a geodatabase sync task object using a URL to a sync-enabled ArcGIS feature service.- Parameters:
url
- a URL to an ArcGIS feature service with the sync capability enabled- Throws:
IllegalArgumentException
- if url is null or empty- Since:
- 100.0.0
-
-
Method Details
-
setCredential
Sets the credential used to authenticate the user with this task.- Specified by:
setCredential
in interfaceRemoteResource
- Parameters:
credential
- the credential used to authenticate the user with this task- Since:
- 100.0.0
-
getCredential
Gets the credential used to authenticate the user with this task.- Specified by:
getCredential
in interfaceRemoteResource
- Returns:
- the credential, or null if there is none
- Since:
- 100.0.0
-
setRequestConfiguration
Sets configuration parameters used for network requests sent using this task. The global RequestConfiguration is used if no RequestConfiguration is set.- Specified by:
setRequestConfiguration
in interfaceRemoteResource
- Parameters:
requestConfiguration
- object containing the parameters to use- Since:
- 100.0.0
-
getRequestConfiguration
Gets the RequestConfiguration object in use by this task.- Specified by:
getRequestConfiguration
in interfaceRemoteResource
- Returns:
- the RequestConfiguration object, or null if none has been set
- Since:
- 100.0.0
- See Also:
-
getUri
Gets the URL of the ArcGIS feature service.- Specified by:
getUri
in interfaceRemoteResource
- Returns:
- the URL of the feature service
- Since:
- 100.0.0
-
getFeatureServiceInfo
Metadata about the ArcGIS feature service.This information is available when the task is loaded.
- Returns:
- an ArcGISFeatureServiceInfo object for the feature service
- Since:
- 100.0.0
-
createDefaultGenerateGeodatabaseParametersAsync
public ListenableFuture<GenerateGeodatabaseParameters> createDefaultGenerateGeodatabaseParametersAsync(Geometry extent) Executes an asynchronous operation to create default parameters to generate and download a geodatabase using theGenerateGeodatabaseJob
.This populates the parameters with values that match the feature service. For example, if the service does not support
SyncModel.PER_LAYER
thenSyncModel.PER_GEODATABASE
will be used and all layers from the service will be included.Attachments are included by default, but related tables/layers are not included.
Output features are in the spatial reference of the given extent.
- Parameters:
extent
- the extent of the data to be included in the generated geodatabase.- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
NullPointerException
- if extent is null- Since:
- 100.0.0
- See Also:
-
createDefaultSyncGeodatabaseParametersAsync
public ListenableFuture<SyncGeodatabaseParameters> createDefaultSyncGeodatabaseParametersAsync(Geodatabase geodatabase) Executes an asynchronous operation to create default parameters to synchronize a geodatabase using theSyncGeodatabaseJob
.This populates the parameters with values that match the geodatabase sync task's feature service and the geodatabase.
For a geodatabase with
SyncModel.PER_LAYER
, all geodatabase layers will be included. If the service is read-only then the sync direction will beSyncGeodatabaseParameters.SyncDirection.DOWNLOAD
. Otherwise, the sync direction will beSyncGeodatabaseParameters.SyncDirection.BIDIRECTIONAL
.- Parameters:
geodatabase
- the geodatabase to be synchronized- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
IllegalArgumentException
- if geodatabase is null- Since:
- 100.0.0
- See Also:
-
createDefaultSyncGeodatabaseParametersAsync
public ListenableFuture<SyncGeodatabaseParameters> createDefaultSyncGeodatabaseParametersAsync(Geodatabase geodatabase, SyncGeodatabaseParameters.SyncDirection syncDirection) Executes an asynchronous operation to create a set of default parameters that can be used to synchronize a geodatabase with the service using the given sync direction. The result is a SyncGeodatabaseParameters object.This populates the parameters with values that match the geodatabase sync task's feature service and the geodatabase. For a geodatabase with
SyncModel.PER_LAYER
then all geodatabase layers will be included.A service is editable if it has capabilities that include any of create, update or delete. In this case both
SyncGeodatabaseParameters.SyncDirection.BIDIRECTIONAL
andSyncGeodatabaseParameters.SyncDirection.UPLOAD
are supported sync directions. Alternatively, a service that does not have create, update or delete capability is considered read-only and onlySyncGeodatabaseParameters.SyncDirection.DOWNLOAD
will be supported.If the given sync direction is not compatible with the geodatabase sync task's feature service or the geodatabase is not sync-enabled, the returned task will fail.
- Parameters:
geodatabase
- the geodatabase to be synchronizedsyncDirection
- the sync direction to use when syncing the Geodatabase- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
IllegalArgumentException
- if geodatabase or syncDirection is null- Since:
- 100.4.0
-
generateGeodatabase
public GenerateGeodatabaseJob generateGeodatabase(GenerateGeodatabaseParameters params, String fileNameWithPath) Returns a job to generate and download a geodatabase from an ArcGIS feature service.- Parameters:
params
- the parameters to be used for the generate geodatabase operationfileNameWithPath
- full path, including filename, to which to write the geodatabase- Returns:
- a GenerateGeodatabaseJob that will generate the geodatabase. The result is a Geodatabase object if the job
completed successfully. Note you must call
Job.start()
to start the Job. - Throws:
IllegalArgumentException
- if params is null, or if fileNameWithPath is null or empty- Since:
- 100.4.0
-
syncGeodatabase
public SyncGeodatabaseJob syncGeodatabase(SyncGeodatabaseParameters.SyncDirection syncDirection, boolean rollbackOnFailure, Geodatabase geodatabase) Creates aSyncGeodatabaseJob
to synchronize a geodatabase back to its source ArcGIS feature service using the specified sync direction and a rollback on failure boolean value.If the given sync direction is not compatible with the geodatabase sync task's feature service, the returned job will fail.
Synchronization can include sending feature edits made locally and retrieving feature edits made on the server. Only changes are sent/received during this process to ensure only the minimum required data is transferred.
- Parameters:
syncDirection
- sync direction to use when syncing the geodatabaserollbackOnFailure
- true to roll back (not apply) all the changes to the service and/or geodatabase if the job fails, false to accept the changes up until the point when the job failsgeodatabase
- the geodatabase to be synchronized- Returns:
- a SyncGeodatabaseJob that will synchronize the geodatabase. The result is a List (may be empty) of
SyncLayerResult objects. Note you must call
Job.start()
to start the Job. - Throws:
IllegalArgumentException
- if syncDirection or geodatabase are null- Since:
- 100.4.0
-
syncGeodatabase
public SyncGeodatabaseJob syncGeodatabase(SyncGeodatabaseParameters params, Geodatabase geodatabase) Creates aSyncGeodatabaseJob
to synchronize a geodatabase back to its source ArcGIS feature service.Synchronization can include sending feature edits made locally and retrieving feature edits made on the server. Only changes are sent/received during this process to ensure only the minimum required data is transferred.
- Parameters:
params
- the parameters to be used for the synchronize operationgeodatabase
- the geodatabase to be synchronized- Returns:
- a SyncGeodatabaseJob that will synchronize the geodatabase. The result is a List (may be empty) of
SyncLayerResult objects. Note you must call
Job.start()
to start the Job. - Throws:
IllegalArgumentException
- if params or geodatabase is null- Since:
- 100.4.0
-
unregisterGeodatabaseAsync
Executes an asynchronous operation to unregister a geodatabase from its source ArcGIS feature service using the geodatabase's sync ID. This removes the services replica id.After unregistering a geodatabase it can no longer be synced back to the service. This is often used prior to deleting a local geodatabase.
This operation is not related to
registerSyncEnabledGeodatabaseAsync(Geodatabase)
, which is for registering copies of a sync-enabled geodatabase.- Parameters:
geodatabase
- the geodatabase to be unregistered- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
IllegalArgumentException
- if geodatabase is null- Since:
- 100.0.0
-
unregisterGeodatabaseAsync
Executes an asynchronous operation to unregister a geodatabase from its source ArcGIS feature service using the geodatabase's sync ID. This removes the services replica id.Note that this overload uses the geodatabase's sync ID rather than a reference to the geodatabase itself.
This is commonly used to enable cleanup of the service after the local geodatabase has already been deleted. See
Geodatabase.getSyncId()
. After unregistering a geodatabase it can no longer be synced back to the service.This operation is not related to
registerSyncEnabledGeodatabaseAsync(Geodatabase)
, which is for registering copies of a sync-enabled geodatabase.- Parameters:
syncId
- the syncID of geodatabase to unregister- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
IllegalArgumentException
- if syncID is null- Since:
- 100.6.0
-
registerSyncEnabledGeodatabaseAsync
Executes an asynchronous operation to register a copy of a sync-enabled geodatabase with an ArcGIS feature service to allow the copy to sync changes.This method is typically used as part of services pattern workflow, sometimes known as a pre-planned workflow. A sync-enabled geodatabase is generated centrally and not modified or synced. Copies of this original geodatabase are distributed and loaded onto each user's device. The copy must first be registered with the service to allow the server to identify changes in subsequent sync operations. One of the main benefits of this workflow is a reduction in server load to generate geodatabases for many clients. It is important not to sync the copy before registering to ensure the server can maintain consistent state on each copy. This operation is not the opposite of
unregisterGeodatabaseAsync(Geodatabase)
which is used to remove a geodatabase from the service prior to deletion.- Parameters:
geodatabase
- the geodatabase to register- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows
cancellation. Calling
get()
on the returned future may throw an ExecutionException with its cause set to:IOException
if the network request fails
- Throws:
IllegalArgumentException
- if geodatabase is null- Since:
- 100.0.0
-
importDeltaAsync
public static ListenableFuture<List<SyncLayerResult>> importDeltaAsync(Geodatabase geodatabase, String inputPath) Executes an asynchronous operation to import a geodatabase delta and apply it to the given geodatabase. The result is a list ofSyncLayerResult
objects.A delta geodatabase contains the changes that have occurred since a mobile replica
Geodatabase
was last-synchronized with the feature service. See Synchronize Replica.- Parameters:
geodatabase
- the geodatabase to apply a delta toinputPath
- the path and filename to import the delta from- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows cancellation.
- Throws:
IllegalArgumentException
- if geodatabase or inputPath is null, or if inputPath is empty- Since:
- 100.3.0
- See Also:
-
getApiKey
Description copied from interface:ApiKeyResource
Gets the API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the Generate API keys privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.
In addition to setting an API key at a global level for your application using
ArcGISRuntimeEnvironment.setApiKey(String)
, you can callApiKeyResource.setApiKey(String)
on any class that implementsApiKeyResource
. When you callsetApiKey(String)
on anAPIKeyResource
, it will override the default key at the global level (the key returned byArcGISRuntimeEnvironment.getApiKey()
, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.Classes that expose an API key property by implementing APIKeyResource include:
- Specified by:
getApiKey
in interfaceApiKeyResource
- Returns:
- the API key to access API key enabled services and resources in ArcGIS Online
- See Also:
-
setApiKey
Description copied from interface:ApiKeyResource
Sets the API key to access API key enabled services and resources in ArcGIS Online.An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.
In addition to setting an API key at a global level for your application using
ArcGISRuntimeEnvironment.setApiKey(String)
, you can callsetApiKey(String)
on any class that implementsApiKeyResource
. When you callsetApiKey(String)
on anAPIKeyResource
, it will override the default key at the global level (the key returned byArcGISRuntimeEnvironment.getApiKey()
, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.Classes that expose an API key property by implementing APIKeyResource include:
- Specified by:
setApiKey
in interfaceApiKeyResource
- Parameters:
apiKey
- the API key to access API key enabled services and resources in ArcGIS Online- See Also:
-
exportDeltaAsync
public static ListenableFuture<Boolean> exportDeltaAsync(Geodatabase geodatabase, String outputPath) Executes an asynchronous operation to generate an upload delta geodatabase file containing all the changes since the last sync.A delta geodatabase contains the changes that have occurred since a mobile replica
Geodatabase
was last synchronized with the feature service. See Synchronize Replica for an overview of the delta files used in synchronization. An "upload" delta geodatabase contains the local edits, performed on the user's device, to be sent to the originating feature service.When you run this task, any local edits in the Geodatabase will be exported to the specified output path. The output path should include the full path and file name (ending in ".geodatabase") for the export.
The delta file created by this method is not sent to the server and has no impact on any subsequent sync job. You can call this method repeatedly without affecting the state of the local geodatabase.
The task returned by this method has a boolean result that indicates whether or not a delta geodatabase was created.
You should not execute more than one sync on a particular geodatabase at the same time. This includes any operations that export or import deltas from the local Geodatabase:
-
exportDeltaAsync(Geodatabase, String)
-
importDeltaAsync(Geodatabase, String)
-
SyncGeodatabaseJob
-
OfflineMapSyncJob
- Parameters:
geodatabase
- the geodatabase to generate a delta fromoutputPath
- the path and filename to save the generated delta to- Returns:
- a ListenableFuture for tracking when the operation is done and getting the result; also allows cancellation. The result is a Boolean indicating whether a delta was generated or not.
- Throws:
IllegalArgumentException
- if geodatabase is nullIllegalArgumentException
- if outputPath is null or empty- Since:
- 100.10.0
- See Also:
-
-
getLoadStatus
Gets the value of theloadStatus
property.- Specified by:
getLoadStatus
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadStatus
property - See Also:
-
getLoadError
Gets the value of theloadError
property.- Specified by:
getLoadError
in interfaceLoadable
- Property description:
- Returns:
- the value of the
loadError
property - See Also:
-
cancelLoad
public void cancelLoad()Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError()
.Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADING
state.- Specified by:
cancelLoad
in interfaceLoadable
-
loadAsync
public void loadAsync()Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)
that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED
, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOAD
and the error can be retrieved by callingLoadable.getLoadError()
.This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADING
state) whenloadAsync
is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
is called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsync
on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
. -
retryLoadAsync
public void retryLoadAsync()Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
-
addDoneLoadingListener
Description copied from interface:Loadable
Adds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, add a listener to the
Loadable.loadStatusProperty()
instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
listener
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added
-
removeLoadStatusChangedListener
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
-
loadStatusProperty
Description copied from interface:Loadable
The load status.- Specified by:
loadStatusProperty
in interfaceLoadable
- Returns:
- the
loadStatus
property - See Also:
-
loadErrorProperty
Description copied from interface:Loadable
The load error.- Specified by:
loadErrorProperty
in interfaceLoadable
- Returns:
- the
loadError
property - See Also:
-