Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.muc.spi
Class MultiUserChatServiceImpl

java.lang.Object
  extended by org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl
All Implemented Interfaces:
DiscoInfoProvider, DiscoItemsProvider, ServerItemsProvider, MultiUserChatService, org.xmpp.component.Component

public class MultiUserChatServiceImpl
extends Object
implements org.xmpp.component.Component, MultiUserChatService, ServerItemsProvider, DiscoInfoProvider, DiscoItemsProvider

Implements the chat server as a cached memory resident chat server. The server is also responsible for responding Multi-User Chat disco requests as well as removing inactive users from the rooms after a period of time and to maintain a log of the conversation in the rooms that require to log their conversations. The conversations log is saved to the database using a separate process.

Temporary rooms are held in memory as long as they have occupants. They will be destroyed after the last occupant left the room. On the other hand, persistent rooms are always present in memory even after the last occupant left the room. In order to keep memory clean of persistent rooms that have been forgotten or abandoned this class includes a clean up process. The clean up process will remove from memory rooms that haven't had occupants for a while. Moreover, forgotten or abandoned rooms won't be loaded into memory when the Multi-User Chat service starts up.

Author:
Gaston Dombiak

Field Summary
protected  MUCEventDelegate mucEventDelegate
          Delegate responds to events for the MUC service.
 long totalChatTime
          The total time all agents took to chat *
 
Constructor Summary
MultiUserChatServiceImpl(String subdomain, String description, Boolean isHidden)
          Create a new group chat server.
 
Method Summary
 void addExtraFeature(String feature)
          Adds an extra Disco feature to the list of features returned for the conference service.
 void addExtraIdentity(String category, String name, String type)
          Adds an extra Disco identity to the list of identities returned for the conference service.
 void addSysadmin(org.xmpp.packet.JID userJID)
          Adds a new system administrator of the MUC service.
 void addUserAllowedToCreate(org.xmpp.packet.JID userJID)
          Adds a new user to the list of JIDs that are allowed to create MUC rooms.
 void addUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
          Adds new users to the list of JIDs that are allowed to create MUC rooms.
 void chatRoomAdded(LocalMUCRoom room)
          Notification message indicating that a chat room has been created in another cluster member.
 void chatRoomRemoved(LocalMUCRoom room)
          Notification message indicating that the specified chat room was removed from some other cluster member.
 void enableService(boolean enabled, boolean persistent)
          Enables or disables the MUC service.
 org.xmpp.packet.JID getAddress()
           
 MUCRoom getChatRoom(String roomName)
          Obtains a chatroom by name.
 MUCRoom getChatRoom(String roomName, org.xmpp.packet.JID userjid)
          Obtains a chatroom by name.
 List<MUCRoom> getChatRooms()
          Retuns a list with a snapshot of all the rooms in the server (i.e.
 String getDescription()
           
 org.xmpp.forms.DataForm getExtendedInfo(String name, String node, org.xmpp.packet.JID senderJID)
          Returns an XDataForm with the extended information about the entity or null if none.
 Iterator<String> getFeatures(String name, String node, org.xmpp.packet.JID senderJID)
          Returns an Iterator (of String) with the supported features.
 HistoryStrategy getHistoryStrategy()
          Obtain the server-wide default message history settings.
 Iterator<org.dom4j.Element> getIdentities(String name, String node, org.xmpp.packet.JID senderJID)
          Returns an Iterator (of Element) with the target entity's identities.
 long getIncomingMessageCount(boolean resetAfter)
          Returns the total number of incoming messages since last reset.
 Iterator<DiscoServerItem> getItems()
          Returns an Iterator (of DiscoServerItem) with the items associated with the server or null if none.
 Iterator<DiscoItem> getItems(String name, String node, org.xmpp.packet.JID senderJID)
          Returns an Iterator (of DiscoItem) with the target entity's items or null if none.
 int getKickIdleUsersTimeout()
          Returns the time to elapse between clearing of idle chat users.
 LocalMUCRoom getLocalChatRoom(String roomName)
           
 int getLogConversationBatchSize()
          Returns the number of messages to save to the database on each run of the logging process.
 int getLogConversationsTimeout()
          Returns the time to elapse between logging the room conversations.
 MUCEventDelegate getMUCDelegate()
          Gets the MUC event delegate handler for this service.
 Collection<MUCRole> getMUCRoles(org.xmpp.packet.JID user)
          Returns the list of MUCRole in all rooms for the specified user's session.
 String getName()
           
 int getNumberChatRooms()
          Retuns the number of existing rooms in the server (i.e.
 int getNumberConnectedUsers(boolean onlyLocal)
          Retuns the total number of occupants in all rooms in the server.
 int getNumberRoomOccupants()
          Retuns the total number of users that have joined in all rooms in the server.
 long getOutgoingMessageCount(boolean resetAfter)
          Returns the total number of outgoing messages since last reset.
 String getServiceDomain()
          Returns the fully-qualifed domain name of this chat service.
 String getServiceName()
          Returns the subdomain of the chat service.
 Collection<org.xmpp.packet.JID> getSysadmins()
          Returns the collection of JIDs that are system administrators of the MUC service.
 long getTotalChatTime()
          Returns the total chat time of all rooms combined.
 int getUserIdleTime()
          Returns the number of milliseconds a user must be idle before he/she gets kicked from all the rooms.
 Collection<org.xmpp.packet.JID> getUsersAllowedToCreate()
          Returns the collection of JIDs that are allowed to create MUC rooms.
 boolean hasChatRoom(String roomName)
          Returns true if the server includes a chatroom with the requested name.
 boolean hasInfo(String name, String node, org.xmpp.packet.JID senderJID)
          Returns true if we can provide information related to the requested name and node.
 void initialize(org.xmpp.packet.JID jid, org.xmpp.component.ComponentManager componentManager)
           
 void initialize(XMPPServer server)
           
 void initializeSettings()
           
 boolean isAllowToDiscoverLockedRooms()
          Returns the flag that indicates if the service should provide information about locked rooms when handling service discovery requests.
 boolean isAllowToDiscoverMembersOnlyRooms()
          Returns the flag that indicates if the service should provide information about non-public members-only rooms when handling service discovery requests.
 boolean isHidden()
          Returns true if the MUC service is a hidden, externally managed, service.
 boolean isRoomCreationRestricted()
          Returns false if anyone can create rooms or true if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.
 boolean isServiceEnabled()
          Returns true if the MUC service is available.
 void logConversation(MUCRoom room, org.xmpp.packet.Message message, org.xmpp.packet.JID sender)
          Logs that a given message was sent to a room as part of a conversation.
 void messageBroadcastedTo(int numOccupants)
          Notification message indicating the server that an incoming message was broadcasted to a given number of occupants.
 void processPacket(org.xmpp.packet.Packet packet)
           
 void refreshChatRoom(String roomName)
          Forces a re-read of the room.
 void removeChatRoom(String roomName)
          Removes the room associated with the given name.
 void removeExtraFeature(String feature)
          Removes an extra Disco feature from the list of features returned for the conference service.
 void removeExtraIdentity(String name)
          Removes an extra Disco identity from the list of identities returned for the conference service.
 void removeSysadmin(org.xmpp.packet.JID userJID)
          Removes a system administrator of the MUC service.
 void removeUserAllowedToCreate(org.xmpp.packet.JID userJID)
          Removes a user from list of JIDs that are allowed to create MUC rooms.
 void removeUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
          Removes users from list of JIDs that are allowed to create MUC rooms.
 void setAllowToDiscoverLockedRooms(boolean allowToDiscoverLockedRooms)
          Sets the flag that indicates if the service should provide information about locked rooms when handling service discovery requests.
 void setAllowToDiscoverMembersOnlyRooms(boolean allowToDiscoverMembersOnlyRooms)
          Sets the flag that indicates if the service should provide information about non-public members-only rooms when handling service discovery requests.
 void setDescription(String desc)
           
 void setKickIdleUsersTimeout(int timeout)
          Sets the time to elapse between clearing of idle chat users.
 void setLogConversationBatchSize(int size)
          Sets the number of messages to save to the database on each run of the logging process.
 void setLogConversationsTimeout(int timeout)
          Sets the time to elapse between logging the room conversations.
 void setMUCDelegate(MUCEventDelegate delegate)
          Sets the MUC event delegate handler for this service.
 void setRoomCreationRestricted(boolean roomCreationRestricted)
          Sets if anyone can create rooms or if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.
 void setUserIdleTime(int idleTime)
          Sets the number of milliseconds a user must be idle before he/she gets kicked from all the rooms.
 void shutdown()
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

totalChatTime

public long totalChatTime
The total time all agents took to chat *


mucEventDelegate

protected MUCEventDelegate mucEventDelegate
Delegate responds to events for the MUC service.

Constructor Detail

MultiUserChatServiceImpl

public MultiUserChatServiceImpl(String subdomain,
                                String description,
                                Boolean isHidden)
Create a new group chat server.

Parameters:
subdomain - Subdomain portion of the conference services (for example, conference for conference.example.org)
description - Short description of service for disco and such. If null or empty, a default value will be used.
isHidden - True if this service should be hidden from services views.
Throws:
IllegalArgumentException - if the provided subdomain is an invalid, according to the JID domain definition.
Method Detail

getDescription

public String getDescription()
Specified by:
getDescription in interface org.xmpp.component.Component

setDescription

public void setDescription(String desc)

processPacket

public void processPacket(org.xmpp.packet.Packet packet)
Specified by:
processPacket in interface org.xmpp.component.Component

initialize

public void initialize(org.xmpp.packet.JID jid,
                       org.xmpp.component.ComponentManager componentManager)
Specified by:
initialize in interface org.xmpp.component.Component

shutdown

public void shutdown()
Specified by:
shutdown in interface org.xmpp.component.Component

getServiceDomain

public String getServiceDomain()
Description copied from interface: MultiUserChatService
Returns the fully-qualifed domain name of this chat service. The domain is composed by the service name and the name of the XMPP server where the service is running.

Specified by:
getServiceDomain in interface MultiUserChatService
Returns:
the chat server domain (service name + host name).

getAddress

public org.xmpp.packet.JID getAddress()

getChatRoom

public MUCRoom getChatRoom(String roomName,
                           org.xmpp.packet.JID userjid)
                    throws NotAllowedException
Description copied from interface: MultiUserChatService
Obtains a chatroom by name. A chatroom is created for that name if none exists and the user has permission. The user that asked for the chatroom will be the room's owner if the chatroom was created.

Specified by:
getChatRoom in interface MultiUserChatService
Parameters:
roomName - Name of the room to get.
userjid - The user's normal jid, not the chat nickname jid.
Returns:
The chatroom for the given name.
Throws:
NotAllowedException - If the caller doesn't have permission to create a new room.

getChatRoom

public MUCRoom getChatRoom(String roomName)
Description copied from interface: MultiUserChatService
Obtains a chatroom by name. If the chatroom does not exists then null will be returned.

Specified by:
getChatRoom in interface MultiUserChatService
Parameters:
roomName - Name of the room to get.
Returns:
The chatroom for the given name or null if the room does not exists.

refreshChatRoom

public void refreshChatRoom(String roomName)
Description copied from interface: MultiUserChatService
Forces a re-read of the room. Useful when a change occurs externally.

Specified by:
refreshChatRoom in interface MultiUserChatService
Parameters:
roomName - Name of the room to refresh.

getLocalChatRoom

public LocalMUCRoom getLocalChatRoom(String roomName)

getChatRooms

public List<MUCRoom> getChatRooms()
Description copied from interface: MultiUserChatService
Retuns a list with a snapshot of all the rooms in the server (i.e. persistent or not, in memory or not).

Specified by:
getChatRooms in interface MultiUserChatService
Returns:
a list with a snapshot of all the rooms.

hasChatRoom

public boolean hasChatRoom(String roomName)
Description copied from interface: MultiUserChatService
Returns true if the server includes a chatroom with the requested name.

Specified by:
hasChatRoom in interface MultiUserChatService
Parameters:
roomName - the name of the chatroom to check.
Returns:
true if the server includes a chatroom with the requested name.

removeChatRoom

public void removeChatRoom(String roomName)
Description copied from interface: MultiUserChatService
Removes the room associated with the given name.

Specified by:
removeChatRoom in interface MultiUserChatService
Parameters:
roomName - The room to remove.

chatRoomRemoved

public void chatRoomRemoved(LocalMUCRoom room)
Notification message indicating that the specified chat room was removed from some other cluster member.

Specified by:
chatRoomRemoved in interface MultiUserChatService
Parameters:
room - the removed room in another cluster node.

chatRoomAdded

public void chatRoomAdded(LocalMUCRoom room)
Notification message indicating that a chat room has been created in another cluster member.

Specified by:
chatRoomAdded in interface MultiUserChatService
Parameters:
room - the created room in another cluster node.

getServiceName

public String getServiceName()
Description copied from interface: MultiUserChatService
Returns the subdomain of the chat service.

Specified by:
getServiceName in interface MultiUserChatService
Returns:
the subdomain of the chat service.

getName

public String getName()
Specified by:
getName in interface org.xmpp.component.Component

getHistoryStrategy

public HistoryStrategy getHistoryStrategy()
Description copied from interface: MultiUserChatService
Obtain the server-wide default message history settings.

Specified by:
getHistoryStrategy in interface MultiUserChatService
Returns:
The message history strategy defaults for the server.

getMUCRoles

public Collection<MUCRole> getMUCRoles(org.xmpp.packet.JID user)
Description copied from interface: MultiUserChatService
Returns the list of MUCRole in all rooms for the specified user's session. When running in a cluster the list will include LocalMUCRole and RemoteMUCRole.

Specified by:
getMUCRoles in interface MultiUserChatService
Parameters:
user - the full JID that identifies the session of the user.
Returns:
the list of MUCRoles in all rooms for the specified user's session.

setKickIdleUsersTimeout

public void setKickIdleUsersTimeout(int timeout)
Description copied from interface: MultiUserChatService
Sets the time to elapse between clearing of idle chat users. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to kick users that have been idle for a certain time. A user is considered idle if he/she didn't send any message to any group chat room for a certain amount of time. See MultiUserChatService.setUserIdleTime(int).

Specified by:
setKickIdleUsersTimeout in interface MultiUserChatService
Parameters:
timeout - the time to elapse between clearing of idle chat users.

getKickIdleUsersTimeout

public int getKickIdleUsersTimeout()
Description copied from interface: MultiUserChatService
Returns the time to elapse between clearing of idle chat users. A user is considered idle if he/she didn't send any message to any group chat room for a certain amount of time. See MultiUserChatService.getUserIdleTime().

Specified by:
getKickIdleUsersTimeout in interface MultiUserChatService
Returns:
the time to elapse between clearing of idle chat users.

setUserIdleTime

public void setUserIdleTime(int idleTime)
Description copied from interface: MultiUserChatService
Sets the number of milliseconds a user must be idle before he/she gets kicked from all the rooms. By idle we mean that the user didn't send any message to any group chat room.

Specified by:
setUserIdleTime in interface MultiUserChatService
Parameters:
idleTime - the amount of time to wait before considering a user idle.

getUserIdleTime

public int getUserIdleTime()
Description copied from interface: MultiUserChatService
Returns the number of milliseconds a user must be idle before he/she gets kicked from all the rooms. By idle we mean that the user didn't send any message to any group chat room.

Specified by:
getUserIdleTime in interface MultiUserChatService
Returns:
the amount of time to wait before considering a user idle.

setLogConversationsTimeout

public void setLogConversationsTimeout(int timeout)
Description copied from interface: MultiUserChatService
Sets the time to elapse between logging the room conversations. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to log queued rooms conversations. The number of queued conversations to save on each run can be configured. See MultiUserChatService.setLogConversationBatchSize(int).

Specified by:
setLogConversationsTimeout in interface MultiUserChatService
Parameters:
timeout - the time to elapse between logging the room conversations.

getLogConversationsTimeout

public int getLogConversationsTimeout()
Description copied from interface: MultiUserChatService
Returns the time to elapse between logging the room conversations. A TimerTask will be added to a Timer scheduled for repeated fixed-delay execution whose main responsibility is to log queued rooms conversations. The number of queued conversations to save on each run can be configured. See MultiUserChatService.getLogConversationBatchSize().

Specified by:
getLogConversationsTimeout in interface MultiUserChatService
Returns:
the time to elapse between logging the room conversations.

setLogConversationBatchSize

public void setLogConversationBatchSize(int size)
Description copied from interface: MultiUserChatService
Sets the number of messages to save to the database on each run of the logging process. Even though the saving of queued conversations takes place in another thread it is not recommended specifying a big number.

Specified by:
setLogConversationBatchSize in interface MultiUserChatService
Parameters:
size - the number of messages to save to the database on each run of the logging process.

getLogConversationBatchSize

public int getLogConversationBatchSize()
Description copied from interface: MultiUserChatService
Returns the number of messages to save to the database on each run of the logging process.

Specified by:
getLogConversationBatchSize in interface MultiUserChatService
Returns:
the number of messages to save to the database on each run of the logging process.

getUsersAllowedToCreate

public Collection<org.xmpp.packet.JID> getUsersAllowedToCreate()
Description copied from interface: MultiUserChatService
Returns the collection of JIDs that are allowed to create MUC rooms. An empty list means that anyone can create a room.

Specified by:
getUsersAllowedToCreate in interface MultiUserChatService
Returns:
a list of bare JIDs.

getSysadmins

public Collection<org.xmpp.packet.JID> getSysadmins()
Description copied from interface: MultiUserChatService
Returns the collection of JIDs that are system administrators of the MUC service. A sysadmin has the same permissions as a room owner.

Specified by:
getSysadmins in interface MultiUserChatService
Returns:
a list of bare JIDs.

addSysadmin

public void addSysadmin(org.xmpp.packet.JID userJID)
Description copied from interface: MultiUserChatService
Adds a new system administrator of the MUC service. A sysadmin has the same permissions as a room owner.

Specified by:
addSysadmin in interface MultiUserChatService
Parameters:
userJID - the bare JID of the new user to add as a system administrator.

removeSysadmin

public void removeSysadmin(org.xmpp.packet.JID userJID)
Description copied from interface: MultiUserChatService
Removes a system administrator of the MUC service.

Specified by:
removeSysadmin in interface MultiUserChatService
Parameters:
userJID - the bare JID of the user to remove from the list.

isAllowToDiscoverMembersOnlyRooms

public boolean isAllowToDiscoverMembersOnlyRooms()
Returns the flag that indicates if the service should provide information about non-public members-only rooms when handling service discovery requests.

Returns:
true if the service should provide information about non-public members-only rooms.

setAllowToDiscoverMembersOnlyRooms

public void setAllowToDiscoverMembersOnlyRooms(boolean allowToDiscoverMembersOnlyRooms)
Sets the flag that indicates if the service should provide information about non-public members-only rooms when handling service discovery requests.

Parameters:
allowToDiscoverMembersOnlyRooms - if the service should provide information about non-public members-only rooms.

isAllowToDiscoverLockedRooms

public boolean isAllowToDiscoverLockedRooms()
Returns the flag that indicates if the service should provide information about locked rooms when handling service discovery requests.

Returns:
true if the service should provide information about locked rooms.

setAllowToDiscoverLockedRooms

public void setAllowToDiscoverLockedRooms(boolean allowToDiscoverLockedRooms)
Sets the flag that indicates if the service should provide information about locked rooms when handling service discovery requests. Note: Setting this flag in false is not compliant with the spec. A user may try to join a locked room thinking that the room doesn't exist because the user didn't discover it before.

Parameters:
allowToDiscoverLockedRooms - if the service should provide information about locked rooms.

isRoomCreationRestricted

public boolean isRoomCreationRestricted()
Description copied from interface: MultiUserChatService
Returns false if anyone can create rooms or true if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.

Specified by:
isRoomCreationRestricted in interface MultiUserChatService
Returns:
true if only some JIDs are allowed to create rooms.

setRoomCreationRestricted

public void setRoomCreationRestricted(boolean roomCreationRestricted)
Description copied from interface: MultiUserChatService
Sets if anyone can create rooms or if only the returned JIDs in getUsersAllowedToCreate are allowed to create rooms.

Specified by:
setRoomCreationRestricted in interface MultiUserChatService
Parameters:
roomCreationRestricted - whether anyone can create rooms or not.

addUsersAllowedToCreate

public void addUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
Description copied from interface: MultiUserChatService
Adds new users to the list of JIDs that are allowed to create MUC rooms.

Specified by:
addUsersAllowedToCreate in interface MultiUserChatService
Parameters:
userJIDs - collection of bare JIDs if users to add to list.

addUserAllowedToCreate

public void addUserAllowedToCreate(org.xmpp.packet.JID userJID)
Description copied from interface: MultiUserChatService
Adds a new user to the list of JIDs that are allowed to create MUC rooms.

Specified by:
addUserAllowedToCreate in interface MultiUserChatService
Parameters:
userJID - the bare JID of the new user to add to list.

removeUsersAllowedToCreate

public void removeUsersAllowedToCreate(Collection<org.xmpp.packet.JID> userJIDs)
Description copied from interface: MultiUserChatService
Removes users from list of JIDs that are allowed to create MUC rooms.

Specified by:
removeUsersAllowedToCreate in interface MultiUserChatService
Parameters:
userJIDs - collection of bare JIDs of users to remove from the list.

removeUserAllowedToCreate

public void removeUserAllowedToCreate(org.xmpp.packet.JID userJID)
Description copied from interface: MultiUserChatService
Removes a user from list of JIDs that are allowed to create MUC rooms.

Specified by:
removeUserAllowedToCreate in interface MultiUserChatService
Parameters:
userJID - the bare JID of the user to remove from the list.

initialize

public void initialize(XMPPServer server)

initializeSettings

public void initializeSettings()

start

public void start()
Specified by:
start in interface org.xmpp.component.Component

enableService

public void enableService(boolean enabled,
                          boolean persistent)
Description copied from interface: MultiUserChatService
Enables or disables the MUC service. When disabled the MUC service will disappear from the disco#items list. Moreover, service discovery features will be disabled.

Specified by:
enableService in interface MultiUserChatService
Parameters:
enabled - true if the service is enabled.
persistent - true if the new setting will persist across restarts.

isServiceEnabled

public boolean isServiceEnabled()
Description copied from interface: MultiUserChatService
Returns true if the MUC service is available. Use MultiUserChatService.enableService(boolean, boolean) to enable or disable the service.

Specified by:
isServiceEnabled in interface MultiUserChatService
Returns:
true if the MUC service is available.

getTotalChatTime

public long getTotalChatTime()
Description copied from interface: MultiUserChatService
Returns the total chat time of all rooms combined.

Specified by:
getTotalChatTime in interface MultiUserChatService
Returns:
total chat time in milliseconds.

getNumberChatRooms

public int getNumberChatRooms()
Retuns the number of existing rooms in the server (i.e. persistent or not, in memory or not).

Specified by:
getNumberChatRooms in interface MultiUserChatService
Returns:
the number of existing rooms in the server.

getNumberConnectedUsers

public int getNumberConnectedUsers(boolean onlyLocal)
Retuns the total number of occupants in all rooms in the server.

Specified by:
getNumberConnectedUsers in interface MultiUserChatService
Parameters:
onlyLocal - true if only users connected to this JVM will be considered. Otherwise count cluster wise.
Returns:
the number of existing rooms in the server.

getNumberRoomOccupants

public int getNumberRoomOccupants()
Retuns the total number of users that have joined in all rooms in the server.

Specified by:
getNumberRoomOccupants in interface MultiUserChatService
Returns:
the number of existing rooms in the server.

getIncomingMessageCount

public long getIncomingMessageCount(boolean resetAfter)
Returns the total number of incoming messages since last reset.

Specified by:
getIncomingMessageCount in interface MultiUserChatService
Parameters:
resetAfter - True if you want the counter to be reset after results returned.
Returns:
the number of incoming messages through the service.

getOutgoingMessageCount

public long getOutgoingMessageCount(boolean resetAfter)
Returns the total number of outgoing messages since last reset.

Specified by:
getOutgoingMessageCount in interface MultiUserChatService
Parameters:
resetAfter - True if you want the counter to be reset after results returned.
Returns:
the number of outgoing messages through the service.

logConversation

public void logConversation(MUCRoom room,
                            org.xmpp.packet.Message message,
                            org.xmpp.packet.JID sender)
Description copied from interface: MultiUserChatService
Logs that a given message was sent to a room as part of a conversation. Every message sent to the room that is allowed to be broadcasted and that was sent either from the room itself or from an occupant will be logged.

Note: For performane reasons, the logged message won't be immediately saved. Instead we keep the logged messages in memory until the logging process saves them to the database. It's possible to configure the logging process to run every X milliseconds and also the number of messages to log on each execution.

Specified by:
logConversation in interface MultiUserChatService
Parameters:
room - the room that received the message.
message - the message to log as part of the conversation in the room.
sender - the real XMPPAddress of the sender (e.g. john@example.org).
See Also:
initialize(org.jivesoftware.openfire.XMPPServer)

messageBroadcastedTo

public void messageBroadcastedTo(int numOccupants)
Description copied from interface: MultiUserChatService
Notification message indicating the server that an incoming message was broadcasted to a given number of occupants.

Specified by:
messageBroadcastedTo in interface MultiUserChatService
Parameters:
numOccupants - number of occupants that received the message.

getItems

public Iterator<DiscoServerItem> getItems()
Description copied from interface: ServerItemsProvider
Returns an Iterator (of DiscoServerItem) with the items associated with the server or null if none.

Specified by:
getItems in interface ServerItemsProvider
Returns:
an Iterator (of DiscoServerItem) with the items associated with the server or null if none.

getIdentities

public Iterator<org.dom4j.Element> getIdentities(String name,
                                                 String node,
                                                 org.xmpp.packet.JID senderJID)
Description copied from interface: DiscoInfoProvider
Returns an Iterator (of Element) with the target entity's identities. Each Element must include the categoty, type and name attributes of the entity.

Specified by:
getIdentities in interface DiscoInfoProvider
Parameters:
name - the recipient JID's name.
node - the requested disco node.
senderJID - the XMPPAddress of user that sent the disco info request.
Returns:
an Iterator (of Element) with the target entity's identities.

getFeatures

public Iterator<String> getFeatures(String name,
                                    String node,
                                    org.xmpp.packet.JID senderJID)
Description copied from interface: DiscoInfoProvider
Returns an Iterator (of String) with the supported features. The features to include are the features offered and supported protocols by the target entity identified by the requested name and node.

Specified by:
getFeatures in interface DiscoInfoProvider
Parameters:
name - the recipient JID's name.
node - the requested disco node.
senderJID - the XMPPAddress of user that sent the disco info request.
Returns:
an Iterator (of String) with the supported features.

getExtendedInfo

public org.xmpp.forms.DataForm getExtendedInfo(String name,
                                               String node,
                                               org.xmpp.packet.JID senderJID)
Description copied from interface: DiscoInfoProvider
Returns an XDataForm with the extended information about the entity or null if none. Each bit of information about the entity must be included as a value of a field of the form.

Specified by:
getExtendedInfo in interface DiscoInfoProvider
Parameters:
name - the recipient JID's name.
node - the requested disco node.
senderJID - the XMPPAddress of user that sent the disco info request.
Returns:
an XDataForm with the extended information about the entity or null if none.

addExtraFeature

public void addExtraFeature(String feature)
Adds an extra Disco feature to the list of features returned for the conference service.

Parameters:
feature - Feature to add.

removeExtraFeature

public void removeExtraFeature(String feature)
Removes an extra Disco feature from the list of features returned for the conference service.

Parameters:
feature - Feature to remove.

addExtraIdentity

public void addExtraIdentity(String category,
                             String name,
                             String type)
Adds an extra Disco identity to the list of identities returned for the conference service.

Parameters:
category - Category for identity. e.g. conference
name - Descriptive name for identity. e.g. Public Chatrooms
type - Type for identity. e.g. text

removeExtraIdentity

public void removeExtraIdentity(String name)
Removes an extra Disco identity from the list of identities returned for the conference service.

Parameters:
name - Name of identity to remove.

setMUCDelegate

public void setMUCDelegate(MUCEventDelegate delegate)
Sets the MUC event delegate handler for this service.

Parameters:
delegate - Handler for MUC events.

getMUCDelegate

public MUCEventDelegate getMUCDelegate()
Gets the MUC event delegate handler for this service.

Returns:
Handler for MUC events (delegate)

hasInfo

public boolean hasInfo(String name,
                       String node,
                       org.xmpp.packet.JID senderJID)
Description copied from interface: DiscoInfoProvider
Returns true if we can provide information related to the requested name and node. For example, if the requested name refers to a non-existant MUC room then the answer will be false. In case that the sender of the disco request is not authorized to discover this information an UnauthorizedException will be thrown.

Specified by:
hasInfo in interface DiscoInfoProvider
Parameters:
name - the recipient JID's name.
node - the requested disco node.
senderJID - the XMPPAddress of user that sent the disco info request.
Returns:
true if we can provide information related to the requested name and node.

getItems

public Iterator<DiscoItem> getItems(String name,
                                    String node,
                                    org.xmpp.packet.JID senderJID)
Description copied from interface: DiscoItemsProvider
Returns an Iterator (of DiscoItem) with the target entity's items or null if none. Each DiscoItem must include a JID attribute and may include the name and node attributes of the entity. In case that the sender of the disco request is not authorized to discover items an UnauthorizedException will be thrown.

Specified by:
getItems in interface DiscoItemsProvider
Parameters:
name - the recipient JID's name.
node - the requested disco node.
senderJID - the XMPPAddress of user that sent the disco items request.
Returns:
an Iterator (of DiscoItem) with the target entity's items or null if none.

isHidden

public boolean isHidden()
Description copied from interface: MultiUserChatService
Returns true if the MUC service is a hidden, externally managed, service. This is typically set to true when the implementation is not the default one, and is not to be managed by the standard Openfire interface. If this is set to true, the service will not show up in the service list in the admin console.

Specified by:
isHidden in interface MultiUserChatService
Returns:
true if the MUC service is hidden and externally managed.

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.