Search in sources :

Example 6 with IChannelContainerAdapter

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);
}
Also used : IChannelListener(org.eclipse.ecf.datashare.IChannelListener) IChannel(org.eclipse.ecf.datashare.IChannel) IChannelEvent(org.eclipse.ecf.datashare.events.IChannelEvent) HashMap(java.util.HashMap) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) ID(org.eclipse.ecf.core.identity.ID) IChannelMessageEvent(org.eclipse.ecf.datashare.events.IChannelMessageEvent)

Example 7 with IChannelContainerAdapter

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());
}
Also used : IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter)

Example 8 with IChannelContainerAdapter

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)));
    }
}
Also used : IChannel(org.eclipse.ecf.datashare.IChannel) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter)

Example 9 with IChannelContainerAdapter

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);
    }
}
Also used : IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter)

Example 10 with IChannelContainerAdapter

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)));
}
Also used : IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter)

Aggregations

IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)19 IContainer (org.eclipse.ecf.core.IContainer)7 ID (org.eclipse.ecf.core.identity.ID)6 IChannel (org.eclipse.ecf.datashare.IChannel)5 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)4 Action (org.eclipse.jface.action.Action)4 IAction (org.eclipse.jface.action.IAction)4 HashMap (java.util.HashMap)3 IChannelListener (org.eclipse.ecf.datashare.IChannelListener)3 IChannelEvent (org.eclipse.ecf.datashare.events.IChannelEvent)3 IRoster (org.eclipse.ecf.presence.roster.IRoster)3 IChannelMessageEvent (org.eclipse.ecf.datashare.events.IChannelMessageEvent)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 Job (org.eclipse.core.runtime.jobs.Job)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 BaseChannelConfig (org.eclipse.ecf.datashare.BaseChannelConfig)1 IChannelConfig (org.eclipse.ecf.datashare.IChannelConfig)1 AbstractRosterMenuHandler (org.eclipse.ecf.presence.ui.menu.AbstractRosterMenuHandler)1