Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2006-01-03 07:18:47 +0000
committerslewis2006-01-03 07:18:47 +0000
commitd37ddfce4a2e1c7e1aec2e1dec86e5a206c4972a (patch)
tree132b7d1ce785c3e52a8d20b4064fbc15b3520760 /framework/bundles/org.eclipse.ecf.datashare/src
parent5d1377a8945c1fc646ce3602a263c99eb9daafc8 (diff)
downloadorg.eclipse.ecf-d37ddfce4a2e1c7e1aec2e1dec86e5a206c4972a.tar.gz
org.eclipse.ecf-d37ddfce4a2e1c7e1aec2e1dec86e5a206c4972a.tar.xz
org.eclipse.ecf-d37ddfce4a2e1c7e1aec2e1dec86e5a206c4972a.zip
Updates to IChannel and IChannelListener/Event interfaces
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.datashare/src')
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelChangeEvent.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelContainer.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelEvent.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelListener.java5
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelMessageEvent.java9
-rw-r--r--framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/impl/ChannelImpl.java40
6 files changed, 63 insertions, 9 deletions
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelChangeEvent.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelChangeEvent.java
new file mode 100644
index 000000000..c1aaaf3dd
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelChangeEvent.java
@@ -0,0 +1,8 @@
+package org.eclipse.ecf.ds;
+
+import org.eclipse.ecf.core.identity.ID;
+
+public interface IChannelChangeEvent extends IChannelEvent {
+ public boolean hasJoined();
+ public ID getTargetID();
+}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelContainer.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelContainer.java
index b6c05e0c6..bd4a7d917 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelContainer.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelContainer.java
@@ -7,5 +7,5 @@ import org.eclipse.ecf.core.util.ECFException;
public interface IChannelContainer extends IReliableContainer {
public IChannel createChannel(ID channelID) throws ECFException;
public IChannel getChannel(ID channelID);
- public void removeChannel(ID channelID);
+ public boolean disposeChannel(ID channelID);
}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelEvent.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelEvent.java
new file mode 100644
index 000000000..9160e248e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelEvent.java
@@ -0,0 +1,8 @@
+package org.eclipse.ecf.ds;
+
+import org.eclipse.ecf.core.events.IContainerEvent;
+import org.eclipse.ecf.core.identity.ID;
+
+public interface IChannelEvent extends IContainerEvent {
+ public ID getChannelID();
+}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelListener.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelListener.java
index e61381125..929f9c94c 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelListener.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelListener.java
@@ -1,9 +1,6 @@
package org.eclipse.ecf.ds;
-import org.eclipse.ecf.core.identity.ID;
public interface IChannelListener {
- public void handleMessage(ID channelID, byte [] message);
- public void handleMemberJoined(ID channelID, ID joined);
- public void handleMemberDeparted(ID channelID, ID departed);
+ public void handleChannelEvent(IChannelEvent event);
}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelMessageEvent.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelMessageEvent.java
new file mode 100644
index 000000000..8a4fc7756
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/IChannelMessageEvent.java
@@ -0,0 +1,9 @@
+package org.eclipse.ecf.ds;
+
+import org.eclipse.ecf.core.identity.ID;
+
+
+public interface IChannelMessageEvent extends IChannelEvent {
+ public ID getFromID();
+ public byte [] getData();
+}
diff --git a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/impl/ChannelImpl.java b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/impl/ChannelImpl.java
index 22cd44038..6b6df1d9a 100644
--- a/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/impl/ChannelImpl.java
+++ b/framework/bundles/org.eclipse.ecf.datashare/src/org/eclipse/ecf/ds/impl/ChannelImpl.java
@@ -12,7 +12,9 @@ import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.core.util.Event;
import org.eclipse.ecf.core.util.IEventProcessor;
import org.eclipse.ecf.ds.IChannel;
+import org.eclipse.ecf.ds.IChannelChangeEvent;
import org.eclipse.ecf.ds.IChannelListener;
+import org.eclipse.ecf.ds.IChannelMessageEvent;
public class ChannelImpl extends TransactionSharedObject implements IChannel {
@@ -53,23 +55,53 @@ public class ChannelImpl extends TransactionSharedObject implements IChannel {
}
public Event processEvent(Event event) {
if (event instanceof IContainerConnectedEvent) {
- ChannelImpl.this.listener.handleMemberJoined(getID(), ((IContainerConnectedEvent)event).getTargetID());
+ ChannelImpl.this.listener.handleChannelEvent(createChannelChangeEvent(true,((IContainerConnectedEvent)event).getTargetID()));
} else if (event instanceof IContainerDisconnectedEvent) {
- ChannelImpl.this.listener.handleMemberDeparted(getID(), ((IContainerDisconnectedEvent)event).getTargetID());
+ ChannelImpl.this.listener.handleChannelEvent(createChannelChangeEvent(true,((IContainerDisconnectedEvent)event).getTargetID()));
}
return event;
}
});
}
- protected Event handleSharedObjectMsgEvent(SharedObjectMsgEvent event) {
+ protected IChannelChangeEvent createChannelChangeEvent(final boolean hasJoined,final ID targetID) {
+ return new IChannelChangeEvent() {
+ private static final long serialVersionUID = -1085237280463725283L;
+ public boolean hasJoined() {
+ return hasJoined;
+ }
+ public ID getTargetID() {
+ return targetID;
+ }
+ public ID getChannelID() {
+ return getID();
+ }
+ public ID getLocalContainerID() {
+ return getContext().getLocalContainerID();
+ }
+ };
+ }
+ protected Event handleSharedObjectMsgEvent(final SharedObjectMsgEvent event) {
Object data = event.getData();
ChannelMsg channelData = null;
if (data instanceof ChannelMsg) {
channelData = (ChannelMsg) data;
}
if (channelData != null) {
- listener.handleMessage(getID(),channelData.getData());
+ listener.handleChannelEvent(new IChannelMessageEvent() {
+ private static final long serialVersionUID = -2270885918818160970L;
+ public ID getFromID() {
+ return event.getSenderSharedObjectID();
+ }
+ public byte[] getData() {
+ return (byte []) event.getData();
+ }
+ public ID getChannelID() {
+ return getID();
+ }
+ public ID getLocalContainerID() {
+ return getContext().getLocalContainerID();
+ }});
// Discontinue processing of this event...we are it
return null;
}

Back to the top