Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMat Booth2016-04-12 16:08:50 +0000
committerMat Booth2016-04-12 16:21:38 +0000
commitcf27b8492706540f0f04b87c8e13adbeb8d31d83 (patch)
tree5b92142e478dd5db3b94e695c7d0a1b17d9861cc /examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse
parentf0edac53e363d9552bcdf57c7f28f473afbbe4b9 (diff)
downloadorg.eclipse.ecf-cf27b8492706540f0f04b87c8e13adbeb8d31d83.tar.gz
org.eclipse.ecf-cf27b8492706540f0f04b87c8e13adbeb8d31d83.tar.xz
org.eclipse.ecf-cf27b8492706540f0f04b87c8e13adbeb8d31d83.zip
Bug 491525 - Remove SDO example bundles
Change-Id: Ic506c76f4328216f592979b865a6a3d95ce1a6c4 Signed-off-by: Mat Booth <mat.booth@redhat.com>
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse')
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharing.java153
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharingManager.java43
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/ReceiveDataGraphMessage.java60
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/RequestDataGraphMessage.java22
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/SharedDataGraph.java303
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/UpdateDataGraphMessage.java60
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/Version.java70
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/DataGraphSharingFactory.java62
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharing.java75
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharingManager.java23
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IPublicationCallback.java29
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISharedDataGraph.java52
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISubscriptionCallback.java43
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateConsumer.java50
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateProvider.java81
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/SDOPlugin.java203
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitablePublicationCallback.java48
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitableSubscriptionCallback.java73
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/emf/EMFUpdateProvider.java137
-rw-r--r--examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/package.html65
20 files changed, 0 insertions, 1652 deletions
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharing.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharing.java
deleted file mode 100644
index 0794f8a57..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharing.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.sharedobject.ISharedObject;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectConfig;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectContext;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectManager;
-import org.eclipse.ecf.core.sharedobject.SharedObjectInitException;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.core.util.Event;
-import org.eclipse.ecf.sdo.IDataGraphSharing;
-import org.eclipse.ecf.sdo.IPublicationCallback;
-import org.eclipse.ecf.sdo.ISharedDataGraph;
-import org.eclipse.ecf.sdo.ISubscriptionCallback;
-import org.eclipse.ecf.sdo.IUpdateConsumer;
-import org.eclipse.ecf.sdo.IUpdateProvider;
-
-import commonj.sdo.DataGraph;
-
-/**
- * @author pnehrer
- */
-public class DataGraphSharing implements
- IDataGraphSharing, ISharedObject {
-
- static final String DATA_GRAPH_SHARING_ID = DataGraphSharing.class
- .getName();
-
- private ISharedObjectConfig config;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IDataGraphSharing#publish(commonj.sdo.DataGraph,
- * org.eclipse.ecf.core.identity.ID,
- * org.eclipse.ecf.sdo.IUpdateProvider,
- * org.eclipse.ecf.sdo.IUpdateConsumer,
- * org.eclipse.ecf.sdo.IPublicationCallback)
- */
- public synchronized ISharedDataGraph publish(DataGraph dataGraph, ID id,
- IUpdateProvider provider, IUpdateConsumer consumer,
- IPublicationCallback callback) throws ECFException {
-
- if (config == null)
- throw new ECFException("Not initialized.");
-
- // create local object
- ISharedObjectManager mgr = config.getContext().getSharedObjectManager();
- SharedDataGraph sdg = new SharedDataGraph(dataGraph, provider,
- consumer, callback, null);
- mgr.addSharedObject(id, sdg, null);
- return sdg;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IDataGraphSharing#subscribe(org.eclipse.ecf.core.identity.ID,
- * org.eclipse.ecf.sdo.ISubscriptionCallback,
- * org.eclipse.ecf.sdo.IUpdateProvider,
- * org.eclipse.ecf.sdo.IUpdateConsumer)
- */
- public synchronized ISharedDataGraph subscribe(ID id,
- IUpdateProvider provider, IUpdateConsumer consumer,
- ISubscriptionCallback callback) throws ECFException {
-
- if (config == null)
- throw new ECFException("Not initialized.");
-
- // create local object
- ISharedObjectManager mgr = config.getContext().getSharedObjectManager();
- SharedDataGraph sdg = new SharedDataGraph(null, provider, consumer,
- null, callback);
- mgr.addSharedObject(id, sdg, null);
- return sdg;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IDataGraphSharing#dispose()
- */
- public synchronized void dispose() {
- if (config != null)
- config.getContext().getSharedObjectManager().removeSharedObject(
- config.getSharedObjectID());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig)
- */
- public synchronized void init(ISharedObjectConfig initData)
- throws SharedObjectInitException {
-
- if (config == null)
- config = initData;
- else
- throw new SharedObjectInitException("Already initialized.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event)
- */
- public void handleEvent(Event event) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvents(org.eclipse.ecf.core.util.Event[])
- */
- public void handleEvents(Event[] events) {
- for (int i = 0; i < events.length; ++i)
- handleEvent(events[i]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#dispose(org.eclipse.ecf.core.identity.ID)
- */
- public synchronized void dispose(ID containerID) {
- if (config != null) {
- ISharedObjectContext context = config.getContext();
- if (context != null) {
- if (context.getLocalContainerID().equals(containerID)) {
- config = null;
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class clazz) {
- return null;
- }
-} \ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharingManager.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharingManager.java
deleted file mode 100644
index 72d36b475..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/DataGraphSharingManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.identity.IDFactory;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectManager;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.sdo.IDataGraphSharing;
-import org.eclipse.ecf.sdo.IDataGraphSharingManager;
-
-/**
- * @author pnehrer
- */
-public class DataGraphSharingManager implements IDataGraphSharingManager {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IDataGraphSharingManager#getInstance(org.eclipse.ecf.core.ISharedObjectContainer)
- */
- public synchronized IDataGraphSharing getInstance(
- ISharedObjectContainer container) throws ECFException {
- ISharedObjectManager mgr = container.getSharedObjectManager();
- ID id = IDFactory.getDefault().createStringID(DataGraphSharing.DATA_GRAPH_SHARING_ID);
- DataGraphSharing result = (DataGraphSharing) mgr.getSharedObject(id);
- if (result == null) {
- result = new DataGraphSharing();
- mgr.addSharedObject(id, result, null);
- }
-
- return result;
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/ReceiveDataGraphMessage.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/ReceiveDataGraphMessage.java
deleted file mode 100644
index 22eebcab4..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/ReceiveDataGraphMessage.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import java.io.Serializable;
-
-/**
- * @author pnehrer
- */
-public class ReceiveDataGraphMessage implements Serializable {
-
- private static final long serialVersionUID = 3617293441302606899L;
-
- private final Version version;
-
- private final Object data;
-
- public ReceiveDataGraphMessage(Version version, Object data) {
- this.version = version;
- this.data = data;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public Object getData() {
- return data;
- }
-
- public boolean equals(Object other) {
- if (other instanceof ReceiveDataGraphMessage) {
- ReceiveDataGraphMessage o = (ReceiveDataGraphMessage) other;
- return version.equals(o.version) && data.equals(o.data);
- } else
- return false;
- }
-
- public int hashCode() {
- int c = 17;
- c = 37 * c + version.hashCode();
- c = 37 * c + data.hashCode();
- return c;
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer("ReceiveDataGraphMessage[");
- buf.append("version=").append(version).append(";");
- buf.append("data=").append(data).append("]");
- return buf.toString();
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/RequestDataGraphMessage.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/RequestDataGraphMessage.java
deleted file mode 100644
index 80a43bdc1..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/RequestDataGraphMessage.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import java.io.Serializable;
-
-/**
- * @author pnehrer
- */
-public class RequestDataGraphMessage implements Serializable {
-
- private static final long serialVersionUID = 3546646511992713267L;
-
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/SharedDataGraph.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/SharedDataGraph.java
deleted file mode 100644
index 2a40a33de..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/SharedDataGraph.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import java.io.IOException;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.sharedobject.ISharedObject;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectConfig;
-import org.eclipse.ecf.core.sharedobject.ISharedObjectContext;
-import org.eclipse.ecf.core.sharedobject.SharedObjectInitException;
-import org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent;
-import org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent;
-import org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.core.util.Event;
-import org.eclipse.ecf.sdo.IPublicationCallback;
-import org.eclipse.ecf.sdo.ISharedDataGraph;
-import org.eclipse.ecf.sdo.ISubscriptionCallback;
-import org.eclipse.ecf.sdo.IUpdateConsumer;
-import org.eclipse.ecf.sdo.IUpdateProvider;
-import org.eclipse.ecf.sdo.SDOPlugin;
-
-import commonj.sdo.ChangeSummary;
-import commonj.sdo.DataGraph;
-
-/**
- * @author pnehrer
- */
-public class SharedDataGraph implements ISharedObject, ISharedDataGraph {
-
- public static final String TRACE_TAG = "SharedDataGraph";
-
- private final IUpdateConsumer updateConsumer;
-
- private final ISubscriptionCallback subscriptionCallback;
-
- private final IPublicationCallback publicationCallback;
-
- private final IUpdateProvider updateProvider;
-
- private ISharedObjectConfig config;
-
- private DataGraph dataGraph;
-
- private Version version;
-
- SharedDataGraph(DataGraph dataGraph, IUpdateProvider updateProvider,
- IUpdateConsumer updateConsumer,
- IPublicationCallback publicationCallback,
- ISubscriptionCallback subscriptionCallback) {
- if (updateProvider == null)
- throw new IllegalArgumentException("updateProvider");
-
- if (updateConsumer == null)
- throw new IllegalArgumentException("updateConsumer");
-
- this.dataGraph = dataGraph;
- this.updateProvider = updateProvider;
- this.updateConsumer = updateConsumer;
- this.publicationCallback = publicationCallback;
- this.subscriptionCallback = subscriptionCallback;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISharedDataGraph#getID()
- */
- public synchronized ID getID() {
- return config == null ? null : config.getSharedObjectID();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISharedDataGraph#getDataGraph()
- */
- public synchronized DataGraph getDataGraph() {
- return dataGraph;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISharedDataGraph#dispose()
- */
- public synchronized void dispose() {
- if (config != null)
- config.getContext().getSharedObjectManager().removeSharedObject(
- config.getSharedObjectID());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISharedDataGraph#commit()
- */
- public synchronized void commit() throws ECFException {
- if (config == null)
- throw new ECFException("Object is disconnected.");
-
- if (dataGraph == null)
- throw new ECFException("Not subscribed.");
-
- ChangeSummary changeSummary = dataGraph.getChangeSummary();
- if (changeSummary.getChangedDataObjects().isEmpty())
- return;
-
- changeSummary.endLogging();
- byte[] data = updateProvider.createUpdate(this);
- try {
- config.getContext().sendMessage(null,
- new UpdateDataGraphMessage(version, data));
- } catch (IOException e) {
- throw new ECFException(e);
- }
-
- changeSummary.beginLogging();
- version = version.getNext(config.getContext().getLocalContainerID());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig)
- */
- public synchronized void init(ISharedObjectConfig initData)
- throws SharedObjectInitException {
- if (config == null)
- config = initData;
- else
- throw new SharedObjectInitException("Already initialized.");
-
- if (version == null)
- version = new Version(config.getSharedObjectID());
-
- if (dataGraph != null)
- dataGraph.getChangeSummary().beginLogging();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.util.Event)
- */
- public void handleEvent(Event event) {
- if (event instanceof ISharedObjectActivatedEvent
- && ((ISharedObjectActivatedEvent) event).getActivatedID()
- .equals(config.getSharedObjectID())) {
- synchronized (this) {
- if (dataGraph == null) {
- try {
- config.getContext().sendMessage(null,
- new RequestDataGraphMessage());
- } catch (IOException e) {
- if (subscriptionCallback != null)
- subscriptionCallback.subscriptionFailed(this, e);
- }
- } else if (publicationCallback != null)
- publicationCallback.dataGraphPublished(this);
- }
- } else if (event instanceof ISharedObjectDeactivatedEvent
- && ((ISharedObjectDeactivatedEvent) event).getDeactivatedID()
- .equals(config.getSharedObjectID())) {
- synchronized (this) {
- if (dataGraph != null
- && dataGraph.getChangeSummary().isLogging())
- dataGraph.getChangeSummary().endLogging();
- }
- } else if (event instanceof ISharedObjectMessageEvent) {
- ISharedObjectMessageEvent e = (ISharedObjectMessageEvent) event;
- Object msg = e.getData();
- if (msg instanceof RequestDataGraphMessage)
- handleRequestDataGraphMessage(e.getRemoteContainerID());
- else if (msg instanceof ReceiveDataGraphMessage) {
- ReceiveDataGraphMessage m = (ReceiveDataGraphMessage) msg;
- handleReceiveDataGraphMessage(e.getRemoteContainerID(), m
- .getVersion(), m.getData());
- } else if (msg instanceof UpdateDataGraphMessage) {
- UpdateDataGraphMessage m = (UpdateDataGraphMessage) msg;
- handleUpdateDataGraphMessage(e.getRemoteContainerID(), m
- .getVersion(), m.getData());
- }
- }
- }
-
- private synchronized void handleRequestDataGraphMessage(ID containerID) {
- if (dataGraph == null)
- return;
-
- try {
- Object data = updateProvider.serializeDataGraph(dataGraph);
- config.getContext().sendMessage(containerID,
- new ReceiveDataGraphMessage(version, data));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- private synchronized void handleReceiveDataGraphMessage(ID containerID,
- Version v, Object data) {
- if (dataGraph == null) {
- try {
- dataGraph = updateProvider.deserializeDataGraph(data);
- } catch (IOException e) {
- // keep waiting; maybe we can successfully deserialize another
- // message...
- return;
- } catch (ClassNotFoundException e) {
- // keep waiting; maybe we can successfully deserialize another
- // message...
- return;
- }
-
- this.version = v;
- dataGraph.getChangeSummary().beginLogging();
- if (subscriptionCallback != null)
- subscriptionCallback.dataGraphSubscribed(this, containerID);
- }
- }
-
- private synchronized void handleUpdateDataGraphMessage(ID containerID,
- Version v, Object data) {
- if (dataGraph == null)
- return;
-
- if (!v.equals(this.version)) {
- if (SDOPlugin.isTracing(TRACE_TAG))
- SDOPlugin.getTraceLog().println(
- "Version mismatch: current=" + this.version + "; new="
- + v);
-
- updateConsumer.updateFailed(this, containerID, null);
- return;
- }
-
- try {
- updateProvider.applyUpdate(this, data);
- } catch (ECFException e) {
- updateConsumer.updateFailed(this, containerID, e);
- return;
- }
-
- if (updateConsumer.consumeUpdate(this, containerID))
- this.version = version.getNext(containerID);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvents(org.eclipse.ecf.util.Event[])
- */
- public void handleEvents(Event[] events) {
- for (int i = 0; i < events.length; ++i)
- handleEvent(events[i]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#dispose(org.eclipse.ecf.identity.ID)
- */
- public synchronized void dispose(ID containerID) {
- if (config != null) {
- // TODO Do we even have a context now?
- ISharedObjectContext context = config.getContext();
- if (context != null
- && context.getLocalContainerID().equals(containerID)) {
- config = null;
- }
- }
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer("SharedDataGraph[");
- buf.append("provider=").append(updateProvider).append(";");
- buf.append("consumer=").append(updateConsumer).append(";");
- buf.append("callback=").append(subscriptionCallback).append(";");
- buf.append("config=").append(config).append(";");
- buf.append("dataGraph=").append(dataGraph).append(";");
- buf.append("version=").append(version).append("]");
- return buf.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class clazz) {
- return null;
- }
-} \ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/UpdateDataGraphMessage.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/UpdateDataGraphMessage.java
deleted file mode 100644
index 37259c331..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/UpdateDataGraphMessage.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import java.io.Serializable;
-
-/**
- * @author pnehrer
- */
-public class UpdateDataGraphMessage implements Serializable {
-
- private static final long serialVersionUID = 3256439205344260914L;
-
- private final Version version;
-
- private final Object data;
-
- public UpdateDataGraphMessage(Version version, Object data) {
- this.version = version;
- this.data = data;
- }
-
- public Version getVersion() {
- return version;
- }
-
- public Object getData() {
- return data;
- }
-
- public boolean equals(Object other) {
- if (other instanceof UpdateDataGraphMessage) {
- UpdateDataGraphMessage o = (UpdateDataGraphMessage) other;
- return version.equals(o.version) && data.equals(o.data);
- } else
- return false;
- }
-
- public int hashCode() {
- int c = 17;
- c = 37 * c + version.hashCode();
- c = 37 * c + data.hashCode();
- return c;
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer("UpdateDataGraphMessage[");
- buf.append("version=").append(version).append(";");
- buf.append("data=").append(data).append("]");
- return buf.toString();
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/Version.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/Version.java
deleted file mode 100644
index 7ada28faa..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/internal/sdo/Version.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.internal.sdo;
-
-import java.io.Serializable;
-
-import org.eclipse.ecf.core.identity.ID;
-
-/**
- * @author pnehrer
- */
-public class Version implements Serializable {
-
- private static final long serialVersionUID = 3258415036413456951L;
-
- private final long sequence;
-
- private final ID containerID;
-
- public Version(ID sourceID) {
- this(0, sourceID);
- }
-
- private Version(long sequence, ID sourceID) {
- this.sequence = sequence;
- this.containerID = sourceID;
- }
-
- public long getSequence() {
- return sequence;
- }
-
- public ID getContainerID() {
- return containerID;
- }
-
- public Version getNext(ID sourceID) {
- return new Version(sequence + 1, sourceID);
- }
-
- public boolean equals(Object other) {
- if (other instanceof Version) {
- Version o = (Version) other;
- return sequence == o.sequence && containerID.equals(o.containerID);
- } else
- return false;
- }
-
- public int hashCode() {
- int c = 17;
- c = 37 * c + (int) sequence;
- c = 37 * c + containerID.hashCode();
- return c;
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer("Version[");
- buf.append("sequence=").append(sequence).append(";");
- buf.append("containerID=").append(containerID).append("]");
- return buf.toString();
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/DataGraphSharingFactory.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/DataGraphSharingFactory.java
deleted file mode 100644
index cede20d8b..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/DataGraphSharingFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import java.util.Hashtable;
-
-import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
-import org.eclipse.ecf.core.util.ECFException;
-
-/**
- * @author pnehrer
- */
-public class DataGraphSharingFactory {
-
- public static final String TRACE_TAG = "DataGraphSharingFactory";
-
- private static final Hashtable managers = new Hashtable();
-
- private DataGraphSharingFactory() {
- }
-
- public static final IDataGraphSharing getDataGraphSharing(
- ISharedObjectContainer container, String name) throws ECFException {
-
- IDataGraphSharingManager instantiator = (IDataGraphSharingManager) managers
- .get(name);
- if (instantiator == null)
- return null;
- else
- return instantiator.getInstance(container);
- }
-
- public static void registerManager(String name,
- IDataGraphSharingManager manager) {
- if (SDOPlugin.isTracing(TRACE_TAG))
- SDOPlugin.getTraceLog().println("registerManager: " + name);
-
- managers.put(name, manager);
- }
-
- public static void unregisterManager(String name) {
- if (SDOPlugin.isTracing(TRACE_TAG))
- SDOPlugin.getTraceLog().println("unregisterManager: " + name);
-
- managers.remove(name);
- }
-
- static void unregisterAllManagers() {
- if (SDOPlugin.isTracing(TRACE_TAG))
- SDOPlugin.getTraceLog().println("unregisterAllManagers");
-
- managers.clear();
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharing.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharing.java
deleted file mode 100644
index 8fe8faa69..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharing.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-
-import commonj.sdo.DataGraph;
-
-/**
- * Allows clients to participate in data graph sharing. A container-specific
- * instance may be obtained by calling
- * {@link org.eclipse.ecf.sdo.SDOPlugin#getDataGraphSharing(org.eclipse.ecf.ISharedObjectContainer) SDOPlugin.getDataGraphSharing(&lt;container&gt;)}.
- *
- * @author pnehrer
- */
-public interface IDataGraphSharing {
-
- /**
- * Publishes the given data graph under the given id.
- *
- * @param dataGraph
- * local data graph instance to share
- * @param id
- * identifier under which to share this data graph
- * @param provider
- * update provider compatible with the given data graph's
- * implementation
- * @param consumer
- * application-specific update consumer
- * @param callback
- * optional callback used to notify the caller about publication
- * status
- * @return shared data graph
- * @throws ECFException
- */
- ISharedDataGraph publish(DataGraph dataGraph, ID id,
- IUpdateProvider provider, IUpdateConsumer consumer,
- IPublicationCallback callback) throws ECFException;
-
- /**
- * Subscribes to a data graph with the given id.
- *
- * @param id
- * identifier of a previously-published data graph
- * @param provider
- * update provider compatible with the given data graph's
- * implementation
- * @param consumer
- * application-specific update consumer
- * @param callback
- * optional callback used to notify the caller about subscription
- * status
- *
- * @return shared data graph
- * @throws ECFException
- */
- ISharedDataGraph subscribe(ID id, IUpdateProvider provider,
- IUpdateConsumer consumer, ISubscriptionCallback callback)
- throws ECFException;
-
- /**
- * Disposes this instance, after which it will be no longer possible to
- * publish or subscribe.
- */
- void dispose();
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharingManager.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharingManager.java
deleted file mode 100644
index 9a1aae05f..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IDataGraphSharingManager.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
-import org.eclipse.ecf.core.util.ECFException;
-
-/**
- * @author pnehrer
- */
-public interface IDataGraphSharingManager {
-
- IDataGraphSharing getInstance(ISharedObjectContainer container)
- throws ECFException;
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IPublicationCallback.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IPublicationCallback.java
deleted file mode 100644
index 6c3068c56..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IPublicationCallback.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-/**
- * Interface used by service implementations to notify publishing applications
- * of the publication status.
- *
- * @author pnehrer
- */
-public interface IPublicationCallback {
-
- /**
- * Notifies implementor that the give data graph has been successfully
- * published.
- *
- * @param graph
- * data graph that has been published
- */
- void dataGraphPublished(ISharedDataGraph graph);
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISharedDataGraph.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISharedDataGraph.java
deleted file mode 100644
index 80c5e2533..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISharedDataGraph.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-
-import commonj.sdo.DataGraph;
-
-/**
- * Represents a shared data graph. Provides access to local data graph instance
- * and allows clients to share (commit) local changes with the network.
- *
- * @author pnehrer
- */
-public interface ISharedDataGraph {
-
- /**
- * Returns the shared data graph identifier.
- *
- * @return id of the shared data graph
- */
- ID getID();
-
- /**
- * Returns local instance of the data graph.
- *
- * @return local instance of the data graph
- */
- DataGraph getDataGraph();
-
- /**
- * Commits any outstanding local changes to the network.
- *
- * @throws ECFException
- */
- void commit() throws ECFException;
-
- /**
- * Disposes this shared data graph. This will make it impossible to commit
- * any further changes. Also, no more remote updates will be received.
- */
- void dispose();
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISubscriptionCallback.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISubscriptionCallback.java
deleted file mode 100644
index 856984777..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/ISubscriptionCallback.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-
-/**
- * Interface used by service implementations to notify subscribing applications
- * of the subscription status.
- *
- * @author pnehrer
- */
-public interface ISubscriptionCallback {
-
- /**
- * Notifies the implementor that the given graph has been successfully
- * subscribed to.
- *
- * @param graph
- * shared data graph that has been subscribed
- * @param containerID
- * id of the container that originated the initial copy
- */
- void dataGraphSubscribed(ISharedDataGraph graph, ID containerID);
-
- /**
- * Notifies the implementor that the subscription failed.
- *
- * @param graph
- * shared data graph whose subscription failed
- * @param cause
- * exception that is the cause of the failure
- */
- void subscriptionFailed(ISharedDataGraph graph, Throwable cause);
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateConsumer.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateConsumer.java
deleted file mode 100644
index 2b53dfd0b..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-
-/**
- * Interface used by service implementations to notify the application that a
- * change has been made to the data graph by a remote group member.
- *
- * @author pnehrer
- */
-public interface IUpdateConsumer {
-
- /**
- * Gives implementor the opportunity to consume the remote update. The
- * implementor is expected to leave behind an empty Change Summary (with
- * logging turned on).
- *
- * @param graph
- * shared data graph whose remote changes to consume
- * @param containerID
- * id of the remote container that made the change
- * @return <code>true</code> if the update has been consumed,
- * <code>false</code> otherwise (the update will be rejected as a
- * result)
- */
- boolean consumeUpdate(ISharedDataGraph graph, ID containerID);
-
- /**
- * Notifies the implementor that a remote update has been received, but was
- * not successfully applied (i.e., cannot be consumed).
- *
- * @param graph
- * shared data graph whose update failed
- * @param containerID
- * id of the container that sent the update
- * @param cause
- * optional exception that caused the failure
- */
- void updateFailed(ISharedDataGraph graph, ID containerID, Throwable cause);
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateProvider.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateProvider.java
deleted file mode 100644
index e53dfbf1a..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/IUpdateProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import java.io.IOException;
-
-import org.eclipse.ecf.core.util.ECFException;
-
-import commonj.sdo.DataGraph;
-
-/**
- * <p>
- * Interface used by service implementations to manage SDO
- * implementation-specific data graph updates. Upon commit, the service needs to
- * create an update (an arbitrary serializable object), which it then propagates
- * across the network. On the other end, the service needs to apply the received
- * update to the local data graph.
- * </p>
- * <p>
- * Until serialization-related issues within ECF are resolved, the service also
- * needs to delegate data graph (de)serialization during subscription.
- * </p>
- *
- * @author pnehrer
- */
-public interface IUpdateProvider {
-
- /**
- * Creates an update from the given data graph, which will be forwarded to
- * other group members. The implementor may use the graph's Change Summary
- * to find out what changed.
- *
- * @param graph
- * shared data graph from whose changes to create the update
- * @return serialized update data
- * @throws ECFException when an update cannot be created
- */
- byte[] createUpdate(ISharedDataGraph graph) throws ECFException;
-
- /**
- * Applies the remote update to the given data graph. The implementor is
- * expected to create a Change Summary that reflects the received changes.
- *
- * @param graph
- * local data graph to which to apply the update
- * @param data
- * update data received from a remote group member
- * @throws ECFException when this update cannot be applied
- */
- void applyUpdate(ISharedDataGraph graph, Object data) throws ECFException;
-
- /**
- * Serializes the given data graph.
- *
- * @param graph
- * data graph instance to serialize
- * @return serialized data graph
- * @throws IOException
- */
- Object serializeDataGraph(DataGraph graph) throws IOException;
-
- /**
- * Deserializes the given data graph.
- *
- * @param data
- * serialized data graph
- * @return deserialized instance of data graph
- * @throws IOException
- * @throws ClassNotFoundException
- */
- DataGraph deserializeDataGraph(Object data) throws IOException,
- ClassNotFoundException;
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/SDOPlugin.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/SDOPlugin.java
deleted file mode 100644
index d4a3b7c96..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/SDOPlugin.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import java.io.PrintStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IRegistryChangeEvent;
-import org.eclipse.core.runtime.IRegistryChangeListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author pnehrer
- */
-public class SDOPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.ecf.sdo";
-
- private static final String TRACE_PREFIX = PLUGIN_ID + "/";
-
- private static EclipsePlugin plugin;
-
- private static boolean tracingEnabled = Boolean.getBoolean(TRACE_PREFIX
- + "debug");
-
- private SDOPlugin() {
- }
-
- public static void log(Object entry) {
- if (plugin == null) {
- if (entry instanceof Throwable)
- ((Throwable) entry).printStackTrace();
- else
- System.err.println(entry);
- } else {
- plugin.log(entry);
- }
- }
-
- public static boolean isTracing(String tag) {
- if (tracingEnabled) {
- return plugin == null ? Boolean.getBoolean(TRACE_PREFIX + tag)
- : plugin.isTracing(tag);
- } else
- return false;
- }
-
- public static PrintStream getTraceLog() {
- return System.out;
- }
-
- public static class EclipsePlugin extends Plugin {
-
- private static final String MANAGER_EXTENSION_POINT = "manager";
-
- private static final String MANAGER_EXTENSION = "manager";
-
- private static final String ATTR_NAME = "name";
-
- private static final String ATTR_CLASS = "class";
-
- private IRegistryChangeListener registryChangeListener;
-
- private ServiceTracker extensionRegistryTracker = null;
-
- public EclipsePlugin() {
- plugin = this;
- tracingEnabled = Platform.inDebugMode();
- }
-
- public IExtensionRegistry getExtensionRegistry() {
- return (IExtensionRegistry) extensionRegistryTracker.getService();
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- this.extensionRegistryTracker = new ServiceTracker(context,
- IExtensionRegistry.class.getName(), null);
- this.extensionRegistryTracker.open();
- IExtensionRegistry reg = getExtensionRegistry();
-
- if (reg != null) {
- registryChangeListener = new IRegistryChangeListener() {
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(
- getBundle().getSymbolicName(),
- MANAGER_EXTENSION_POINT);
- for (int i = 0; i < deltas.length; ++i) {
- switch (deltas[i].getKind()) {
- case IExtensionDelta.ADDED:
- registerManagers(deltas[i].getExtension()
- .getConfigurationElements());
- break;
-
- case IExtensionDelta.REMOVED:
- IConfigurationElement[] elems = deltas[i]
- .getExtension().getConfigurationElements();
- for (int j = 0; j < elems.length; ++j) {
- if (!MANAGER_EXTENSION.equals(elems[j]
- .getName()))
- continue;
-
- String name = elems[j].getAttribute(ATTR_NAME);
- if (name != null && name.length() > 0)
- DataGraphSharingFactory
- .unregisterManager(name);
- }
-
- break;
- }
- }
- }
- };
-
- IConfigurationElement[] elems = reg.getConfigurationElementsFor(
- getBundle().getSymbolicName(), MANAGER_EXTENSION_POINT);
- registerManagers(elems);
- }
- }
-
- private void registerManagers(IConfigurationElement[] elems) {
- for (int i = 0; i < elems.length; ++i) {
- if (!MANAGER_EXTENSION.equals(elems[i].getName()))
- continue;
-
- String name = elems[i].getAttribute(ATTR_NAME);
- if (name == null || name.length() == 0)
- continue;
-
- IDataGraphSharingManager mgr;
- try {
- mgr = (IDataGraphSharingManager) elems[i]
- .createExecutableExtension(ATTR_CLASS);
- } catch (Exception ex) {
- continue;
- }
-
- DataGraphSharingFactory.registerManager(name, mgr);
- }
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null && registryChangeListener != null)
- reg.removeRegistryChangeListener(
- registryChangeListener);
-
- DataGraphSharingFactory.unregisterAllManagers();
- if (extensionRegistryTracker != null) {
- extensionRegistryTracker.close();
- extensionRegistryTracker = null;
- }
- super.stop(context);
- }
-
- public void log(Object entry) {
- IStatus status;
- if (entry instanceof IStatus)
- status = (IStatus) entry;
- else if (entry instanceof CoreException)
- status = ((CoreException) entry).getStatus();
- else if (entry instanceof Throwable) {
- Throwable t = (Throwable) entry;
- status = new Status(Status.ERROR,
- getBundle().getSymbolicName(), 0,
- t.getLocalizedMessage() == null ? "Unknown error." : t
- .getLocalizedMessage(), t);
- } else
- status = new Status(Status.WARNING, getBundle()
- .getSymbolicName(), 0, String.valueOf(entry),
- new RuntimeException().fillInStackTrace());
-
- getLog().log(status);
- }
-
- public boolean isTracing(String tag) {
- return Boolean.TRUE.equals(Boolean.valueOf(Platform
- .getDebugOption(TRACE_PREFIX + tag)));
- }
- }
-} \ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitablePublicationCallback.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitablePublicationCallback.java
deleted file mode 100644
index 5c9d0a7c5..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitablePublicationCallback.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-/**
- * Convenience callback implementation that can be used to block the calling
- * thread until the data graph is published.
- *
- * @author pnehrer
- */
-public class WaitablePublicationCallback implements IPublicationCallback {
-
- private boolean published;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IPublicationCallback#dataGraphPublished(org.eclipse.ecf.sdo.ISharedDataGraph)
- */
- public synchronized void dataGraphPublished(ISharedDataGraph graph) {
- published = true;
- notifyAll();
- }
-
- /**
- * Blocks the calling thread until the data graph is published.
- *
- * @param timeout
- * period, in milliseconds, to wait for publication
- * @throws InterruptedException
- * if interrupted while waiting for notification
- */
- public synchronized boolean waitForPublication(long timeout)
- throws InterruptedException {
- if (!published)
- wait(timeout);
-
- return published;
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitableSubscriptionCallback.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitableSubscriptionCallback.java
deleted file mode 100644
index 429f7dc3a..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/WaitableSubscriptionCallback.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo;
-
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-
-/**
- * Convenience callback implementation that can be used to block the calling
- * thread until the data graph is obtained.
- *
- * @author pnehrer
- */
-public class WaitableSubscriptionCallback implements ISubscriptionCallback {
-
- private ID containerID;
-
- private Throwable cause;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISubscriptionCallback#dataGraphObtained(org.eclipse.ecf.sdo.ISharedDataGraph,
- * org.eclipse.ecf.core.identity.ID)
- */
- public synchronized void dataGraphSubscribed(ISharedDataGraph graph,
- ID cID) {
- this.containerID = cID;
- notifyAll();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.ISubscriptionCallback#subscriptionFailed(org.eclipse.ecf.sdo.ISharedDataGraph,
- * java.lang.Throwable)
- */
- public synchronized void subscriptionFailed(ISharedDataGraph graph,
- Throwable c) {
- this.cause = c;
- notifyAll();
- }
-
- /**
- * Blocks the calling thread until the data graph is obtained.
- *
- * @param timeout
- * period, in milliseconds, to wait for subscription
- * @return id of the container from which the data graph originated
- * @throws InterruptedException
- * if interrupted while waiting for notification
- * @throws ECFException
- * if subscription failed
- */
- public synchronized ID waitForSubscription(long timeout)
- throws InterruptedException, ECFException {
- if (containerID == null && cause == null)
- wait(timeout);
-
- if (cause != null)
- throw new ECFException(cause);
-
- return containerID;
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/emf/EMFUpdateProvider.java b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/emf/EMFUpdateProvider.java
deleted file mode 100644
index ac131c436..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/emf/EMFUpdateProvider.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Peter Nehrer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ecf.sdo.emf;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.sdo.ISharedDataGraph;
-import org.eclipse.ecf.sdo.IUpdateProvider;
-import org.eclipse.ecf.sdo.SDOPlugin;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.sdo.EChangeSummary;
-import org.eclipse.emf.ecore.sdo.EDataGraph;
-import org.eclipse.emf.ecore.sdo.util.SDOUtil;
-
-import commonj.sdo.DataGraph;
-
-/**
- * Update provider capable of handling EMF-based SDO data graphs.
- *
- * @author pnehrer
- */
-public class EMFUpdateProvider implements IUpdateProvider {
-
- public static final String TRACE_TAG = "EMFUpdateProvider";
-
- private EDataGraph clone(EDataGraph source) throws IOException {
- ByteArrayOutputStream buf = new ByteArrayOutputStream();
- source.getDataGraphResource().save(buf, null);
- return SDOUtil.loadDataGraph(
- new ByteArrayInputStream(buf.toByteArray()), null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IUpdateProvider#createUpdate(org.eclipse.ecf.sdo.ISharedDataGraph)
- */
- public byte[] createUpdate(ISharedDataGraph graph) throws ECFException {
- EDataGraph clone;
- try {
- clone = clone((EDataGraph) graph.getDataGraph());
- } catch (IOException e) {
- throw new ECFException(e);
- }
-
- EChangeSummary changes = (EChangeSummary) clone.getChangeSummary();
- changes.applyAndReverse();
-
- ByteArrayOutputStream buf = new ByteArrayOutputStream();
- try {
- changes.eResource().save(buf, null);
- if (SDOPlugin.isTracing(TRACE_TAG)) {
- SDOPlugin.getTraceLog().println("commit:");
- changes.eResource().save(SDOPlugin.getTraceLog(), null);
- }
- } catch (IOException e) {
- throw new ECFException(e);
- }
-
- return buf.toByteArray();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IUpdateProvider#applyUpdate(org.eclipse.ecf.sdo.ISharedDataGraph,
- * byte[])
- */
- public void applyUpdate(ISharedDataGraph graph, Object data)
- throws ECFException {
- EDataGraph dataGraph = (EDataGraph) graph.getDataGraph();
- EChangeSummary changeSummary = (EChangeSummary) dataGraph
- .getChangeSummary();
- changeSummary.endLogging();
- // throw away any local changes
- changeSummary.apply();
-
- Resource res = changeSummary.eResource();
- res.unload();
-
- // apply changes from the event
- try {
- res.load(new ByteArrayInputStream((byte[]) data), null);
- if (SDOPlugin.isTracing(TRACE_TAG)) {
- SDOPlugin.getTraceLog().println("processUpdate:");
- res.save(SDOPlugin.getTraceLog(), null);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- changeSummary = (EChangeSummary) res.getContents().get(0);
- dataGraph.setEChangeSummary(changeSummary);
- // leave a change summary showing what has changed
- changeSummary.applyAndReverse();
- changeSummary.resumeLogging();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IUpdateProvider#serializeDataGraph(commonj.sdo.DataGraph)
- */
- public Object serializeDataGraph(DataGraph dataGraph) throws IOException {
- EDataGraph clone = clone((EDataGraph) dataGraph);
- EChangeSummary changeSummary = clone.getEChangeSummary();
- if (changeSummary != null)
- changeSummary.apply();
-
- ByteArrayOutputStream buf = new ByteArrayOutputStream();
- clone.getDataGraphResource().save(buf, null);
- return buf.toByteArray();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.sdo.IUpdateProvider#deserializeDataGraph(Object)
- */
- public DataGraph deserializeDataGraph(Object data) throws IOException,
- ClassNotFoundException {
- return SDOUtil.loadDataGraph(new ByteArrayInputStream((byte[]) data),
- null);
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/package.html b/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/package.html
deleted file mode 100644
index 15286a3d8..000000000
--- a/examples/bundles/org.eclipse.ecf.sdo/src/org/eclipse/ecf/sdo/package.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
- <meta content="text/html; charset=ISO-8859-1"
- http-equiv="content-type">
- <title>org.eclipse.ecf.sdo</title>
- <meta content="Peter Nehrer" name="author">
-</head>
-<body>
-<p>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.</p>
-<h2>Package Specification</h2>
-<p>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:</p>
-<ol>
- <li>publish SDO data graphs to the group, thus making them available
-for subscription</li>
- <li>subscribe to data graphs published by other group members</li>
-</ol>
-<p>Subsequently, both publishers and subscribers are:</p>
-<ol>
- <li>able to commit changes they make locally, thus making them
-visible to the whole group</li>
- <li>notified when other group members make changes</li>
-</ol>
-<p>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).
-</p>
-<p>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).
-</p>
-<p>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.)
-</p>
-<p>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:
-</p>
-<pre>ISharedObjectContainer container = &lt;container instance&gt;;<br>IDataGraphSharing svc = SDOPlugin.getDefault().getDataGraphSharing(container);<br>// publish existing data graph instance<br>ISharedDataGraph sharedDataGraph = svc.publish(dataGraph, id, provider, consumer);<br>// --OR-- subscribe to a published data graph<br>ISharedDataGraph sharedDataGraph = svc.subscribe(id, callback, provider, consumer);<br>DataGraph dataGraph = sharedDataGraph.getDataGraph();<br>// make changes to the data graph<br>// ...<br>sharedDataGraph.commit();<br></pre>
-<p>Notes:
-</p>
-<ul>
- <li>the container need not be connected until publications or
-subscriptions are attempted</li>
- <li>committing changes and receiving updates will not be possible
-once the container disconnects</li>
- <li>data graph IDs must be unique within the given container</li>
-</ul>
-</body>
-</html>

Back to the top