Search in sources :

Example 1 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent in project ecf by eclipse.

the class GenericSharedObject method handleEvent.

/*
	 * (non-Javadoc)
	 * 
	 * @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());
    } else if (event instanceof ISharedObjectMessageEvent) {
        handleSharedObjectMessageEvent(((ISharedObjectMessageEvent) event));
    }
}
Also used : ISharedObjectActivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent) ISharedObjectDeactivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) ISharedObjectMessageEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent) ID(org.eclipse.ecf.core.identity.ID) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Example 2 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent in project ecf by eclipse.

the class AgentBase method handleEvent.

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());
    }
}
Also used : ISharedObjectActivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent) ISharedObjectDeactivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) ISharedObjectMessageEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Example 3 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent in project ecf by eclipse.

the class DiscoveryAgent method handleEvent.

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);
}
Also used : ISharedObjectActivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent) ISharedObjectDeactivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) ISharedObjectMessageEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Example 4 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent in project ecf by eclipse.

the class SSLClientContainerConnectTest method testListenerConnected.

public void testListenerConnected() throws Exception {
    final IContainer client = getClients()[0];
    client.addListener(createListener());
    client.connect(createServerID(), null);
    final Object o = clientConnectedEvents.get(0);
    assertTrue(o instanceof IContainerConnectedEvent);
    final IContainerConnectedEvent cco = (IContainerConnectedEvent) o;
    assertTrue(cco.getLocalContainerID().equals(client.getID()));
    assertTrue(cco.getTargetID().equals(createServerID()));
}
Also used : IContainer(org.eclipse.ecf.core.IContainer) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Example 5 with IContainerConnectedEvent

use of org.eclipse.ecf.core.events.IContainerConnectedEvent in project ecf by eclipse.

the class FeedSharedObject method handleEvent.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ecf.core.util.IEventHandler#handleEvent(org.eclipse.ecf.core.util.Event)
	 */
public void handleEvent(Event event) {
    trace("handleEvent(" + event + ")");
    if (event instanceof ISharedObjectMessageEvent) {
        ISharedObjectMessageEvent e = (ISharedObjectMessageEvent) event;
        handleMessage(e);
    } else if (event instanceof IContainerConnectedEvent) {
        IContainerConnectedEvent e = (IContainerConnectedEvent) event;
        if (e.getTargetID().equals(config.getContext().getLocalContainerID())) {
        // this container joined
        // handleJoined();
        } else if (config.getContext().isGroupManager()) {
            // some other container joined and we're the server
            handleJoined(e.getTargetID());
        }
    } else if (event instanceof IContainerDisconnectedEvent) {
        IContainerDisconnectedEvent e = (IContainerDisconnectedEvent) event;
        // some other container departed -- same as peer deactivation
        if (!e.getTargetID().equals(config.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()); }
																	 */
    }
}
Also used : ISharedObjectActivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent) ISharedObjectDeactivatedEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent) IContainerDisconnectedEvent(org.eclipse.ecf.core.events.IContainerDisconnectedEvent) ISharedObjectMessageEvent(org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent) IContainerConnectedEvent(org.eclipse.ecf.core.events.IContainerConnectedEvent)

Aggregations

IContainerConnectedEvent (org.eclipse.ecf.core.events.IContainerConnectedEvent)12 IContainerDisconnectedEvent (org.eclipse.ecf.core.events.IContainerDisconnectedEvent)6 ISharedObjectActivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent)5 IContainerEvent (org.eclipse.ecf.core.events.IContainerEvent)4 ISharedObjectDeactivatedEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectDeactivatedEvent)4 ISharedObjectMessageEvent (org.eclipse.ecf.core.sharedobject.events.ISharedObjectMessageEvent)4 IContainerListener (org.eclipse.ecf.core.IContainerListener)3 IContainer (org.eclipse.ecf.core.IContainer)2 ID (org.eclipse.ecf.core.identity.ID)2 Event (org.eclipse.ecf.core.util.Event)2 IEventProcessor (org.eclipse.ecf.core.util.IEventProcessor)2 AsynchContainerConnectAction (org.eclipse.ecf.ui.actions.AsynchContainerConnectAction)2 IDCreateErrorDialog (org.eclipse.ecf.ui.dialogs.IDCreateErrorDialog)2 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 IIMMessageEvent (org.eclipse.ecf.presence.IIMMessageEvent)1 IIMMessageListener (org.eclipse.ecf.presence.IIMMessageListener)1 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)1 IChatManager (org.eclipse.ecf.presence.im.IChatManager)1 IChatMessageEvent (org.eclipse.ecf.presence.im.IChatMessageEvent)1 ITypingMessageEvent (org.eclipse.ecf.presence.im.ITypingMessageEvent)1