• Home
  • Getting Started
  • Documentation
  • API References
  • Downloads
  • Support
Verivo
DevCenter
  • Welcome, Anonymous
  • |
  • Log in
  1. 1.0.1 Documentation
  2. Data Persistence and Synchronization
  3. Clearing Persistent Data Stores
Printable version    

Documentation 1.0.1

Related Topics

Page: Clearing Persistent Data Stores
Page: Encrypting Data in the Persistent Data Store
Page: Synchronizing Client Data with the Akula Server
Page: Synchronization Overview
Page: Handling Synchronization Success and Failure
Page: Writing a Custom Sync Module
Page: Data Persistence and Synchronization
Page: Storing Persistent Data on the Client
Page: Implementing Persistence on Native Clients
Page: Implementing Persistence on JavaScript Clients
Page: Syncing on the Client
  

Labels

  • persistence
  • encryption
  • synchronization

Documentation Downloads

  • Installing and Configuring Akula
  • Building Akula Apps
  • Release Notes

All Versions

Latest Official Version (2.5)
Version 3.0 Beta
Version 2.5
Version 2.1
Version 2.0
Version 1.5
Version 1.0.1
Your Rating: Thanks for voting! Please Wait Please Wait Results: PatheticBadOKGoodOutstanding! 2 rates
Encrypting Data in the Persistent Data Store      Creating Custom Modules
Documentation Version 1.0.1
NOTE: You are currently viewing version 1.0.1 of the Akula documentation.

View the latest version of this page or go to the current documentation home page.

Clearing Persistent Data Stores

You can delete all the data and metadata in the persistent data store, including any change tracking data used by the Akula sync mechanism, and all schema and entity information for registered classes. To do this, you use the following static methods of the persistence manager: 

  • Android – AKPersistenceManager.clearPersistedData()
  • iOS – clearPersistedData: class
  • JavaScript – AK.PersistenceManager.clearPersistedData()

After you clear the persistent data, Akula throws an error if you attempt to perform a CRUD operation on the persistent data.

Clearing the data from the persistent data store also closes all persistence manager instances. Therefore, any attempt to use a persistence manager instance after the clear results in an error.

After clearing the persistent data, you should assume that all in-memory versions of data read from the persistent data store are no longer valid.

After clearing an unencrypted persistent data store

After clearing the persistent data store, you must initialize the persistence mechanism with the schema for each class that you want to persist. To do this, use the following methods of the persistence manager:

  • Android – AKPersistenceManager.initSchema()
  • iOS – initSchema:forClass:error:
  • JavaScript – AK.PersistenceManager.initializeEntityStore()

After initializing the schema, create new instances of the persistence manager, and then use the methods of the instance to perform CRUD operations on the persistent data store. 

For more information, see Storing Persistent Data on the Client.

After clearing an encrypted persistent data store

If you are using an encrypted persistent data store, the encrypted persistent data store is locked when you clear it, and the current passphrase is discarded. Therefore, the first action after clearing the encrypted persistent data store is to unlock it with the previous passphrase or with a new passphrase.

You can then reinitialize the encrypted persistent data store by calling the following methods of the persistence manager to access the encrypted persistent data store:

  • Android – AKPersistenceManager.initSchema()
  • iOS – initSchema:forClass:error:

The JavaScript version of the persistence manager does not currently support using an encrypted data store.

For more information, see Encrypting Data in the Persistent Data Store.

After clearing the persistent data store when using sync

If you are using the Akula synchronization mechanism, clearing the persistent data store deletes all current data and any changes you made to data since you last synced from the server. Therefore, you must reinitialize the persistent data store by calling the following persistence manager methods:

  • Android – AKPersistenceManager.initSchema()
  • iOS – initSchema:forClass:error:
  • JavaScript – AK.PersistenceManager.initSchema()

After calling these methods, you can perform a sync operation with the server to download data to the persistent data store.

For more information on the Akula synchronization mechanism, see Synchronizing Client Data with the Akula Server.

Handling the clear event

When you clear the persistent data store, the persistence manager dispatches a clear event that you can then handle in your client app. Your event handler can reinitialize the persistent data store, unlock an encrypted persistent data store, perform a sync operation with the Akula Server, or perform other operations.

Handling the clear event in an Android app

In Android, use the static AKPersistenceManager.addPersistenceListener() method to register an event listener for the change event. A listener is an object that implements the AKPersistenceListener interface to define the onClearPersistedData() method, as the following example shows:

Handling the clear event in an iOS app

In an iOS app, the event handler for a clear event receives an NSNotification object that contains three fields:

  • name - The event name as defined by the AKPersistedDataClearedNotification static method on the AKPersistenceManager class.
  • object - The object associated with the event.
  • userInfo - An NSDictionary object that is nil for the clear event.

The following example handles the clear event for AKPersistenceManager:

Handling the clear event in a JavaScript app

In a JavaScript app, register your listener with the addPersistenceListener() method. The onClearPersistedData function is triggered when you call the AK.PersistenceManager.learPersistenceData() method, as the following example shows:

                                               

0 Comments

Hide/Show Comments
You must log in to comment.
 
Encrypting Data in the Persistent Data Store      Creating Custom Modules
  • Last edited by mhorn@verivo.com on 2013-09-09 17:13:29.0

  • Privacy Policy | Legal Information
    © Copyright 2014, Verivo Software, Inc. All Rights Reserved.