org.eclipse.corona.collaboration.ecf.sharedobject
Class TopicSharedObject

java.lang.Object
  extended by org.eclipse.ecf.core.sharedobject.AbstractSharedObject
      extended by org.eclipse.corona.collaboration.ecf.sharedobject.TopicSharedObject
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ecf.core.IIdentifiable, org.eclipse.ecf.core.ISharedObject, org.eclipse.ecf.core.util.IEventHandler, org.eclipse.ecf.core.util.IEventProcessor
Direct Known Subclasses:
CoronaTopicSharedObject

public class TopicSharedObject
extends org.eclipse.ecf.core.sharedobject.AbstractSharedObject
implements org.eclipse.ecf.core.util.IEventProcessor


Field Summary
(package private)  java.lang.Object lock
           
(package private)  boolean m_ReplicateOnActivated
           
(package private)  boolean m_ReplicateOnJoin
           
 
Constructor Summary
TopicSharedObject()
           
TopicSharedObject(java.lang.String containerName, org.eclipse.ecf.core.identity.ID sharedObjectId, boolean bReplicateOnActivated, boolean bReplicateOnJoin)
          Class constructor.
 
Method Summary
 boolean acceptEvent(org.eclipse.ecf.core.util.Event event)
          Accept given Event.
 void dispose()
           
 org.eclipse.ecf.core.identity.ID getID()
           
protected  java.lang.Object getProperty(java.lang.String propertyName)
          Retrieve the specified shared object property
protected  void handleActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
          Handle the ISharedObjectActivatedEvent.
protected  void handleCreateResponse(org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent event)
          Handle the ISharedObjectCreateResponseEvent.
protected  void handleDeparted(org.eclipse.ecf.core.events.IContainerDisconnectedEvent event)
          Handle the IContainerDisconnectedEvent.
protected  void handleJoined(org.eclipse.ecf.core.events.IContainerConnectedEvent event)
          Handle the IContainerConnectedEvent.
protected  void handlePrimaryActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
          Handle the ISharedObjectActivatedEvent when generate from the local container.
protected  void handleReplicaActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
          Handle the ISharedObjectActivatedEvent when generated from a remote container.
protected  void initialize()
          Initialize the shared object.
 boolean processEvent(org.eclipse.ecf.core.util.Event event)
          Process given Event
protected  void processMessage(java.lang.Object message)
          Process the message recieved from other members of the topic.
 void sendMessage(org.eclipse.ecf.core.identity.ID[] toIDs, java.lang.Object serialObj)
          Send a serializable object to the specified containers.
 void sendMessage(org.eclipse.ecf.core.identity.ID toID, java.lang.Object serialObj)
          Send a serializable object to the specified container.
 void sendSharedMessage(org.eclipse.ecf.core.identity.ID[] toIDs, TopicSharedObjectMessage sharedMsg)
          Send a GroupSharedObjectMessage to the specified container.
 void sendSharedMessage(org.eclipse.ecf.core.identity.ID toID, TopicSharedObjectMessage sharedMsg)
          Send a GroupSharedObjectMessage to the specified container.
 void sendSharedObjectMsg(org.eclipse.ecf.core.identity.ID toID, org.eclipse.ecf.core.sharedobject.SharedObjectMsg sharedMsg)
          Send a GroupSharedObjectMessage to the specified container.
 
Methods inherited from class org.eclipse.ecf.core.sharedobject.AbstractSharedObject
addEventProcessor, clearEventProcessors, creationCompleted, destroyRemote, destroySelf, destroySelfLocal, dispose, fireEventProcessors, getAdapter, getConfig, getContext, getGroupID, getHomeContainerID, getLocalContainerID, getProperties, getReplicaDescription, getReplicaDescriptions, getSharedObjectMsgFromEvent, handleEvent, handleEvents, handleSharedObjectCreateResponseEvent, handleSharedObjectMsg, handleSharedObjectMsgEvent, handleUnhandledEvent, init, isConnected, isPrimary, removeEventProcessor, replicateToRemoteContainers, sendSharedObjectMsgTo, sendSharedObjectMsgToPrimary, sendSharedObjectMsgToSelf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

java.lang.Object lock

m_ReplicateOnJoin

boolean m_ReplicateOnJoin

m_ReplicateOnActivated

boolean m_ReplicateOnActivated
Constructor Detail

TopicSharedObject

public TopicSharedObject()

TopicSharedObject

public TopicSharedObject(java.lang.String containerName,
                         org.eclipse.ecf.core.identity.ID sharedObjectId,
                         boolean bReplicateOnActivated,
                         boolean bReplicateOnJoin)
Class constructor. Performs basic initialization of the class instance.

Method Detail

dispose

public void dispose()

getID

public org.eclipse.ecf.core.identity.ID getID()
Specified by:
getID in interface org.eclipse.ecf.core.IIdentifiable
Overrides:
getID in class org.eclipse.ecf.core.sharedobject.AbstractSharedObject

initialize

protected void initialize()
Initialize the shared object.

Overrides:
initialize in class org.eclipse.ecf.core.sharedobject.AbstractSharedObject

acceptEvent

public boolean acceptEvent(org.eclipse.ecf.core.util.Event event)
Accept given Event. Return true for a given Event then this indicates that the processEvent(Event) method should be subsequently called.

Parameters:
event - The Event under consideration for acceptance.
Returns:
true if given Event should be passed to processEvent method, false if it should not.

processEvent

public boolean processEvent(org.eclipse.ecf.core.util.Event event)
Process given Event

Specified by:
processEvent in interface org.eclipse.ecf.core.util.IEventProcessor
Parameters:
event - The Event to process.
Returns:
Event to be provided to next IEventProcessor in chain. If null, this signifies that processing of this Event should cease with this Event processor.

handleActivated

protected void handleActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
Handle the ISharedObjectActivatedEvent.

Parameters:
event - The instance of ISharedObjectActivatedEvent to be processed.

handlePrimaryActivated

protected void handlePrimaryActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
Handle the ISharedObjectActivatedEvent when generate from the local container.

Parameters:
event - The instance of ISharedObjectActivatedEvent to be processed.

handleReplicaActivated

protected void handleReplicaActivated(org.eclipse.ecf.core.events.ISharedObjectActivatedEvent event)
Handle the ISharedObjectActivatedEvent when generated from a remote container.

Parameters:
event - The instance of ISharedObjectActivatedEvent to be processed.

handleJoined

protected void handleJoined(org.eclipse.ecf.core.events.IContainerConnectedEvent event)
Handle the IContainerConnectedEvent.

Parameters:
event - The instance of IContainerConnectedEvent to be processed.

handleCreateResponse

protected void handleCreateResponse(org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent event)
Handle the ISharedObjectCreateResponseEvent.

Parameters:
event - The instance of ISharedObjectCreateResponseEvent to be processed.

handleDeparted

protected void handleDeparted(org.eclipse.ecf.core.events.IContainerDisconnectedEvent event)
Handle the IContainerDisconnectedEvent.

Parameters:
event - The instance of IContainerDisconnectedEvent to be processed.

sendMessage

public void sendMessage(org.eclipse.ecf.core.identity.ID[] toIDs,
                        java.lang.Object serialObj)
                 throws java.io.IOException
Send a serializable object to the specified containers.

Parameters:
toIDs - An array of container ids to which the serializable object is to be sent. If null all members of the group will receive the message.
serialObj - The serializable object to be sent.
Throws:
java.io.IOException

sendMessage

public void sendMessage(org.eclipse.ecf.core.identity.ID toID,
                        java.lang.Object serialObj)
                 throws java.io.IOException
Send a serializable object to the specified container.

Parameters:
toID - Container id to which the serializable object is to be sent. If null all members of the group will receive the message.
serialObj - The serializable object to be sent.
Throws:
java.io.IOException

processMessage

protected void processMessage(java.lang.Object message)
Process the message recieved from other members of the topic. This method is intended to the overrode to subclasses.

Parameters:
message - The message to be processed.

sendSharedMessage

public void sendSharedMessage(org.eclipse.ecf.core.identity.ID[] toIDs,
                              TopicSharedObjectMessage sharedMsg)
                       throws java.io.IOException
Send a GroupSharedObjectMessage to the specified container.

Parameters:
toIDs - An array of container ids to which the TSFSharedObjectEvent is to be sent.
sharedMsg - The instance of TSFSharedObjectEvent to be sent.
Throws:
java.io.IOException

sendSharedMessage

public void sendSharedMessage(org.eclipse.ecf.core.identity.ID toID,
                              TopicSharedObjectMessage sharedMsg)
                       throws java.io.IOException
Send a GroupSharedObjectMessage to the specified container.

Parameters:
toID - The container id to which the TSFSharedObjectEvent is to be sent.
sharedMsg - The instance of TSFSharedObjectEvent to be sent.
Throws:
java.io.IOException

sendSharedObjectMsg

public void sendSharedObjectMsg(org.eclipse.ecf.core.identity.ID toID,
                                org.eclipse.ecf.core.sharedobject.SharedObjectMsg sharedMsg)
                         throws java.io.IOException
Send a GroupSharedObjectMessage to the specified container.

Parameters:
toID - The container id to which the TSFSharedObjectEvent is to be sent.
sharedMsg - The instance of TSFSharedObjectEvent to be sent.
Throws:
java.io.IOException

getProperty

protected java.lang.Object getProperty(java.lang.String propertyName)
Retrieve the specified shared object property

Parameters:
propertyName - Name of property to retrieve.
Returns:
The property value.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.