Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class OperationSetWhiteboardingJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.OperationSetWhiteboardingJabberImpl
All Implemented Interfaces:
OperationSet, OperationSetWhiteboarding

public class OperationSetWhiteboardingJabberImpl
extends Object
implements OperationSetWhiteboarding

Provides basic functionality for white-board.

Author:
Julien Waechter, Yana Stamcheva

Constructor Summary
OperationSetWhiteboardingJabberImpl(ProtocolProviderServiceJabberImpl provider)
          Creates an instance of this operation set.
 
Method Summary
 void addInvitationListener(WhiteboardInvitationListener listener)
          Adds a listener to invitation notifications.
 void addInvitationRejectionListener(WhiteboardInvitationRejectionListener listener)
          Subscribes listener so that it would receive events indicating rejection of a multi-user chat invitation that we've sent earlier.
 void addPresenceListener(WhiteboardSessionPresenceListener listener)
          Adds a listener that will be notified of changes in our status in a chat room such as us being kicked, banned or dropped.
 WhiteboardSession createWhiteboardSession(String sessionName, Hashtable<Object,Object> sessionProperties)
          Creates a WhiteboardSession.
 WhiteboardSession findWhiteboardSession(String sessionName)
          Returns a reference to a WhiteboardSession named sessionName or null if no such session exists.
 void fireInvitationEvent(WhiteboardSession targetWhiteboard, WhiteboardObject whiteboardObject, String inviter, String reason, byte[] password)
          Delivers a WhiteboardInvitationEvent to all registered WhiteboardInvitationListeners.
 void fireWhiteboardSessionPresenceEvent(WhiteboardSession session, String eventType, String reason)
          Delivers a WhiteboardSessionPresenceChangeEvent to all registered WhiteboardSessionPresenceChangeEvents.
 List<WhiteboardSession> getCurrentlyJoinedWhiteboards()
          Returns a list of the white-board sessions that we have joined and are currently active in.
 List<WhiteboardSession> getCurrentlyJoinedWhiteboards(WhiteboardParticipant participant)
          Returns a list of the WhiteboardSessions that WhiteboardParticipant has joined and is currently active in.
 boolean isWhiteboardingSupportedByContact(Contact contact)
          Returns true if contact supports white-board sessions.
 void rejectInvitation(WhiteboardInvitation invitation, String rejectReason)
          Informs the sender of an invitation that we decline their invitation.
 void removeInvitationListener(WhiteboardInvitationListener listener)
          Removes listener from the list of invitation listeners registered to receive invitation events.
 void removeInvitationRejectionListener(WhiteboardInvitationRejectionListener listener)
          Removes listener from the list of invitation listeners registered to receive invitation rejection events.
 void removePresenceListener(WhiteboardSessionPresenceListener listener)
          Removes a listener that was being notified of changes in our status in a room such as us being kicked, banned or dropped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetWhiteboardingJabberImpl

public OperationSetWhiteboardingJabberImpl(ProtocolProviderServiceJabberImpl provider)
Creates an instance of this operation set.

Parameters:
provider - a ref to the ProtocolProviderServiceImpl that created us and that we'll use for retrieving the underlying aim connection.
Method Detail

addInvitationListener

public void addInvitationListener(WhiteboardInvitationListener listener)
Adds a listener to invitation notifications.

Specified by:
addInvitationListener in interface OperationSetWhiteboarding
Parameters:
listener - an invitation listener.

removeInvitationListener

public void removeInvitationListener(WhiteboardInvitationListener listener)
Removes listener from the list of invitation listeners registered to receive invitation events.

Specified by:
removeInvitationListener in interface OperationSetWhiteboarding
Parameters:
listener - the invitation listener to remove.

addInvitationRejectionListener

public void addInvitationRejectionListener(WhiteboardInvitationRejectionListener listener)
Subscribes listener so that it would receive events indicating rejection of a multi-user chat invitation that we've sent earlier.

Specified by:
addInvitationRejectionListener in interface OperationSetWhiteboarding
Parameters:
listener - the listener that we'll subscribe for invitation rejection events.

removeInvitationRejectionListener

public void removeInvitationRejectionListener(WhiteboardInvitationRejectionListener listener)
Removes listener from the list of invitation listeners registered to receive invitation rejection events.

Specified by:
removeInvitationRejectionListener in interface OperationSetWhiteboarding
Parameters:
listener - the invitation listener to remove.

addPresenceListener

public void addPresenceListener(WhiteboardSessionPresenceListener listener)
Adds a listener that will be notified of changes in our status in a chat room such as us being kicked, banned or dropped.

Specified by:
addPresenceListener in interface OperationSetWhiteboarding
Parameters:
listener - the LocalUserChatRoomPresenceListener.

removePresenceListener

public void removePresenceListener(WhiteboardSessionPresenceListener listener)
Removes a listener that was being notified of changes in our status in a room such as us being kicked, banned or dropped.

Specified by:
removePresenceListener in interface OperationSetWhiteboarding
Parameters:
listener - the LocalUserChatRoomPresenceListener.

createWhiteboardSession

public WhiteboardSession createWhiteboardSession(String sessionName,
                                                 Hashtable<Object,Object> sessionProperties)
                                          throws OperationFailedException,
                                                 OperationNotSupportedException
Creates a WhiteboardSession. For now the session is created locally and neither the sessionName, nor the sessionProperties are used.

Specified by:
createWhiteboardSession in interface OperationSetWhiteboarding
Parameters:
sessionName - the name of the session
sessionProperties - the settings of the session
Returns:
the created white-board session
Throws:
OperationFailedException - if the room couldn't be created for some reason (e.g. room already exists; user already joined to an existent room or user has no permissions to create a chat room).
OperationNotSupportedException - if chat room creation is not supported by this server

findWhiteboardSession

public WhiteboardSession findWhiteboardSession(String sessionName)
                                        throws OperationFailedException,
                                               OperationNotSupportedException
Returns a reference to a WhiteboardSession named sessionName or null if no such session exists.

Specified by:
findWhiteboardSession in interface OperationSetWhiteboarding
Parameters:
sessionName - the name of the WhiteboardSession that we're looking for.
Returns:
the WhiteboardSession named sessionName or null if no such session exists on the server that this provider is currently connected to.
Throws:
OperationFailedException - if an error occurs while trying to discover the white-board session on the server.
OperationNotSupportedException - if the server does not support white-boarding

getCurrentlyJoinedWhiteboards

public List<WhiteboardSession> getCurrentlyJoinedWhiteboards()
Returns a list of the white-board sessions that we have joined and are currently active in.

Specified by:
getCurrentlyJoinedWhiteboards in interface OperationSetWhiteboarding
Returns:
a List of the white-board sessions where the user has joined using a given connection.

getCurrentlyJoinedWhiteboards

public List<WhiteboardSession> getCurrentlyJoinedWhiteboards(WhiteboardParticipant participant)
                                                      throws OperationFailedException,
                                                             OperationNotSupportedException
Returns a list of the WhiteboardSessions that WhiteboardParticipant has joined and is currently active in.

Specified by:
getCurrentlyJoinedWhiteboards in interface OperationSetWhiteboarding
Parameters:
participant - the participant whose current WhiteboardSessions we will be querying.
Returns:
a list of the WhiteboardSessions that WhiteboardParticipant has joined and is currently active in.
Throws:
OperationFailedException - if an error occurs while trying to discover the session.
OperationNotSupportedException - if the server does not support white-boarding

isWhiteboardingSupportedByContact

public boolean isWhiteboardingSupportedByContact(Contact contact)
Returns true if contact supports white-board sessions.

Specified by:
isWhiteboardingSupportedByContact in interface OperationSetWhiteboarding
Parameters:
contact - reference to the contact whose support for white-boards we are currently querying.
Returns:
a boolean indicating whether contact supports white-boards.

rejectInvitation

public void rejectInvitation(WhiteboardInvitation invitation,
                             String rejectReason)
Informs the sender of an invitation that we decline their invitation.

Specified by:
rejectInvitation in interface OperationSetWhiteboarding
Parameters:
invitation - the invitation we are rejecting.
rejectReason - the reason to reject the invitation (optional)

fireInvitationEvent

public void fireInvitationEvent(WhiteboardSession targetWhiteboard,
                                WhiteboardObject whiteboardObject,
                                String inviter,
                                String reason,
                                byte[] password)
Delivers a WhiteboardInvitationEvent to all registered WhiteboardInvitationListeners.

Parameters:
targetWhiteboard - the white-board that invitation refers to
whiteboardObject - the white-board object that inviter send with this invitation and which will be shown on the white-board if the user accepts the invitation
inviter - the inviter that sent the invitation
reason - the reason why the inviter sent the invitation
password - the password to use when joining the room

fireWhiteboardSessionPresenceEvent

public void fireWhiteboardSessionPresenceEvent(WhiteboardSession session,
                                               String eventType,
                                               String reason)
Delivers a WhiteboardSessionPresenceChangeEvent to all registered WhiteboardSessionPresenceChangeEvents.

Parameters:
session - the WhiteboardSession which has been joined, left, etc.
eventType - the type of this event; one of LOCAL_USER_JOINED, LOCAL_USER_LEFT, etc.
reason - the reason

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.