org.eclipse.corona.collaboration.ecf
Class ECFEventRouter

java.lang.Object
  extended by org.eclipse.corona.collaboration.CollaborationEventRouter
      extended by org.eclipse.corona.collaboration.ecf.ECFEventRouter
All Implemented Interfaces:
ICoronaEventRouter, org.osgi.service.event.EventHandler
Direct Known Subclasses:
EventRouter, EventRouter

public abstract class ECFEventRouter
extends CollaborationEventRouter
implements ICoronaEventRouter


Field Summary
protected  org.osgi.framework.BundleContext m_Context
          Bundle context for this event router
protected  java.util.HashMap m_Topics
           
 
Constructor Summary
ECFEventRouter(org.osgi.framework.BundleContext context)
          Class constructor.
 
Method Summary
 void addTopicListener(java.lang.String topicName, ITopicListener topicListener)
          Add an event listener for the specified topic.
 void dispose()
          Dispose resources used by this class instance.
protected  ITopic getTopic(java.lang.String topicName)
          Retrieve the instance of Topic associated with the specified event.
abstract  void handleEvent(org.osgi.service.event.Event osgiEvent)
          Handle the event from OSGI.
abstract  void processEvent(java.lang.Object event)
          Process events.
protected  void removeTopic(ITopic topic, boolean bForce)
          Remove the specified topic from this event router.
protected  void removeTopic(java.lang.String topicKey, boolean bForce)
          Remove the specified topic from this event router.
 void removeTopicListener(java.lang.String topicName, ITopicListener topicListener)
          Remove an event listener for the specified topic.
 void sendMessage(ITopic topic, CollaborationEvent collabEvent)
          Send event to members of the topic.
 void sendMessage(ITopic topic, org.osgi.service.event.Event osgiEvent)
          Send event to members of the topic.
protected  boolean suppressSend(CollaborationEvent collabEvent)
          Determine if the event should be sent to other clients
protected  boolean suppressSend(org.osgi.service.event.Event osgiEvent)
          Determine if the event should be sent to other clients
 
Methods inherited from class org.eclipse.corona.collaboration.CollaborationEventRouter
close, getID, postEvent, sendEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Topics

protected java.util.HashMap m_Topics

m_Context

protected org.osgi.framework.BundleContext m_Context
Bundle context for this event router

Constructor Detail

ECFEventRouter

public ECFEventRouter(org.osgi.framework.BundleContext context)
Class constructor. Performs basic initialization for class instance

Parameters:
context - Bundle context associated with the bundle that created the class instance.
Method Detail

processEvent

public abstract void processEvent(java.lang.Object event)
Process events. The event are received from ALL defined groups and members.

Specified by:
processEvent in interface ICoronaEventRouter
Parameters:
event - The event to be processed.

handleEvent

public abstract void handleEvent(org.osgi.service.event.Event osgiEvent)
Handle the event from OSGI.

Specified by:
handleEvent in interface org.osgi.service.event.EventHandler
Specified by:
handleEvent in class CollaborationEventRouter
Parameters:
osgiEvent - The OSGI event to be handled.
See Also:
Event

dispose

public void dispose()
Dispose resources used by this class instance.


sendMessage

public void sendMessage(ITopic topic,
                        CollaborationEvent collabEvent)
Send event to members of the topic. The members list can be specified by adding a TargetIds property to the event properties. The value must be String[].

Parameters:
topic - The topic to whose members are to receive the event.
osgiEvent - The event to be sent.

sendMessage

public void sendMessage(ITopic topic,
                        org.osgi.service.event.Event osgiEvent)
Send event to members of the topic. The members list can be specified by adding a TargetIds property to the event properties. The value must be String[].

Specified by:
sendMessage in interface ICoronaEventRouter
Parameters:
topic - The topic to whose members are to receive the event.
osgiEvent - The event to be sent. TODO deprecate this method - use sendMessage(ITopic, CollaborationEvent)

suppressSend

protected boolean suppressSend(CollaborationEvent collabEvent)
Determine if the event should be sent to other clients

Parameters:
osgiEvent - The OSGIevent currently being processed.
Returns:
true indicates the message should be suppressed. false indicates the message should be sent.

suppressSend

protected boolean suppressSend(org.osgi.service.event.Event osgiEvent)
Determine if the event should be sent to other clients

Parameters:
osgiEvent - The OSGIevent currently being processed.
Returns:
true indicates the message should be suppressed. false indicates the message should be sent. TODO deprecate this method - use suppressSend(CollaborationEvent)

addTopicListener

public void addTopicListener(java.lang.String topicName,
                             ITopicListener topicListener)
Add an event listener for the specified topic.

Specified by:
addTopicListener in interface ICoronaEventRouter
Parameters:
topicName - Topic the event listener is for.
topictListener - The event listener to process the event.

removeTopicListener

public void removeTopicListener(java.lang.String topicName,
                                ITopicListener topicListener)
Description copied from interface: ICoronaEventRouter
Remove an event listener for the specified topic.

Specified by:
removeTopicListener in interface ICoronaEventRouter
Parameters:
topicName - Topic the event listener is for.
topicListener - The event listener to process the event.

getTopic

protected ITopic getTopic(java.lang.String topicName)
Retrieve the instance of Topic associated with the specified event. If the specified topic does not exist, the topic will be created.

Parameters:
topicName - Name of topic whose topic instance is to be retrieved.
Returns:
The instance of Topic associated with the specified event.

removeTopic

protected void removeTopic(ITopic topic,
                           boolean bForce)
Remove the specified topic from this event router.

Parameters:
topic - An ITopic instance that represents the topic to be removed.
bForce - Flag that indicates if the topic should be removed if client exists on the topic.

removeTopic

protected void removeTopic(java.lang.String topicKey,
                           boolean bForce)
Remove the specified topic from this event router.

Parameters:
topic - An ITopic instance that represents the topic to be removed.
bForce - Flag that indicates if the topic should be removed if client exists on the topic.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.