Merge "Bug 491525 - Remove SDO example bundles"
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.classpath b/examples/bundles/org.eclipse.ecf.example.sdo.editor/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.gitignore b/examples/bundles/org.eclipse.ecf.example.sdo.editor/.gitignore
deleted file mode 100644
index e660fd9..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-bin/
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.project b/examples/bundles/org.eclipse.ecf.example.sdo.editor/.project
deleted file mode 100644
index 3abc43d..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ecf.example.sdo.editor</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.settings/org.eclipse.jdt.core.prefs b/examples/bundles/org.eclipse.ecf.example.sdo.editor/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 72524eb..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Mon Sep 11 15:21:55 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.example.sdo.editor/META-INF/MANIFEST.MF
deleted file mode 100644
index 4552b15..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: %plugin.name
-Bundle-SymbolicName: org.eclipse.ecf.example.sdo.editor;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.ecf.example.sdo.editor.EditorPlugin
-Bundle-Vendor: %plugin.provider
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.ecf,
- org.eclipse.ecf.sdo,
- org.eclipse.emf.ecore.sdo.editor,
- org.eclipse.ecf.example.collab,
- org.eclipse.ecf.sharedobject
-Provide-Package: org.eclipse.ecf.example.sdo.editor
-Export-Package: org.eclipse.ecf.example.sdo.editor
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
- CDC-1.1/Foundation-1.1
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/about.html b/examples/bundles/org.eclipse.ecf.example.sdo.editor/about.html
deleted file mode 100644
index 5d03fd4..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/build.properties b/examples/bundles/org.eclipse.ecf.example.sdo.editor/build.properties
deleted file mode 100644
index 260d1b3..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-bin.includes = .,\
- plugin.xml,\
- META-INF/,\
- icons/,\
- about.html,\
- plugin.properties
-jars.compile.order = .
-src.includes = META-INF/,\
- icons/,\
- plugin.xml,\
- about.html,\
- plugin.properties,\
- src/
-source.. = src/
-output.. = bin/
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/ctool16/NewSDO.gif b/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/ctool16/NewSDO.gif
deleted file mode 100644
index 1d4d007..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/ctool16/NewSDO.gif
+++ /dev/null
Binary files differ
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/obj16/SDOModelFile.gif b/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/obj16/SDOModelFile.gif
deleted file mode 100644
index 31fb2b5..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/obj16/SDOModelFile.gif
+++ /dev/null
Binary files differ
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/wizban/NewSDO.gif b/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/wizban/NewSDO.gif
deleted file mode 100644
index fa6ebe9..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/icons/full/wizban/NewSDO.gif
+++ /dev/null
Binary files differ
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/launchconfigs/ECF Collab Server with SDO.launch b/examples/bundles/org.eclipse.ecf.example.sdo.editor/launchconfigs/ECF Collab Server with SDO.launch
deleted file mode 100644
index 11d39ad..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/launchconfigs/ECF Collab Server with SDO.launch
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ecf.provider.app.ServerApplication"/>
-<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER" javaProject="org.eclipse.ecf.example.collab" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento project="org.eclipse.ecf.example.collab"/> </runtimeClasspathEntry> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="org.eclipse.ecf.example.sdo.editor" type="1"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="org.eclipse.ecf.provider" type="1"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry path="3" projectName="org.eclipse.ecf.sdo" type="1"/> "/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.ecf.example.sdo.editor"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.ecf.provider.Trace=true -Dorg.eclipse.ecf.Trace=true"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-</launchConfiguration>
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.properties b/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.properties
deleted file mode 100644
index c23c21a..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-/****************************************************************************
-* Copyright (c) 2004 Composent, Inc. and others.
-* 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:
-* Composent, Inc. - initial API and implementation
-*****************************************************************************/
-plugin.name=ECF SDO Editor Example
-plugin.provider=Eclipse.org
-
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.xml b/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.xml
deleted file mode 100644
index 0d42f19..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/plugin.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.1"?>
-<plugin>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.ecf.example.sdo.editor.SharedSDOEditor"
- icon="icons/full/obj16/SDOModelFile.gif"
- default="false"
- name="Shared Data Graph Editor"
- contributorClass="org.eclipse.emf.ecore.sdo.presentation.SDOActionBarContributor"
- id="org.eclipse.ecf.example.sdo.editor.SharedSDOEditor"
- extensions="datagraph"/>
- </extension>
-
-</plugin>
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java
deleted file mode 100644
index 9afe0df..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java
+++ /dev/null
@@ -1,193 +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.example.sdo.editor;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-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.util.ECFException;
-import org.eclipse.ecf.internal.example.collab.CollabClient;
-import org.eclipse.ecf.sdo.DataGraphSharingFactory;
-import org.eclipse.ecf.sdo.ISharedDataGraph;
-import org.eclipse.ecf.sdo.IUpdateConsumer;
-import org.eclipse.ecf.sdo.WaitablePublicationCallback;
-import org.eclipse.ecf.sdo.WaitableSubscriptionCallback;
-import org.eclipse.ecf.sdo.emf.EMFUpdateProvider;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import commonj.sdo.DataGraph;
-
-/**
- * The main plugin class to be used in the desktop.
- *
- * @author pnehrer
- */
-public class EditorPlugin extends AbstractUIPlugin {
- // The shared instance.
- private static EditorPlugin plugin;
-
- // Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public EditorPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle
- .getBundle("org.eclipse.ecf.example.sdo.editor.EditorPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- */
- public static EditorPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle, or 'key' if not
- * found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = EditorPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- public void log(Throwable t) {
- if (t instanceof CoreException)
- getLog().log(((CoreException) t).getStatus());
- else
- getLog().log(
- new Status(Status.ERROR, getBundle().getSymbolicName(), 0,
- "An unexpected error occurred.", t));
- }
-
- public synchronized ISharedDataGraph subscribe(String path,
- IUpdateConsumer consumer) throws ECFException {
- Path p = new Path(path);
- ISharedObjectContainer container = getContainer(ResourcesPlugin
- .getWorkspace().getRoot().getProject(p.segment(0)));
- PublishedGraphTracker tracker = getTracker(container);
-
- ID id = IDFactory.getDefault().createStringID(path);
- WaitableSubscriptionCallback mutex = new WaitableSubscriptionCallback();
- ISharedDataGraph result = DataGraphSharingFactory.getDataGraphSharing(
- container, "default").subscribe(id, new EMFUpdateProvider(),
- consumer, mutex);
- ID containerID = null;
- try {
- containerID = mutex.waitForSubscription(5000);
- } catch (InterruptedException e) {
- throw new ECFException(e);
- }
-
- if (containerID == null)
- throw new ECFException("Subscription timed out.");
-
- tracker.add(id);
- return result;
- }
-
- public synchronized ISharedDataGraph publish(String path,
- DataGraph dataGraph, IUpdateConsumer consumer) throws ECFException {
- Path p = new Path(path);
- ISharedObjectContainer container = getContainer(ResourcesPlugin
- .getWorkspace().getRoot().getProject(p.segment(0)));
- PublishedGraphTracker tracker = getTracker(container);
-
- ID id = IDFactory.getDefault().createStringID(path);
- WaitablePublicationCallback mutex = new WaitablePublicationCallback();
- ISharedDataGraph result = DataGraphSharingFactory.getDataGraphSharing(
- container, "default").publish(dataGraph, id,
- new EMFUpdateProvider(), consumer, mutex);
- try {
- if (!mutex.waitForPublication(5000))
- throw new ECFException("Publication timed out.");
- } catch (InterruptedException e) {
- throw new ECFException(e);
- }
-
- tracker.add(id);
- return result;
- }
-
- public synchronized boolean isPublished(String path) throws ECFException {
- Path p = new Path(path);
- ISharedObjectContainer container = getContainer(ResourcesPlugin
- .getWorkspace().getRoot().getProject(p.segment(0)));
- PublishedGraphTracker tracker = getTracker(container);
- return tracker.isPublished(IDFactory.getDefault().createStringID(path));
- }
-
- public synchronized void checkConnected(IProject project)
- throws ECFException {
- if (getContainer(project) == null)
- throw new ECFException("Project " + project.getName()
- + " is not connected.");
- }
-
- private ISharedObjectContainer getContainer(IProject project)
- throws ECFException {
- return CollabClient.getContainer(project);
- }
-
- private PublishedGraphTracker getTracker(ISharedObjectContainer container)
- throws ECFException {
- ID id = IDFactory.getDefault().createStringID(PublishedGraphTracker.class.getName());
- PublishedGraphTracker tracker = (PublishedGraphTracker) container
- .getSharedObjectManager().getSharedObject(id);
- if (tracker == null) {
- tracker = new PublishedGraphTracker();
- container.getSharedObjectManager().addSharedObject(id, tracker,
- null);
- }
-
- return tracker;
- }
-}
\ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/PublishedGraphTracker.java b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/PublishedGraphTracker.java
deleted file mode 100644
index 7c81e3f..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/PublishedGraphTracker.java
+++ /dev/null
@@ -1,403 +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.example.sdo.editor;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.ecf.core.events.IContainerConnectedEvent;
-import org.eclipse.ecf.core.events.IContainerDisconnectedEvent;
-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.ReplicaSharedObjectDescription;
-import org.eclipse.ecf.core.sharedobject.SharedObjectInitException;
-import org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent;
-import org.eclipse.ecf.core.sharedobject.events.ISharedObjectCreateResponseEvent;
-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;
-
-/**
- * <p>
- * Tracks explicit data graph publication (or any shared object presence,
- * really) across all containers in a connected group using the server replica
- * to bootstrap new members.
- * </p>
- * <p>
- * It works something like this:
- * </p>
- * <ul>
- * <li>The container should first check if an instance of this shared object
- * already exists in their container. If not, create one and add it.</li>
- * <li>The container should call {@link #add(ID) add()}once published/subscribed
- * to a data graph. The method will block until this object activates (if it
- * hasn't already).</li>
- * <li>Upon activation, the primary instance replicates everywhere. This is to
- * assure that there is a server replica (and a replica in the initial set of
- * connected containers).</li>
- * <li>When a new container joins the group, the server will create a replica
- * in it, initialized with its current graph location table. This is to assure
- * that new members are properly bootstrapped.</li>
- * <li>All replicas broadcast additions/removals of their local data graphs and
- * listen to remote additions/removals in order to keep track of what is
- * published and where.</li>
- * <li>When a container leaves the group, all replicas note it and update their
- * graph location tables. Likewise, when a replica deactivates, it broadcasts
- * its departure so others may update their tables.</li>
- * </ul>
- * <p>
- * It is assumed that the container implementation used with this class is
- * server-centric. That is, there is a server that is always connected before
- * any other container may connect. When the server disconnects, everyone else
- * in effect disconnects.
- * </p>
- *
- * @author pnehrer
- */
-public class PublishedGraphTracker implements ISharedObject {
-
- private static final ID[] NO_GRAPHS = {};
-
- private static final int ADD = 0;
-
- private static final int REMOVE = 1;
-
- private static final int LEAVE = 2;
-
- private static final String ARG_TABLE = "table";
-
- private class Table {
-
- private final Hashtable graphs = new Hashtable();
-
- private final Hashtable containers = new Hashtable();
-
- public synchronized void add(ID containerID, ID graphID) {
- HashSet list = (HashSet) graphs.get(containerID);
- if (list == null) {
- list = new HashSet();
- graphs.put(containerID, list);
- }
-
- list.add(graphID);
- list = (HashSet) containers.get(containerID);
- if (list == null) {
- list = new HashSet();
- containers.put(graphID, list);
- }
-
- list.add(containerID);
- }
-
- public synchronized void remove(ID containerID, ID graphID) {
- HashSet list = (HashSet) graphs.get(containerID);
- if (list != null) {
- list.remove(graphID);
- if (list.isEmpty())
- graphs.remove(containerID);
- }
-
- list = (HashSet) containers.get(graphID);
- if (list != null) {
- list.remove(containerID);
- if (list.isEmpty())
- containers.remove(graphID);
- }
- }
-
- public synchronized void remove(ID containerID) {
- HashSet list = (HashSet) graphs.get(containerID);
- if (list != null) {
- for (Iterator i = list.iterator(); i.hasNext();) {
- ID graphID = (ID) i.next();
- list = (HashSet) containers.get(graphID);
- if (list != null) {
- list.remove(containerID);
- if (list.isEmpty())
- containers.remove(graphID);
- }
- }
- }
- }
-
- public synchronized boolean contains(ID graphID) {
- return containers.containsKey(graphID);
- }
-
- public synchronized ID[] getGraphs(ID containerID) {
- HashSet list = (HashSet) graphs.get(containerID);
- return list == null ? NO_GRAPHS : (ID[]) list.toArray(new ID[list
- .size()]);
- }
-
- public synchronized Object createMemento() {
- return new Hashtable[] { graphs, containers };
- }
-
- public synchronized void load(Object memento) {
- Hashtable[] tables = (Hashtable[]) memento;
- graphs.putAll(tables[0]);
- containers.putAll(tables[1]);
- }
- }
-
- private final Table table = new Table();
-
- private ISharedObjectConfig config;
-
- private ISharedObjectContext context;
-
- private final Object activationMutex = new Object();
-
- private boolean activated;
-
- /**
- * Adds a graph to the list of published graphs.
- *
- * @param graphID
- * identifier of the graph that was published
- * @throws ECFException
- */
- public synchronized void add(ID graphID) throws ECFException {
- if (config == null)
- throw new ECFException("Not initialized.");
-
- // wait to be activated before proceeding
- synchronized (activationMutex) {
- if (!activated)
- try {
- activationMutex.wait(1000);
- } catch (InterruptedException e) {
- throw new ECFException(e);
- }
-
- if (!activated)
- throw new ECFException("Not activated.");
- }
-
- // tell everyone a graph was published
- try {
- getContext().sendMessage(null,
- new Object[] { new Integer(ADD), graphID });
- } catch (IOException e) {
- throw new ECFException(e);
- }
-
- // track it yourself
- handleAdd(getContext().getLocalContainerID(), graphID);
- }
-
- /**
- * Answers whether a graph is published (at the time of invocation).
- *
- * @param graphID
- * identifier of the graph whose publishing status to return
- * @return <code>true</code> if the graph is published
- */
- public synchronized boolean isPublished(ID graphID) {
- return table.contains(graphID);
- }
-
- /*
- * (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.");
-
- Map props = (Map) config.getProperties();
- if (props != null) {
- Object memento = props.get(ARG_TABLE);
- if (memento != null)
- table.load(memento);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event)
- */
- public void handleEvent(Event event) {
- if (event instanceof ISharedObjectCreateResponseEvent) {
- // Ignore
- } else if (event instanceof ISharedObjectMessageEvent) {
- // track graph additions/removals and peer departures
- // (deactivations)
- ISharedObjectMessageEvent e = (ISharedObjectMessageEvent) event;
- Object[] data = (Object[]) e.getData();
- Integer type = (Integer) data[0];
- switch (type.intValue()) {
- case ADD:
- handleAdd(e.getRemoteContainerID(), (ID) data[1]);
- break;
-
- case REMOVE:
- handleRemove(e.getRemoteContainerID(), (ID) data[1]);
- break;
-
- case LEAVE:
- handleLeave(e.getRemoteContainerID());
- break;
- }
- } else if (event instanceof IContainerConnectedEvent) {
- IContainerConnectedEvent e = (IContainerConnectedEvent) event;
- if (e.getTargetID().equals(
- getContext().getLocalContainerID()))
- // this container joined
- handleJoined();
- else if (getContext().isGroupManager())
- // some other container joined and we're the server
- handleJoined(e.getTargetID());
- } else if (event instanceof IContainerDisconnectedEvent) {
- IContainerDisconnectedEvent e = (IContainerDisconnectedEvent) event;
- // some other container departed -- same as peer deactivation
- if (!e.getTargetID().equals(
- getContext().getLocalContainerID()))
- handleLeave(e.getTargetID());
- } else if (event instanceof ISharedObjectActivatedEvent) {
- ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
- if (e.getActivatedID().equals(config.getSharedObjectID()))
- // we're being activated
- handleActivated();
- } else if (event instanceof ISharedObjectDeactivatedEvent) {
- ISharedObjectDeactivatedEvent e = (ISharedObjectDeactivatedEvent) event;
- if (e.getDeactivatedID().equals(config.getSharedObjectID()))
- // we're being deactivated
- handleDeactivated();
- else if (table.contains(e.getDeactivatedID()))
- // a local graph we track is being deactivated
- handleRemoved(e.getDeactivatedID());
- }
- }
-
- private void handleAdd(ID containerID, ID graphID) {
- table.add(containerID, graphID);
- }
-
- private void handleRemove(ID containerID, ID graphID) {
- table.remove(containerID, graphID);
- }
-
- private void handleLeave(ID containerID) {
- table.remove(containerID);
- }
-
- private void handleJoined() {
- if (config.getHomeContainerID().equals(
- getContext().getLocalContainerID())) {
- // we're the primary copy -- replicate everywhere
- try {
- getContext().sendCreate(
- null,
- new ReplicaSharedObjectDescription(getClass(),config.getSharedObjectID(),
- config.getHomeContainerID()));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- private void handleJoined(ID containerID) {
- Map props = new HashMap(1);
- props.put(ARG_TABLE, table.createMemento());
- try {
- getContext().sendCreate(
- containerID,
- new ReplicaSharedObjectDescription(getClass(),config.getSharedObjectID(),
- config.getHomeContainerID(), props));
- } catch (IOException ex) {
- // TODO Auto-generated catch block
- ex.printStackTrace();
- }
- }
-
- private void handleActivated() {
- handleJoined();
- synchronized (activationMutex) {
- activated = true;
- activationMutex.notifyAll();
- }
- }
-
- private void handleDeactivated() {
- try {
- getContext().sendMessage(null, new Object[] { new Integer(LEAVE) });
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- synchronized (activationMutex) {
- activated = false;
- activationMutex.notifyAll();
- }
- }
-
- private void handleRemoved(ID graphID) {
- try {
- getContext().sendMessage(null,
- new Object[] { new Integer(REMOVE), graphID });
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- handleRemove(getContext().getLocalContainerID(), graphID);
- }
-
- /*
- * (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) {
- config = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- private ISharedObjectContext getContext() {
- if (context == null)
- context = config.getContext();
-
- return context;
- }
-}
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java
deleted file mode 100644
index cadea0f..0000000
--- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java
+++ /dev/null
@@ -1,131 +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.example.sdo.editor;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.util.ECFException;
-import org.eclipse.ecf.sdo.ISharedDataGraph;
-import org.eclipse.ecf.sdo.IUpdateConsumer;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.sdo.EDataGraph;
-import org.eclipse.emf.ecore.sdo.presentation.SDOEditor;
-import org.eclipse.ui.IFileEditorInput;
-
-import commonj.sdo.ChangeSummary;
-import commonj.sdo.DataGraph;
-
-/**
- * @author pnehrer
- */
-public class SharedSDOEditor extends SDOEditor {
-
- private class UpdateConsumer implements IUpdateConsumer {
- public boolean consumeUpdate(ISharedDataGraph graph, ID containerID) {
- ChangeSummary changeSummary = graph.getDataGraph()
- .getChangeSummary();
- changeSummary.endLogging();
- SharedSDOEditor.super.doSave(null);
- changeSummary.beginLogging();
- return true;
- }
-
- public void updateFailed(ISharedDataGraph graph, ID containerID,
- Throwable cause) {
- EditorPlugin.getDefault().log(
- new CoreException(new Status(Status.ERROR, EditorPlugin
- .getDefault().getBundle().getSymbolicName(), 0,
- "Data graph upate failed.", cause)));
- }
- }
-
- private ISharedDataGraph sharedDataGraph;
-
- protected boolean isConnected(IFileEditorInput editorInput) {
- try {
- EditorPlugin.getDefault()
- .checkConnected(
- ((IFileEditorInput) editorInput).getFile()
- .getProject());
- return true;
- } catch (ECFException e) {
- return false;
- }
-
- }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.ecore.sdo.presentation.SDOEditor#createModel()
- */
- public void createModel() {
- try {
- IFileEditorInput modelFile = (IFileEditorInput) getEditorInput();
- if (isConnected(modelFile)) {
- String path = modelFile.getFile().getFullPath().toString();
- URI uri = URI.createPlatformResourceURI(modelFile.getFile()
- .getFullPath().toString());
- if (EditorPlugin.getDefault().isPublished(path)) {
- sharedDataGraph = EditorPlugin.getDefault().subscribe(path,
- new UpdateConsumer());
- EDataGraph dataGraph = (EDataGraph) sharedDataGraph
- .getDataGraph();
- dataGraph.getDataGraphResource().setURI(uri);
- editingDomain.getResourceSet().getResources().addAll(
- dataGraph.getResourceSet().getResources());
- dataGraph.setResourceSet(editingDomain.getResourceSet());
- } else {
- Resource resource = editingDomain.loadResource(uri.toString());
- DataGraph dataGraph = (DataGraph) resource.getContents().get(0);
- sharedDataGraph = EditorPlugin.getDefault().publish(path,
- dataGraph, new UpdateConsumer());
- }
- } else super.createModel();
- } catch (ECFException e) {
- EditorPlugin.getDefault().log(e);
- if (sharedDataGraph != null) {
- sharedDataGraph.dispose();
- sharedDataGraph = null;
- }
- super.createModel();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.ecore.sdo.presentation.SDOEditor#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor progressMonitor) {
- super.doSave(progressMonitor);
- if (sharedDataGraph != null)
- try {
- sharedDataGraph.commit();
- } catch (ECFException e) {
- EditorPlugin.getDefault().log(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.emf.ecore.sdo.presentation.SDOEditor#dispose()
- */
- public void dispose() {
- if (sharedDataGraph != null)
- sharedDataGraph.dispose();
-
- super.dispose();
- }
-}
\ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/.classpath b/examples/bundles/org.eclipse.ecf.sdo/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/bundles/org.eclipse.ecf.sdo/.gitignore b/examples/bundles/org.eclipse.ecf.sdo/.gitignore
deleted file mode 100644
index e660fd9..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-bin/
diff --git a/examples/bundles/org.eclipse.ecf.sdo/.options b/examples/bundles/org.eclipse.ecf.sdo/.options
deleted file mode 100644
index f460437..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/.options
+++ /dev/null
@@ -1,4 +0,0 @@
-org.eclipse.ecf.sdo/debug=true
-org.eclipse.ecf.sdo/DataGraphSharingFactory=true
-org.eclipse.ecf.sdo/SharedDataGraph=true
-org.eclipse.ecf.sdo/EMFUpdateManager=true
diff --git a/examples/bundles/org.eclipse.ecf.sdo/.project b/examples/bundles/org.eclipse.ecf.sdo/.project
deleted file mode 100644
index 50fe002..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ecf.sdo</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/bundles/org.eclipse.ecf.sdo/.settings/org.eclipse.jdt.core.prefs b/examples/bundles/org.eclipse.ecf.sdo/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index bc03244..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Mon Sep 11 15:29:56 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/examples/bundles/org.eclipse.ecf.sdo/META-INF/MANIFEST.MF b/examples/bundles/org.eclipse.ecf.sdo/META-INF/MANIFEST.MF
deleted file mode 100644
index d027101..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: %plugin.name
-Bundle-SymbolicName: org.eclipse.ecf.sdo;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.ecf.sdo.SDOPlugin$EclipsePlugin
-Bundle-Vendor: %plugin.provider
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.ecore.sdo,
- org.eclipse.ecf,
- org.eclipse.ecf.sharedobject
-Provide-Package: org.eclipse.ecf.sdo,
- org.eclipse.ecf.internal.sdo,
- org.eclipse.ecf.sdo.emf
-Export-Package: org.eclipse.ecf.internal.sdo;x-internal:=true,
- org.eclipse.ecf.sdo,
- org.eclipse.ecf.sdo.emf
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
- CDC-1.1/Foundation-1.1
-Eclipse-AutoStart: true
diff --git a/examples/bundles/org.eclipse.ecf.sdo/about.html b/examples/bundles/org.eclipse.ecf.sdo/about.html
deleted file mode 100644
index 5d03fd4..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/build.properties b/examples/bundles/org.eclipse.ecf.sdo/build.properties
deleted file mode 100644
index c7deb76..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-output.ecf.sdo.jar = bin/
-bin.includes = .,\
- plugin.xml,\
- META-INF/,\
- schema/,\
- about.html,\
- plugin.properties
-src.includes = META-INF/,\
- plugin.xml,\
- schema/,\
- about.html,\
- plugin.properties,\
- src/
-jars.compile.order = .
-source.. = src/
-output.. = bin/
diff --git a/examples/bundles/org.eclipse.ecf.sdo/plugin.properties b/examples/bundles/org.eclipse.ecf.sdo/plugin.properties
deleted file mode 100644
index f523b02..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-/****************************************************************************
-* Copyright (c) 2004 Composent, Inc. and others.
-* 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:
-* Composent, Inc. - initial API and implementation
-*****************************************************************************/
-plugin.name=ECF SDO API
-plugin.provider=Eclipse.org
-
diff --git a/examples/bundles/org.eclipse.ecf.sdo/plugin.xml b/examples/bundles/org.eclipse.ecf.sdo/plugin.xml
deleted file mode 100644
index 27aa3d3..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/plugin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.1"?>
-<plugin>
- <extension-point id="manager" name="Data Graph Sharing Manager" schema="schema/manager.exsd"/>
-
- <extension
- point="org.eclipse.ecf.sdo.manager">
- <manager
- class="org.eclipse.ecf.internal.sdo.DataGraphSharingManager"
- name="default">
- </manager>
- </extension>
-</plugin>
\ No newline at end of file
diff --git a/examples/bundles/org.eclipse.ecf.sdo/schema/manager.exsd b/examples/bundles/org.eclipse.ecf.sdo/schema/manager.exsd
deleted file mode 100644
index 8e11c00..0000000
--- a/examples/bundles/org.eclipse.ecf.sdo/schema/manager.exsd
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ecf.sdo">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ecf.sdo" id="manager" name="Data Graph Sharing Manager"/>
- </appInfo>
- <documentation>
- Allows plugins to provide custom implementations of the Data Graph Sharing facility by registering uniquely named Data Graph Sharing Managers (classes that implement <code>org.eclipse.ecf.sdo.IDataGraphSharingManager</code>), which are responsible for producing per-container instances of the Data Graph Sharing service implementation (<code>org.eclipse.ecf.sdo.IDataGraphSharing</code>).
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="manager" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="manager">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- Unique name that identifies this manager within the system.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The fully qualified name of the class that implements this manager. The class must implement <code>org.eclipse.ecf.sdo.IDataGraphSharingManager</code>.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.ecf.sdo.IDataGraphSharingManager"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- This plugin defines a default Data Graph Sharing Manager:
-<pre>
- <extension
- point="org.eclipse.ecf.sdo.manager">
- <manager
- class="org.eclipse.ecf.internal.sdo.DataGraphSharingManager"
- name="default">
- </manager>
- </extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- To use a registered manager, use the static methods provided by <code>org.eclipse.ecf.sdo.DataGraphSharingFactory</code>.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- A default implementation (named <code>default</code>) is provided by this plugin.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 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
- </documentation>
- </annotation>
-
-</schema>
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 0794f8a..0000000
--- 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 72d36b4..0000000
--- 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 22eebca..0000000
--- 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 80a43bd..0000000
--- 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 2a40a33..0000000
--- 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 37259c3..0000000
--- 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 7ada28f..0000000
--- 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 cede20d..0000000
--- 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 8fe8faa..0000000
--- 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(<container>)}.
- *
- * @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 9a1aae0..0000000
--- 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 6c3068c..0000000
--- 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 80c5e25..0000000
--- 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 8569847..0000000
--- 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 2b53dfd..0000000
--- 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 e53dfbf..0000000
--- 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 d4a3b7c..0000000
--- 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 5c9d0a7..0000000
--- 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 429f7dc..0000000
--- 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 ac131c4..0000000
--- 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 15286a3..0000000
--- 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 = <container instance>;<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>