ClientRegistrationProvider

Interface for providers that support client registration.

Inheritors

Functions

Link copied to clipboard
abstract fun isClientRegistered(): Boolean

Checks locally whether a previous {@link com.sap.cloud.mobile.kotlin.odata.ClientRegistrationProvider#registerClient(com.sap.cloud.mobile.kotlin.odata.EntityValue?) ClientRegistrationProvider.registerClient} call successfuly created a client registration for the remote OData service.

Link copied to clipboard
abstract fun registerClient(client: EntityValue?)

If {@link com.sap.cloud.mobile.kotlin.odata.ClientRegistrationProvider#isClientRegistered() ClientRegistrationProvider.isClientRegistered} would return false, create a new client registration and record its key (ClientID property of type GUID) in local file ~/ClientRegistration/<ServiceName>.json. Otherwise just load the previously locally-saved registration ID into the {@link com.sap.cloud.mobile.kotlin.odata.ServiceOptions#clientInstanceID ServiceOptions.clientInstanceID}. The server's metadata is expected to include a ClientRegistrationSet entity set with entity type ClientRegistration, a key property named ClientID of type long (Edm.Int64), and a property named ClientGUID of type guid (Edm.Guid). If a new registration is successfully created, {@link com.sap.cloud.mobile.kotlin.odata.ServiceOptions#clientInstanceID ServiceOptions.clientInstanceID} is set, and will subsequently be used to populate the Client-Instance-ID HTTP header for all OData calls. The purpose of creating such a client registration is to enable the server to associate various resources with the current instance of the current client application. A "current instance" can survive multiple restarts of the client application so long as the same Client-Instance-ID header value is provided for each OData call to the remote service. This is particularly useful for offline applications which rely on server-side OData change tracking implementations that store per-client server-side state to facilitate change tracking.

Link copied to clipboard
abstract fun unregisterClient(deleteFromServer: Boolean)

Forget any client registration previously established by {@link com.sap.cloud.mobile.kotlin.odata.ClientRegistrationProvider#registerClient(com.sap.cloud.mobile.kotlin.odata.EntityValue?) ClientRegistrationProvider.registerClient}. Also attempts to make a call to the server to delete the associated entity, if the deleteFromServer parameter is true.