Package org.eclipse.ecf.datashare

Examples of org.eclipse.ecf.datashare.IChannel


    assertNotNull(channelContainer);
  }

  public void testCreateChannel() throws Exception {
    final IChannelContainerAdapter channelContainer = getChannelContainer(0);
    final IChannel channel = channelContainer.createChannel(getNewID(CHANNEL_NAME_1), getIChannelListener(getContainerID(0)), null);
    assertNotNull(channel);
    assertNotNull(channel.getID());
    assertNotNull(channel.getListener());
  }
View Full Code Here


    assertNotNull(channelContainer.getChannelNamespace());
  }

  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)));
    }
  }
View Full Code Here

          try {
            channelID = icca.getChannelNamespace().createInstance(new Object[] {Activator.PLUGIN_ID});
          } catch (IDCreateException e1) {
            return null;
          }
          final IChannel channel = icca.getChannel(channelID);
          if (channel == null) {
            return null;
          }
          Object element = ((IStructuredSelection) selection).getFirstElement();
          if (element instanceof ITask) {
            final ITask task = (ITask) element;
            Job job = new Job("Send Task") {
              protected IStatus run(IProgressMonitor monitor) {
                monitor.beginTask("Sending task...", 5);
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                TasksUiPlugin.getTaskListManager().getTaskListWriter().writeTask((AbstractTask) task, stream);
                monitor.worked(2);
                try {
                  channel.sendMessage(getRosterEntry().getUser().getID(), stream.toByteArray());
                  monitor.worked(3);
                } catch (Exception e) {
                  return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An error occurred while sending the task.", e);
                } finally {
                  monitor.done();
View Full Code Here

    try {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(bos);
      oos.writeObject(new String[] { "Hi " + rosterEntry.getName(),
          "http://www.eclipse.org/ecf" });
      IChannel channel = initializeChannelFor(getContainerForRosterEntry(rosterEntry));
      channel.sendMessage(rosterEntry.getUser().getID(), bos
          .toByteArray());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

  private IChannel initializeChannelFor(IContainer container) {
    if (container == null)
      return null;
    ID containerID = container.getID();
    IChannel chan = (IChannel) channels.get(containerID);
    if (chan == null) {
      IChannelContainerAdapter adapter = (IChannelContainerAdapter) container
          .getAdapter(IChannelContainerAdapter.class);
      if (adapter != null) {
        chan = createChannel(adapter);
View Full Code Here

  }

  public void dispose() {
    super.dispose();
    for (Iterator i = channels.keySet().iterator(); i.hasNext();) {
      IChannel chan = (IChannel) channels.get(i.next());
      chan.dispose();
    }
    channels.clear();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.datashare.IChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.