Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpnehrer2005-04-25 02:52:47 +0000
committerpnehrer2005-04-25 02:52:47 +0000
commit3785b6a2cbe9dea258e8fe485c6e0ce124ddbda4 (patch)
tree7f41057a18e5649c2cd2cdde6d01f520fa479b84
parent9504159480fc6266874b084cf84608edd72ca960 (diff)
downloadorg.eclipse.ecf-3785b6a2cbe9dea258e8fe485c6e0ce124ddbda4.tar.gz
org.eclipse.ecf-3785b6a2cbe9dea258e8fe485c6e0ce124ddbda4.tar.xz
org.eclipse.ecf-3785b6a2cbe9dea258e8fe485c6e0ce124ddbda4.zip
Checkpoint.
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/schema/manager.exsd2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IDataShareServiceManager.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IPublicationCallback.java12
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISharedData.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISubscriptionCallback.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateListener.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateProvider.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitablePublicationCallback.java24
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitableSubscriptionCallback.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Agent.java239
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Version.java2
11 files changed, 176 insertions, 115 deletions
diff --git a/framework/bundles/org.eclipse.ecf.datashare/schema/manager.exsd b/framework/bundles/org.eclipse.ecf.datashare/schema/manager.exsd
index 4804bea20..e1a5e2aec 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/schema/manager.exsd
+++ b/framework/bundles/org.eclipse.ecf.datashare/schema/manager.exsd
@@ -62,7 +62,7 @@
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"/>
+ <meta.attribute kind="java" basedOn="org.eclipse.ecf.datashare.IDataShareServiceManager"/>
</appInfo>
</annotation>
</attribute>
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IDataShareServiceManager.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IDataShareServiceManager.java
index 9abdd3eb4..1efdd7a58 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IDataShareServiceManager.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IDataShareServiceManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IPublicationCallback.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IPublicationCallback.java
index a576daef6..c8d6f5d33 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IPublicationCallback.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IPublicationCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
@@ -26,4 +26,14 @@ public interface IPublicationCallback {
* data graph that has been published
*/
void dataPublished(ISharedData graph);
+
+ /**
+ * Notifies the implementor that the publication failed.
+ *
+ * @param graph
+ * shared data graph whose publication failed
+ * @param cause
+ * exception that is the cause of the failure
+ */
+ void publicationFailed(ISharedData graph, Throwable cause);
}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISharedData.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISharedData.java
index 969ac5db6..6e73016da 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISharedData.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISharedData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISubscriptionCallback.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISubscriptionCallback.java
index 1fae39019..2dd37f99f 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISubscriptionCallback.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/ISubscriptionCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateListener.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateListener.java
index 293f2036b..5e2e3fae9 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateListener.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateProvider.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateProvider.java
index 880c95026..2c3c2a5f2 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateProvider.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/IUpdateProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitablePublicationCallback.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitablePublicationCallback.java
index 038956994..03bb15d6e 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitablePublicationCallback.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitablePublicationCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.ecf.datashare.util;
+import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.datashare.IPublicationCallback;
import org.eclipse.ecf.datashare.ISharedData;
@@ -23,6 +24,8 @@ public class WaitablePublicationCallback implements IPublicationCallback {
private boolean published;
+ private Throwable cause;
+
/*
* (non-Javadoc)
*
@@ -33,6 +36,18 @@ public class WaitablePublicationCallback implements IPublicationCallback {
notifyAll();
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.datashare.IPublicationCallback#publicationFailed(org.eclipse.ecf.datashare.ISharedData,
+ * java.lang.Throwable)
+ */
+ public synchronized void publicationFailed(ISharedData graph,
+ Throwable cause) {
+ this.cause = cause;
+ notifyAll();
+ }
+
/**
* Blocks the calling thread until the data graph is published.
*
@@ -42,10 +57,13 @@ public class WaitablePublicationCallback implements IPublicationCallback {
* if interrupted while waiting for notification
*/
public synchronized boolean waitForPublication(long timeout)
- throws InterruptedException {
- if (!published)
+ throws InterruptedException, ECFException {
+ if (!published && cause == null)
wait(timeout);
+ if (cause != null)
+ throw new ECFException(cause);
+
return published;
}
}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitableSubscriptionCallback.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitableSubscriptionCallback.java
index 24742e389..17da8bd3e 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitableSubscriptionCallback.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/datashare/util/WaitableSubscriptionCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Agent.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Agent.java
index 7321bcec8..adfefcb29 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Agent.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Agent.java
@@ -19,112 +19,145 @@ import org.eclipse.ecf.core.SharedObjectDescription;
import org.eclipse.ecf.core.SharedObjectInitException;
import org.eclipse.ecf.core.events.ISharedObjectActivatedEvent;
import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.core.util.Event;
+import org.eclipse.ecf.datashare.IPublicationCallback;
+import org.eclipse.ecf.datashare.ISharedData;
+import org.eclipse.ecf.datashare.IUpdateListener;
+import org.eclipse.ecf.datashare.IUpdateProvider;
/**
* @author pnehrer
*/
-public class Agent implements ISharedObject {
-
- private Object sharedData;
-
- private ISharedObjectConfig config;
-
- private IBootstrap bootstrap;
-
- public Agent() {
- }
-
- public Agent(Object sharedData) {
- this.sharedData = sharedData;
- }
-
- public Object getSharedData() {
- return sharedData;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig)
- */
- public synchronized void init(ISharedObjectConfig config)
- throws SharedObjectInitException {
- this.config = config;
- Map params = config.getProperties();
- if (params != null)
- sharedData = params.get("sharedData");
-
- bootstrap = new LazyElectionBootstrap();
- bootstrap.setAgent(this);
- bootstrap.init(config);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event)
- */
- public void handleEvent(Event event) {
- if (event instanceof ISharedObjectActivatedEvent) {
- ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
- if (e.getActivatedID().equals(config.getSharedObjectID()))
- handleActivated();
- }
-
- bootstrap.handleEvent(event);
- }
-
- private void handleActivated() {
- if (config.getHomeContainerID().equals(
- config.getContext().getLocalContainerID()))
- try {
- config.getContext().sendCreate(
- null,
- new SharedObjectDescription(config.getSharedObjectID(),
- getClass()));
- } catch (IOException e) {
- handleError(e);
- }
-
- // TODO tell client we're ready
- }
-
- public void doBootstrap(ID containerID) {
- // TODO bootstrap the new member
- }
-
- private void handleError(Throwable t) {
- t.printStackTrace();
- }
-
- /*
- * (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) {
- bootstrap.dispose(containerID);
- bootstrap = null;
- config = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class clazz) {
- return null;
- }
+public class Agent implements ISharedData, ISharedObject {
+
+ private Object sharedData;
+
+ private ISharedObjectConfig config;
+
+ private IBootstrap bootstrap;
+
+ private IUpdateProvider updateProvider;
+
+ private IUpdateListener updateListener;
+
+ private IPublicationCallback pubCallback;
+
+ public Agent() {
+ }
+
+ public Agent(Object sharedData) {
+ this.sharedData = sharedData;
+ }
+
+ public synchronized ID getID() {
+ return config == null ? null : config.getSharedObjectID();
+ }
+
+ public Object getData() {
+ return sharedData;
+ }
+
+ public synchronized void commit() throws ECFException {
+ }
+
+ public synchronized void dispose() {
+ if (config != null)
+ try {
+ config.getContext().sendDispose(
+ config.getContext().getLocalContainerID());
+ } catch (IOException e) {
+ handleError(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig)
+ */
+ public synchronized void init(ISharedObjectConfig config)
+ throws SharedObjectInitException {
+ this.config = config;
+ Map params = config.getProperties();
+ if (params != null)
+ sharedData = params.get("sharedData");
+
+ bootstrap = new LazyElectionBootstrap();
+ bootstrap.setAgent(this);
+ bootstrap.init(config);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event)
+ */
+ public void handleEvent(Event event) {
+ if (event instanceof ISharedObjectActivatedEvent) {
+ ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
+ if (e.getActivatedID().equals(config.getSharedObjectID()))
+ handleActivated();
+ }
+
+ bootstrap.handleEvent(event);
+ }
+
+ private void handleActivated() {
+ if (config.getHomeContainerID().equals(
+ config.getContext().getLocalContainerID()))
+ try {
+ config.getContext().sendCreate(
+ null,
+ new SharedObjectDescription(config.getSharedObjectID(),
+ getClass()));
+
+ if (pubCallback != null)
+ pubCallback.dataPublished(this);
+ } catch (IOException e) {
+ handleError(e);
+ if (pubCallback != null)
+ pubCallback.publicationFailed(this, e);
+ } finally {
+ pubCallback = null;
+ }
+ }
+
+ public void doBootstrap(ID containerID) {
+ // TODO bootstrap the new member
+ }
+
+ private void handleError(Throwable t) {
+ t.printStackTrace();
+ }
+
+ /*
+ * (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) {
+ bootstrap.dispose(containerID);
+ bootstrap = null;
+ config = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class clazz) {
+ return null;
+ }
}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Version.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Version.java
index daad4e356..2c3f1bcb2 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Version.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/internal/datashare/Version.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 Peter Nehrer and Composent, Inc.
+ * 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

Back to the top