org.eclipse.ecf.datashare
Class AbstractShare
java.lang.Object
org.eclipse.ecf.datashare.AbstractShare
- Direct Known Subclasses:
- DocShare
public abstract class AbstractShare
- extends java.lang.Object
Abstract class for sharing data using IChannel
. Subclasses should
be created as desired to share objects of different types.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
channel
protected IChannel channel
adapter
protected IChannelContainerAdapter adapter
AbstractShare
public AbstractShare(IChannelContainerAdapter adapter)
throws ECFException
- Throws:
ECFException
AbstractShare
public AbstractShare(IChannelContainerAdapter adapter,
ID channelID)
throws ECFException
- Throws:
ECFException
AbstractShare
public AbstractShare(IChannelContainerAdapter adapter,
ID channelID,
java.util.Map options)
throws ECFException
- Throws:
ECFException
handleChannelEvent
protected void handleChannelEvent(IChannelEvent event)
- Handle reception of an IChannelEvent.
- Parameters:
event
- the IChannelEvent received. This implementation
detects instances of IChannelMessageEvent
and
calls handleMessage(ID, byte[])
if found. All other
channel events are ignored. Subclasses may override to detect
and respond to other channel events as desired.
handleDisconnectEvent
protected void handleDisconnectEvent(IChannelDisconnectEvent cde)
- Parameters:
cde
-
handleConnectEvent
protected void handleConnectEvent(IChannelConnectEvent cce)
- Parameters:
cce
-
handleMessage
protected abstract void handleMessage(ID fromContainerID,
byte[] data)
- Receive message for this channel. This method will be called asynchronously
by an arbitrary thread when data to the associated channel is received.
- Parameters:
fromContainerID
- the ID of the sender container. Will not be null
.data
- the data received on the channel. Will not be null
.
sendMessage
public void sendMessage(ID toID,
byte[] data)
throws ECFException
- Throws:
ECFException
getChannel
public IChannel getChannel()
isDisposed
public boolean isDisposed()
dispose
public void dispose()