Package org.eclipse.ecf.datashare

Examples of org.eclipse.ecf.datashare.IChannelListener


  }

  public void testChannelDisconnectEvent() throws Exception {
    final ID[] eventIds = new ID[2];

    channelA = createChannel(channelContainerA, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent e) {
        if (e instanceof IChannelDisconnectEvent) {
          IChannelDisconnectEvent event = (IChannelDisconnectEvent) e;
          eventIds[0] = event.getChannelID();
          eventIds[1] = event.getTargetID();
View Full Code Here


    channelA = createChannel(channelContainerA);

    int targetPort = channelA.getPort();

    channelB = createChannel(channelContainerB, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          actual[0] = ((IChannelMessageEvent) event).getData();

          synchronized (waitObject) {
View Full Code Here

    channelA = createChannel(channelContainerA);

    int targetPort = channelA.getPort();

    channelB = createChannel(channelContainerB, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          actual[0] = ((IChannelMessageEvent) event).getData();

          synchronized (waitObject) {
View Full Code Here

    final byte[] expected1 = { 1, 2, 3 };
    final byte[] expected2 = { 4, 5, 6 };

    final byte[][] actual = new byte[2][];

    channelA = createChannel(channelContainerA, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          actual[1] = ((IChannelMessageEvent) event).getData();

          synchronized (waitObject) {
            waitObject.notify();
          }
        }
      }
    });

    int targetPort = channelA.getPort();

    channelB = createChannel(channelContainerB, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          actual[0] = ((IChannelMessageEvent) event).getData();

          send(channelB, containerA.getConnectedID(), expected2);
View Full Code Here

    }
    sleep(SLEEPTIME);
  }

  protected IChannelListener getIChannelListener(final ID containerid) throws Exception {
    return new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          IChannelMessageEvent cme = (IChannelMessageEvent) event;
          System.out.println("receivercontainerid="+containerid+"; fromcontainerid="+cme.getFromContainerID()+"; channelid="+cme.getChannelID());
          System.out.println("   event="+event);
View Full Code Here

  /**
   * @return
   */
  protected IChannelListener getIChannelListener(final ID id) throws Exception {
    return new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          //IChannelMessageEvent cme = (IChannelMessageEvent) event;
          messageEvents.put(id, event);
        }
View Full Code Here

    // Get datashare adapter from new container
    datashareAdapter = (IChannelContainerAdapter) container
        .getAdapter(IChannelContainerAdapter.class);

    // Create channel listener for channel to be created
    IChannelListener channelListener = createChannelListener();
    // Create a channel with given channel listener
    testChannel = datashareAdapter.createChannel(IDFactory.getDefault()
        .createStringID(Activator.class.getName()), channelListener,
        null);
  }
View Full Code Here

  /**
   * Create a channel listener that simply prints out messages to System.out
   */
  protected IChannelListener createChannelListener() {
    return new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          IChannelMessageEvent messageEvent = (IChannelMessageEvent) event;
          // print to system out
          System.out.println("Received message from "
View Full Code Here

  }

  private IChannel createChannel(IChannelContainerAdapter adapter) {
    try {
      return adapter.createChannel(IDFactory.getDefault().createStringID(
          CHANNELID), new IChannelListener() {
        public void handleChannelEvent(IChannelEvent event) {
          if (event instanceof IChannelMessageEvent) {
            receiveDataFromChannel(((IChannelMessageEvent) event)
                .getData());
          }
View Full Code Here

    }
    super.shutdown();
  }

  protected IChannelListener createChannelListener() {
    return new IChannelListener() {

      public void handleChannelEvent(IChannelEvent event) {
        if (event instanceof IChannelMessageEvent) {
          IChannelMessageEvent messageEvent = (IChannelMessageEvent) event;
          // print to system out
View Full Code Here

TOP

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

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.