Provides the ability to share structured data graphs among Shared Object Containers joined in the same group. The shared data graphs must comply with the Service Data Objects API.
This package provides the API to support replication of structured object state (represented by SDO data graphs) across multiple processes. Specifically, it allows the clients to:
Subsequently, both publishers and subscribers are:
In terms of SDO, the group (or network) acts as a Data Mediator to clients committing a change. That is, the network logs any changes that are made to the data graph by the client between commits. When the client commits, the network uses the data graph's Change Summary to determine what has changed and make it available to other group members (the specifics of how this is done depend on the chosen implementation).
When a client listens to changes from the network, the client itself acts as a Data Mediator to the network; that is, the client logs any changes that are made to the data graph by the network between updates. When an update is received, the client is notified and may use the data graph's Change Summary to determine what has changed (at which point it may process the changes in an application-specific manner).
In the generic case, a client may both commit and receive updates at the same time; it may make changes to the local data graph (with the intention to commit at some point) and decide what to do when a remote update is received (e.g., it may choose to discard its local changes, or merge them in, etc.)
To get started, the client must have a container instance and make sure it is connected (i.e., part of a group) before changes can be made and/or received. With this the client may obtain the service facade, which will allow it to publish/subscribe to data graphs; for instance:
ISharedObjectContainer container = <container instance>;
IDataGraphSharing svc = SDOPlugin.getDefault().getDataGraphSharing(container);
// publish existing data graph instance
ISharedDataGraph sharedDataGraph = svc.publish(dataGraph, id, provider, consumer);
// --OR-- subscribe to a published data graph
ISharedDataGraph sharedDataGraph = svc.subscribe(id, callback, provider, consumer);
DataGraph dataGraph = sharedDataGraph.getDataGraph();
// make changes to the data graph
// ...
sharedDataGraph.commit();
Notes: