org.eclipse.corona.collaboration.ecf
Class AbstractTopic

java.lang.Object
  extended by org.eclipse.corona.collaboration.ecf.AbstractTopic
All Implemented Interfaces:
ITopic, ITopicUser
Direct Known Subclasses:
Topic, Topic

public abstract class AbstractTopic
extends java.lang.Object
implements ITopic


Constructor Summary
AbstractTopic()
           
 
Method Summary
 void addListener(ITopicListener eventListener)
          Add an topic listener for the specified topic.
 void addUser(org.eclipse.ecf.core.user.IUser userInfo)
           
protected abstract  void createContainer()
          Create the shared object container that represents the topic.
 void dispose()
          Dispose of resources used by the instance of the class.
protected abstract  org.eclipse.ecf.provider.generic.SOContainer getContainer()
          Get the shared object container that represents the topic.
 org.eclipse.ecf.core.identity.ID getContainerID()
          Return the container ID for the associated topic
 java.lang.String[] getMembers()
          Retrieve the current members of the group.
 org.eclipse.ecf.core.identity.ID getServerID()
          Return the ID of the server that is hosting the topic.
protected  CoronaTopicSharedObject getSharedObject()
          Retrieve the shared object assoicated with the container.
 org.eclipse.ecf.core.identity.ID getTopicID()
          Get the topic ID.
 java.lang.String getTopicName()
          Get the name of the topic.
 java.lang.String getTopicURL()
          Get the topic URL.
 void initTopic(java.lang.String protocol, java.lang.String serverName, int serverPort, java.lang.String topicName)
          Class constructor.
 void postMessageToTopicListeners(java.lang.Object msgObject)
          Post the message to the registered topic event listeners
 void removeListener(ITopicListener topicListener)
          Remove an topic listener for the specified topic.
 void removeUser(org.eclipse.ecf.core.user.IUser userInfo)
           
 void sendMessage(java.lang.String[] ids, java.lang.Object msgObject)
          Send message to specified users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTopic

public AbstractTopic()
Method Detail

initTopic

public void initTopic(java.lang.String protocol,
                      java.lang.String serverName,
                      int serverPort,
                      java.lang.String topicName)
               throws java.lang.Exception
Class constructor. Performs basic intiialization for the class instanace.

Parameters:
protocol - Protocol used for communication.
serverName - The name/IP address of the server hosting the topic.
serverPort - The port the server is listening on.
topicName - The name of the topic.
Throws:
java.lang.Exception

dispose

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

Specified by:
dispose in interface ITopic

createContainer

protected abstract void createContainer()
                                 throws java.lang.Exception
Create the shared object container that represents the topic.

Throws:
java.lang.Exception

getContainer

protected abstract org.eclipse.ecf.provider.generic.SOContainer getContainer()
Get the shared object container that represents the topic.

Returns:
The shared object container that represents the topic.

getTopicName

public java.lang.String getTopicName()
Get the name of the topic.

Specified by:
getTopicName in interface ITopicUser
Returns:
The name of the topic

getTopicURL

public java.lang.String getTopicURL()
Get the topic URL.

Returns:
The URL of the topic.

getTopicID

public org.eclipse.ecf.core.identity.ID getTopicID()
Get the topic ID.

Returns:
ID of the topic.

sendMessage

public void sendMessage(java.lang.String[] ids,
                        java.lang.Object msgObject)
                 throws java.io.IOException
Send message to specified users.

Specified by:
sendMessage in interface ITopicUser
Parameters:
ids - An array of user ids to send message to. If the value is null or the array is empty all members of the topic will be send the message.
msgObject - Message to be send. This object and all container objects must be serializable.
Throws:
java.io.IOException

getSharedObject

protected CoronaTopicSharedObject getSharedObject()
Retrieve the shared object assoicated with the container.

Returns:
An instance of TopicSharedObject assoicated with the current container.

getMembers

public java.lang.String[] getMembers()
Retrieve the current members of the group.

Specified by:
getMembers in interface ITopicUser
Returns:
A String array of member Ids/names.

addUser

public void addUser(org.eclipse.ecf.core.user.IUser userInfo)
Specified by:
addUser in interface ITopicUser

removeUser

public void removeUser(org.eclipse.ecf.core.user.IUser userInfo)
Specified by:
removeUser in interface ITopicUser

addListener

public void addListener(ITopicListener eventListener)
Add an topic listener for the specified topic.

Specified by:
addListener in interface ITopicUser
Parameters:
topicListener - The topic listener to process events for the topic.

removeListener

public void removeListener(ITopicListener topicListener)
Remove an topic listener for the specified topic.

Specified by:
removeListener in interface ITopicUser
Parameters:
topicListener - The topic listener to be removed.

postMessageToTopicListeners

public void postMessageToTopicListeners(java.lang.Object msgObject)
Post the message to the registered topic event listeners

Specified by:
postMessageToTopicListeners in interface ITopic
Parameters:
msgObject - Object message to be posted. Usually this will be an OSGI event.

getContainerID

public org.eclipse.ecf.core.identity.ID getContainerID()
Return the container ID for the associated topic


getServerID

public org.eclipse.ecf.core.identity.ID getServerID()
Return the ID of the server that is hosting the topic.

Returns:
The ID of ther server hosting the topic.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.