Package org.eclipse.ecf.core.sharedobject.events

Examples of org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent


  }

  protected class ContainerListener implements IContainerListener {
    public void handleEvent(final IContainerEvent evt) {
      if (evt instanceof ISharedObjectActivatedEvent) {
        final ISharedObjectActivatedEvent soae = (ISharedObjectActivatedEvent) evt;
        fireChannelContainerListeners(new IChannelContainerChannelActivatedEvent() {
          public ID getChannelID() {
            return soae.getActivatedID();
          }

          public ID getChannelContainerID() {
            return soae.getLocalContainerID();
          }

          public String toString() {
            final StringBuffer buf = new StringBuffer("ChannelActivatedEvent[");
            buf.append("channelid=").append(soae.getActivatedID()).append(";");
            buf.append("containerid=").append(soae.getLocalContainerID()).append("]");
            return buf.toString();
          }
        });
      } else if (evt instanceof ISharedObjectDeactivatedEvent) {
        final ISharedObjectDeactivatedEvent sode = (ISharedObjectDeactivatedEvent) evt;
View Full Code Here


      // If primary, then add an event processor that handles activated
      // event by replicating to all current remote containers
      addEventProcessor(new IEventProcessor() {
        public boolean processEvent(Event event) {
          if (event instanceof ISharedObjectActivatedEvent) {
            ISharedObjectActivatedEvent ae = (ISharedObjectActivatedEvent) event;
            if (ae.getActivatedID().equals(getID()) && isConnected()) {
              TestMessagingSharedObject.this.replicateToRemoteContainers(null);
            }
          }
          return false;
        }
View Full Code Here

      // If primary, then add an event processor that handles activated
      // event by replicating to all current remote containers
      addEventProcessor(new IEventProcessor() {
        public boolean processEvent(Event event) {
          if (event instanceof ISharedObjectActivatedEvent) {
            ISharedObjectActivatedEvent ae = (ISharedObjectActivatedEvent) event;
            if (ae.getActivatedID().equals(getID()) && isConnected()) {
              TestSharedObject.this.replicateToRemoteContainers(null);
            }
          }
          return false;
        }
View Full Code Here

    final Object monitor = new Object();
   
    IContainerListener listener = new IContainerListener() {
      public void handleEvent(IContainerEvent event) {
        if (event instanceof ISharedObjectActivatedEvent) {
          ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
          if (e.getActivatedID().equals(id)) {
            result[0] = mgr.getSharedObject(id);
            synchronized (monitor) {
              monitor.notify();
            }
          }
View Full Code Here

    this.config = config;
  }

  public void handleEvent(Event event) {
    if (event instanceof ISharedObjectActivatedEvent) {
      ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
      if (e.getActivatedID().equals(config.getSharedObjectID()))
        activated();
    } else if (event instanceof ISharedObjectDeactivatedEvent) {
      ISharedObjectDeactivatedEvent e = (ISharedObjectDeactivatedEvent) event;
      if (e.getDeactivatedID().equals(config.getSharedObjectID()))
        deactivated();
    } else if (event instanceof ISharedObjectCreateResponseEvent)
      received((ISharedObjectCreateResponseEvent) event);
  }
View Full Code Here

   *
   * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event)
   */
  public void handleEvent(Event event) {
    if (event instanceof ISharedObjectActivatedEvent) {
      ISharedObjectActivatedEvent ae = (ISharedObjectActivatedEvent) event;
      ID myID = getID();
      if (myID == null)
        return;
      if (myID.equals(ae.getActivatedID())) {
        activated(getContext().getSharedObjectManager()
            .getSharedObjectIDs());
      } else {
        otherActivated(ae.getActivatedID());
      }
    } else if (event instanceof ISharedObjectDeactivatedEvent) {
      ISharedObjectDeactivatedEvent ae = (ISharedObjectDeactivatedEvent) event;
      ID myID = getID();
      if (myID == null)
        return;
      if (myID.equals(ae.getDeactivatedID())) {
        deactivated();
      } else {
        otherDeactivated(ae.getDeactivatedID());
      }
    } else if (event instanceof IContainerConnectedEvent) {
      memberAdded(((IContainerConnectedEvent) event).getTargetID());
    } else if (event instanceof IContainerDisconnectedEvent) {
      memberRemoved(((IContainerDisconnectedEvent) event).getTargetID());
View Full Code Here

  protected void initialize() throws SharedObjectInitException {
    super.initialize();
    addEventProcessor(new IEventProcessor() {
      public boolean processEvent(Event event) {
        if (event instanceof ISharedObjectActivatedEvent) {
          final ISharedObjectActivatedEvent soae = (ISharedObjectActivatedEvent) event;
          if (!soae.getActivatedID().equals(getID()))
            fireChannelContainerListeners(new IChannelContainerChannelActivatedEvent() {
              public ID getChannelID() {
                return soae.getActivatedID();
              }

              public ID getChannelContainerID() {
                return soae.getLocalContainerID();
              }

              public String toString() {
                StringBuffer buf = new StringBuffer("ChannelActivatedEvent["); //$NON-NLS-1$
                buf.append("channelid=").append(soae.getActivatedID()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
                buf.append("containerid=").append(soae.getLocalContainerID()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
                return buf.toString();
              }
            });
        } else if (event instanceof ISharedObjectDeactivatedEvent) {
          final ISharedObjectDeactivatedEvent sode = (ISharedObjectDeactivatedEvent) event;
View Full Code Here

    return data;
  }

  public void handleEvent(Event event) {
    if (event instanceof ISharedObjectActivatedEvent) {
      ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
      if (e.getActivatedID().equals(config.getSharedObjectID()))
        activated();
      else
        activated(e.getActivatedID());
    } else if (event instanceof ISharedObjectDeactivatedEvent) {
      ISharedObjectDeactivatedEvent e = (ISharedObjectDeactivatedEvent) event;
      if (e.getDeactivatedID().equals(config.getSharedObjectID()))
        deactivated();
      else
        deactivated(e.getDeactivatedID());
    } else if (event instanceof IContainerConnectedEvent) {
      IContainerConnectedEvent e = (IContainerConnectedEvent) event;
      if (e.getTargetID().equals(e.getLocalContainerID()))
        connected();
      else
        connected(e.getTargetID());
    } else if (event instanceof IContainerDisconnectedEvent) {
      IContainerDisconnectedEvent e = (IContainerDisconnectedEvent) event;
      if (e.getTargetID().equals(e.getLocalContainerID()))
        disconnected();
      else
        disconnected(e.getTargetID());
    } else if (event instanceof ISharedObjectMessageEvent) {
      ISharedObjectMessageEvent e = (ISharedObjectMessageEvent) event;
      received(e.getRemoteContainerID(), e.getData());
    }
  }
View Full Code Here

    this.config = config;
  }

  public void handleEvent(Event event) {
    if (event instanceof ISharedObjectActivatedEvent) {
      ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
      if (e.getActivatedID().equals(config.getSharedObjectID()))
        activated();
      else
        activated(e.getActivatedID());
    } else if (event instanceof ISharedObjectDeactivatedEvent) {
      ISharedObjectDeactivatedEvent e = (ISharedObjectDeactivatedEvent) event;
      if (e.getDeactivatedID().equals(config.getSharedObjectID()))
        deactivated();
      else
        deactivated(e.getDeactivatedID());
    } else if (event instanceof IContainerConnectedEvent) {
      IContainerConnectedEvent e = (IContainerConnectedEvent) event;
      if (e.getTargetID().equals(e.getLocalContainerID()))
        connected();
      else
        connected(e.getTargetID());
    } else if (event instanceof IContainerDisconnectedEvent) {
      IContainerDisconnectedEvent e = (IContainerDisconnectedEvent) event;
      if (e.getTargetID().equals(e.getLocalContainerID()))
        disconnected();
      else
        disconnected(e.getTargetID());
    } else if (event instanceof ISharedObjectMessageEvent)
      received((ISharedObjectMessageEvent) event);
  }
View Full Code Here

      // some other container departed -- same as peer deactivation
      if (!e.getTargetID().equals(
          getContext().getLocalContainerID()))
        handleLeave(e.getTargetID());
    } else if (event instanceof ISharedObjectActivatedEvent) {
      ISharedObjectActivatedEvent e = (ISharedObjectActivatedEvent) event;
      if (e.getActivatedID().equals(config.getSharedObjectID()))
        // we're being activated
        handleActivated();
    } else if (event instanceof ISharedObjectDeactivatedEvent) {
      ISharedObjectDeactivatedEvent e = (ISharedObjectDeactivatedEvent) event;
      if (e.getDeactivatedID().equals(config.getSharedObjectID()))
        // we're being deactivated
        handleDeactivated();
      else if (table.contains(e.getDeactivatedID()))
        // a local graph we track is being deactivated
        handleRemoved(e.getDeactivatedID());
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent

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.