org.eclipse.ecf.provider.xmpp.container
Class XMPPGroupChatSOContainer

java.lang.Object
  extended by org.eclipse.ecf.provider.generic.SOContainer
      extended by org.eclipse.ecf.provider.generic.ClientSOContainer
          extended by org.eclipse.ecf.provider.xmpp.container.XMPPGroupChatSOContainer
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable, IReliableContainer, ISharedObjectContainer, IChatRoomContainer

public class XMPPGroupChatSOContainer
extends ClientSOContainer
implements IChatRoomContainer


Field Summary
static java.lang.String XMPP_GROUPCHAT_DELEGATE_ID
           
 
Fields inherited from class org.eclipse.ecf.provider.generic.ClientSOContainer
CONNECTED, CONNECTING, connection, connectionState, connectLock, DISCONNECTED, remoteServerID
 
Fields inherited from class org.eclipse.ecf.provider.generic.SOContainer
DEFAULT_OBJECT_ARG_KEY, DEFAULT_OBJECT_ARGTYPES_KEY, groupManager, isClosing, loadingThreadGroup, policy, receiver, sharedObjectManager, sharedObjectThreadGroup
 
Constructor Summary
XMPPGroupChatSOContainer(ISharedObjectContainerConfig config, ISynchAsynchConnection conn, org.jivesoftware.smack.XMPPConnection xmppconn, Namespace usernamespace)
           
XMPPGroupChatSOContainer(ISynchAsynchConnection conn, org.jivesoftware.smack.XMPPConnection xmppconn, Namespace usernamespace)
           
 
Method Summary
 void addChatParticipantListener(IChatParticipantListener participantListener)
          Add participant listener.
 void addMessageListener(IMessageListener listener)
          Setup listener for handling IM messages
protected  void addSharedObjectToContainer(ID remote)
           
protected  void cleanUpConnectFail()
           
 void connect(ID remote, IConnectContext connectContext)
          Connect to a target remote process or process group.
 void connect(java.lang.String groupName)
           
protected  ID createChatRoomID(java.lang.String groupName)
           
protected  ISynchAsynchConnection createConnection(ID remoteSpace, java.lang.Object data)
           
protected  SOContext createSharedObjectContext(SOConfig soconfig, IQueueEnqueue queue)
           
 void disconnect()
          Disconnect.
 void dispose()
          Dispose this IContainer instance.
 IChatMessageSender getChatMessageSender()
          Get interface for sending messages
 Namespace getConnectNamespace()
          Get the Namespace expected by the remote target container.
protected  void handleChatMembershipEvent(java.lang.String from, boolean add)
           
protected  void handleChatMessage(org.jivesoftware.smack.packet.Message mess)
           
protected  void handleContainerMessage(ContainerMessage mess)
           
protected  void handleIQMessage(org.jivesoftware.smack.packet.IQ mess)
           
protected  void handlePresenceMessage(org.jivesoftware.smack.packet.Presence mess)
           
protected  void handleXMPPMessage(org.jivesoftware.smack.packet.Packet aPacket)
           
protected  void initializeSharedObject()
           
 void removeChatParticipantListener(IChatParticipantListener participantListener)
          Remove chat participant listener
 void removeMessageListener(IMessageListener msgListener)
           
protected  void sendMessage(ContainerMessage data)
           
protected  boolean verifyToIDForSharedObjectMessage(ID toID)
           
 
Methods inherited from class org.eclipse.ecf.provider.generic.ClientSOContainer
createAuthorizationCallbacks, createConnectData, forwardExcluding, forwardExcluding, forwardToRemote, getConnectedID, getConnection, getConnectLock, getConnectTimeout, getIDForConnection, getLeaveData, handleConnectResponse, handleLeaveGroupMessage, handleViewChangeMessage, isConnected, isConnecting, isGroupManager, memberLeave, processAsynch, processDisconnect, processSynch, queueContainerMessage, sendCreateMsg
 
Methods inherited from class org.eclipse.ecf.provider.generic.SOContainer
addListener, addNewRemoteMember, addSharedObject0, addSharedObjectAndWait, addSharedObjectWrapper, addToLoading, checkRemoteCreate, createLoadingThreadGroup, createRemoteSharedObjectConfig, createRemoteSharedObjectContext, createRemoteSharedObjectWrapper, createSharedObjectConfig, createSharedObjectWrapper, debug, deserializeContainerMessage, deserializeSharedObjectMessage, destroySharedObject, dumpStack, fireContainerEvent, forward, getAdapter, getArgsFromProperties, getArgTypesFromProperties, getClassLoaderForContainer, getClassLoaderForSharedObject, getConfig, getContainerPropertiesForSharedObject, getGroupMemberIDs, getGroupMembershipLock, getID, getMaxGroupMembers, getNewSharedObjectThread, getNextSequenceNumber, getOSGIServiceInterface, getOtherMemberIDs, getReceiver, getSharedObject, getSharedObjectIDs, getSharedObjectManager, getSharedObjectThreadGroup, getSharedObjectWrapper, handleAsynchIOException, handleCreateMessage, handleCreateResponseMessage, handleSharedObjectDisposeMessage, handleSharedObjectMessage, handleUnidentifiedMessage, isClosing, killConnection, load, log, logException, memberLeave, moveFromLoadingToActive, notifySharedObjectActivated, notifySharedObjectDeactivated, removeFromLoading, removeListener, removeRemoteMember, removeSharedObject, sendCreate, sendCreateResponse, sendCreateResponseSharedObjectMessage, sendCreateSharedObjectMessage, sendDispose, sendDisposeSharedObjectMessage, sendMessage, sendSharedObjectMessage, serializeObject, serializeSharedObjectMessage, setIsClosing, setMaxGroupMembers, setRemoteAddPolicy, validateContainerMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ecf.core.IContainer
addListener, getAdapter, getConnectedID, removeListener
 
Methods inherited from interface org.eclipse.ecf.core.IIdentifiable
getID
 

Field Detail

XMPP_GROUPCHAT_DELEGATE_ID

public static final java.lang.String XMPP_GROUPCHAT_DELEGATE_ID
Constructor Detail

XMPPGroupChatSOContainer

public XMPPGroupChatSOContainer(ISharedObjectContainerConfig config,
                                ISynchAsynchConnection conn,
                                org.jivesoftware.smack.XMPPConnection xmppconn,
                                Namespace usernamespace)
                         throws IDCreateException
Throws:
IDCreateException

XMPPGroupChatSOContainer

public XMPPGroupChatSOContainer(ISynchAsynchConnection conn,
                                org.jivesoftware.smack.XMPPConnection xmppconn,
                                Namespace usernamespace)
                         throws IDCreateException
Throws:
IDCreateException
Method Detail

dispose

public void dispose()
Description copied from interface: IContainer
Dispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage. NOTE: This method is not intended to be called by clients.

Specified by:
dispose in interface IContainer
Overrides:
dispose in class ClientSOContainer

sendMessage

protected void sendMessage(ContainerMessage data)
                    throws java.io.IOException
Overrides:
sendMessage in class ClientSOContainer
Throws:
java.io.IOException

handleChatMessage

protected void handleChatMessage(org.jivesoftware.smack.packet.Message mess)
                          throws java.io.IOException
Throws:
java.io.IOException

verifyToIDForSharedObjectMessage

protected boolean verifyToIDForSharedObjectMessage(ID toID)
Overrides:
verifyToIDForSharedObjectMessage in class SOContainer

handleContainerMessage

protected void handleContainerMessage(ContainerMessage mess)
                               throws java.io.IOException
Throws:
java.io.IOException

handleIQMessage

protected void handleIQMessage(org.jivesoftware.smack.packet.IQ mess)
                        throws java.io.IOException
Throws:
java.io.IOException

handlePresenceMessage

protected void handlePresenceMessage(org.jivesoftware.smack.packet.Presence mess)
                              throws java.io.IOException
Throws:
java.io.IOException

handleChatMembershipEvent

protected void handleChatMembershipEvent(java.lang.String from,
                                         boolean add)

handleXMPPMessage

protected void handleXMPPMessage(org.jivesoftware.smack.packet.Packet aPacket)

initializeSharedObject

protected void initializeSharedObject()
                               throws IDCreateException
Throws:
IDCreateException

addSharedObjectToContainer

protected void addSharedObjectToContainer(ID remote)
                                   throws SharedObjectAddException
Throws:
SharedObjectAddException

cleanUpConnectFail

protected void cleanUpConnectFail()

getConnectNamespace

public Namespace getConnectNamespace()
Description copied from interface: IContainer
Get the Namespace expected by the remote target container. Must not return null.

Specified by:
getConnectNamespace in interface IContainer
Overrides:
getConnectNamespace in class SOContainer
Returns:
Namespace the namespace by the target for a call to connect()

connect

public void connect(ID remote,
                    IConnectContext connectContext)
             throws ContainerConnectException
Description copied from interface: IContainer
Connect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.

Specified by:
connect in interface IContainer
Overrides:
connect in class ClientSOContainer
Parameters:
remote - the ID of the remote server or group to connect to
connectContext - any required context to allow this container to authenticate
Throws:
ContainerConnectException - thrown if communication cannot be established with remote service

disconnect

public void disconnect()
Description copied from interface: IContainer
Disconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will return null.

Specified by:
disconnect in interface IContainer
Overrides:
disconnect in class ClientSOContainer

createSharedObjectContext

protected SOContext createSharedObjectContext(SOConfig soconfig,
                                              IQueueEnqueue queue)
Overrides:
createSharedObjectContext in class SOContainer

createChatRoomID

protected ID createChatRoomID(java.lang.String groupName)
                       throws IDCreateException
Throws:
IDCreateException

createConnection

protected ISynchAsynchConnection createConnection(ID remoteSpace,
                                                  java.lang.Object data)
                                           throws ConnectionInstantiationException
Specified by:
createConnection in class ClientSOContainer
Throws:
ConnectionInstantiationException

addMessageListener

public void addMessageListener(IMessageListener listener)
Description copied from interface: IChatRoomContainer
Setup listener for handling IM messages

Specified by:
addMessageListener in interface IChatRoomContainer
Parameters:
listener - the listener to add

removeMessageListener

public void removeMessageListener(IMessageListener msgListener)
Specified by:
removeMessageListener in interface IChatRoomContainer

getChatMessageSender

public IChatMessageSender getChatMessageSender()
Description copied from interface: IChatRoomContainer
Get interface for sending messages

Specified by:
getChatMessageSender in interface IChatRoomContainer
Returns:
IChatMessageSender. Null if no message sender available

connect

public void connect(java.lang.String groupName)
             throws ContainerConnectException
Throws:
ContainerConnectException

addChatParticipantListener

public void addChatParticipantListener(IChatParticipantListener participantListener)
Description copied from interface: IChatRoomContainer
Add participant listener. The given listener will be notified if/when participants are added or removed from given room

Specified by:
addChatParticipantListener in interface IChatRoomContainer

removeChatParticipantListener

public void removeChatParticipantListener(IChatParticipantListener participantListener)
Description copied from interface: IChatRoomContainer
Remove chat participant listener

Specified by:
removeChatParticipantListener in interface IChatRoomContainer
Parameters:
participantListener - the participant listener to remove