use of org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription in project ecf by eclipse.
the class TestTransactionSharedObject method getReplicaDescription.
/* (non-Javadoc)
* @see org.eclipse.ecf.core.sharedobject.BaseSharedObject#getReplicaDescription(org.eclipse.ecf.core.identity.ID)
*/
protected ReplicaSharedObjectDescription getReplicaDescription(ID receiver) {
// Put primary state into properties and include in replica description
final Map properties = new HashMap();
properties.put(NAME_PROPERTY, name);
return new ReplicaSharedObjectDescription(this.getClass(), getConfig().getSharedObjectID(), getConfig().getHomeContainerID(), properties);
}
use of org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription in project ecf by eclipse.
the class DiscoveryAgent method connected.
protected void connected() {
if (isPrimary()) {
try {
config.getContext().sendCreate(null, new ReplicaSharedObjectDescription(getClass(), config.getSharedObjectID()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
ArrayList published = new ArrayList();
ISharedObjectContext ctx = config.getContext();
ISharedObjectManager mgr = ctx.getSharedObjectManager();
ID[] ids = mgr.getSharedObjectIDs();
ID containerID = ctx.getLocalContainerID();
for (int i = 0; i < ids.length; ++i) {
Object object = mgr.getSharedObject(ids[i]);
if (object instanceof IPublishedService) {
IPublishedService svc = (IPublishedService) object;
Map props = svc.getProperties();
published.add(new PublishedServiceDescriptor(containerID, ids[i], props));
}
}
if (published.isEmpty())
return;
PublishedServiceDescriptor[] descriptors = new PublishedServiceDescriptor[published.size()];
published.toArray(descriptors);
try {
ctx.sendMessage(config.getHomeContainerID(), SerializationUtil.serialize(new DiscoveryMessage(DiscoveryMessage.ADDED, descriptors)));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
use of org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription in project ecf by eclipse.
the class SubscriptionAgent method createReplicaDescription.
protected ReplicaSharedObjectDescription createReplicaDescription() {
Map props = new HashMap(1);
props.put(SHARED_OBJECT_ID_KEY, sharedObjectID);
return new ReplicaSharedObjectDescription(getClass(), config.getSharedObjectID(), config.getHomeContainerID(), props);
}
use of org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription in project ecf by eclipse.
the class SharedModelFactory method createLocalAgentDescription.
protected SharedObjectDescription createLocalAgentDescription(ID sharedObjectID, ID homeContainerID, Object data, String updaterID) {
HashMap props = new HashMap(2);
props.put(INITIAL_DATA_KEY, data);
props.put(MODEL_UPDATER_KEY, updaterID);
return new ReplicaSharedObjectDescription(LocalAgent.class, sharedObjectID, homeContainerID, props);
}
use of org.eclipse.ecf.core.sharedobject.ReplicaSharedObjectDescription in project ecf by eclipse.
the class LocalAgent method createRemoteAgentDescription.
protected ReplicaSharedObjectDescription createRemoteAgentDescription(ID requestorID) {
Map props = new HashMap(3);
try {
props.put(INITIAL_DATA_KEY, SerializationUtil.serialize(data));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
props.put(MODEL_UPDATER_KEY, updaterID);
props.put(REQUESTOR_ID, requestorID);
return new ReplicaSharedObjectDescription(RemoteAgent.class, config.getSharedObjectID(), config.getHomeContainerID(), props);
}
Aggregations