use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ScribbleClient method createChannel.
protected void createChannel() throws ECFException {
// Get IChannelContainerAdapter adapter
IChannelContainerAdapter channelContainer = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class);
// Create channel ID with fixed name 'channel2'
final ID channelID = IDFactory.getDefault().createID(channelContainer.getChannelNamespace(), CHANNEL_ID);
// Setup listener so then when channelmessageevents are received that
// they present in UI
final IChannelListener channelListener = new IChannelListener() {
public void handleChannelEvent(final IChannelEvent event) {
if (event instanceof IChannelMessageEvent) {
IChannelMessageEvent msg = (IChannelMessageEvent) event;
scribbleView.handleDrawLine(msg.getData());
}
}
};
// Create new channel
IChannel channel = channelContainer.createChannel(channelID, channelListener, new HashMap());
// Set the view to use the given channel (for sending)
scribbleView.setChannel(channel);
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ChannelTest method testGetChannelNamespace.
public void testGetChannelNamespace() throws Exception {
final IChannelContainerAdapter channelContainer = getChannelContainer(0);
assertNotNull(channelContainer.getChannelNamespace());
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ChannelTest method testSender.
public void testSender() throws Exception {
final IChannelContainerAdapter senderContainer = getChannelContainer(0);
final IChannel sender = senderContainer.getChannel(getNewID(CHANNEL_NAME));
assertNotNull(sender);
sender.sendMessage(new String("hello").getBytes());
sleep(3000);
for (int i = 1; i < getClientCount(); i++) {
assertNotNull(messageEvents.get(getContainerID(i)));
}
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ChannelTest method addChannelToClients.
/**
*/
protected void addChannelToClients() throws Exception {
for (int i = 0; i < clientCount; i++) {
final IChannelContainerAdapter channelContainer = getChannelContainer(i);
channelContainer.createChannel(getNewID(CHANNEL_NAME), getIChannelListener(getContainerID(i)), null);
}
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ChannelTest method testGetChannelFromContainer.
public void testGetChannelFromContainer() throws Exception {
final IChannelContainerAdapter channelContainer = getChannelContainer(0);
channelContainer.createChannel(getNewID(CHANNEL_NAME_1), getIChannelListener(getContainerID(0)), null);
assertNotNull(channelContainer.getChannel(getNewID(CHANNEL_NAME_1)));
}
Aggregations