Package org.eclipse.ecf.datashare

Examples of org.eclipse.ecf.datashare.IChannelListener


      }
    });
  }

  public IMergeableChannel createChannel(IChannelConfig newChannelConfig) throws ECFException {
    final IChannelListener listener = newChannelConfig.getListener();
    final SharedObjectDescription sodesc = new SharedObjectDescription(FeedSharedObject.class, IDFactory.getDefault().createGUID(), new HashMap());
    final SharedObjectTypeDescription sotypedesc = sodesc.getTypeDescription();
    ISharedObject sharedObject = null;
    if (sotypedesc.getName() != null) {
      sharedObject = SharedObjectFactory.getDefault().createSharedObject(sotypedesc, new Object[] {listener});
View Full Code Here


    final ID serverID = IDFactory.getDefault().createStringID(targetURL);
    container.connect(serverID, null);
    // get IMergeableChannelContainer adapter
    final IMergeableChannelContainerAdapter channelContainer = (IMergeableChannelContainerAdapter) container.getAdapter(IMergeableChannelContainerAdapter.class);
    // create channel listener
    final IChannelListener listener = new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        System.out.println("listener.handleChannelEvent(" + event + ")");
      }
    };
    // create a new channel
View Full Code Here

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

  protected IChannel createChannel(IContainer container) throws ECFException {
    IChannelContainerAdapter channelContainer = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class);
    if (channelContainer == null) throw new NullPointerException("cannot get channel container adapter");
   
    ID channelID = IDFactory.getDefault().createID(channelContainer.getChannelNamespace(), "channel1");
    IChannelListener channelListener = new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        System.out.println("handleChannelEvent("+event+")");
      }};
    return channelContainer.createChannel(channelID, channelListener, new HashMap());
  }
View Full Code Here

    // Create channel ID with fixed name 'channel2'
    final ID channelID = IDFactory.getDefault().createID(
        channelContainer.getChannelNamespace(), "channel2");
    // 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;
          showMessageInUI(new String(msg.getData()));
        } else System.out.println("got channel event " + event);
View Full Code Here

   *
   * @param containerId
   *            the target ID of the container has connected to
   */
  void fireChannelConnectEvent(final ID containerId) {
    IChannelListener listener = getListener();
    if (listener != null) {
      fireChannelEvent(listener, new IChannelConnectEvent() {
        public ID getChannelID() {
          return id;
        }
View Full Code Here

   *
   * @param containerId
   *            the target ID of the container has disconnected from
   */
  void fireChannelDisconnectEvent(final ID containerId) {
    IChannelListener listener = getListener();
    if (listener != null) {
      fireChannelEvent(listener, new IChannelDisconnectEvent() {
        public ID getChannelID() {
          return id;
        }
View Full Code Here

   * @param message
   *            the message that was received
   */
  void processIncomingMessage(SocketChannel socketChannel, byte[] message) {
    // we read something, need to notify
    IChannelListener listener = getListener();
    if (listener != null) {
      // we have a listener, convert our data and then notify
      byte[][] messages = convert(message);
      if (messages != null) {
        fireMessageEvents(listener, socketChannel, messages);
View Full Code Here

  public IChannelListener getListener() {
    return listener;
  }

  public IChannelListener setListener(IChannelListener listener) {
    IChannelListener previous = this.listener;
    this.listener = listener;
    return previous;
  }
View Full Code Here

  }

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

    channelA = createChannel(channelContainerA, new IChannelListener() {
      public void handleChannelEvent(IChannelEvent e) {
        if (e instanceof IChannelConnectEvent) {
          IChannelConnectEvent event = (IChannelConnectEvent) e;
          eventIds[0] = event.getChannelID();
          eventIds[1] = event.getTargetID();
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.