Wildfire 3.2.4 Javadoc

org.jivesoftware.wildfire.muc.spi
Class MUCPersistenceManager

java.lang.Object
  extended by org.jivesoftware.wildfire.muc.spi.MUCPersistenceManager

public class MUCPersistenceManager
extends Object

A manager responsible for ensuring room persistence. There are different ways to make a room persistent. The first attempt will be to save the room in a relation database. If for some reason the room can't be saved in the database an alternative repository will be used to save the room such as XML files.

After the problem with the database has been solved, the information saved in the XML files will be moved to the database.

Author:
Gaston Dombiak

Constructor Summary
MUCPersistenceManager()
           
 
Method Summary
static void deleteFromDB(MUCRoom room)
          Removes the room configuration and its affiliates from the database.
static String getReservedNickname(MUCRoom room, String bareJID)
          Returns the reserved room nickname for the bare JID in a given room or null if none.
static void loadFromDB(MUCRoomImpl room)
          Loads the room configuration from the database if the room was persistent.
static Collection<MUCRoom> loadRoomsFromDB(MultiUserChatServer chatserver, Date emptyDate, PacketRouter packetRouter)
          Loads all the rooms that had occupants after a given date from the database.
static void removeAffiliationFromDB(MUCRoom room, String bareJID, MUCRole.Affiliation oldAffiliation)
          Removes the affiliation of the user from the DB if the room is persistent.
static void saveAffiliationToDB(MUCRoom room, String bareJID, String nickname, MUCRole.Affiliation newAffiliation, MUCRole.Affiliation oldAffiliation)
          Update the DB with the new affiliation of the user in the room.
static boolean saveConversationLogEntry(org.jivesoftware.wildfire.muc.spi.ConversationLogEntry entry)
          Saves the conversation log entry to the database.
static void saveToDB(MUCRoomImpl room)
          Save the room configuration to the DB.
static void updateRoomEmptyDate(MUCRoom room)
          Updates the room's lock status in the database.
static void updateRoomLock(MUCRoomImpl room)
          Updates the room's lock status in the database.
static void updateRoomSubject(MUCRoom room)
          Updates the room's subject in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MUCPersistenceManager

public MUCPersistenceManager()
Method Detail

getReservedNickname

public static String getReservedNickname(MUCRoom room,
                                         String bareJID)
Returns the reserved room nickname for the bare JID in a given room or null if none.

Parameters:
room - the room where the user would like to obtain his reserved nickname.
bareJID - The bare jid of the user of which you'd like to obtain his reserved nickname.
Returns:
the reserved room nickname for the bare JID or null if none.

loadFromDB

public static void loadFromDB(MUCRoomImpl room)
Loads the room configuration from the database if the room was persistent.

Parameters:
room - the room to load from the database if persistent

saveToDB

public static void saveToDB(MUCRoomImpl room)
Save the room configuration to the DB.

Parameters:
room - The room to save its configuration.

deleteFromDB

public static void deleteFromDB(MUCRoom room)
Removes the room configuration and its affiliates from the database.

Parameters:
room - the room to remove from the database.

loadRoomsFromDB

public static Collection<MUCRoom> loadRoomsFromDB(MultiUserChatServer chatserver,
                                                  Date emptyDate,
                                                  PacketRouter packetRouter)
Loads all the rooms that had occupants after a given date from the database. This query will be executed only when the service is starting up.

Parameters:
chatserver - the chat server that will hold the loaded rooms.
emptyDate - rooms that hadn't been used before this date won't be loaded.
packetRouter - the PacketRouter that loaded rooms will use to send packets.
Returns:
a collection with all the persistent rooms.

updateRoomSubject

public static void updateRoomSubject(MUCRoom room)
Updates the room's subject in the database.

Parameters:
room - the room to update its subject in the database.

updateRoomLock

public static void updateRoomLock(MUCRoomImpl room)
Updates the room's lock status in the database.

Parameters:
room - the room to update its lock status in the database.

updateRoomEmptyDate

public static void updateRoomEmptyDate(MUCRoom room)
Updates the room's lock status in the database.

Parameters:
room - the room to update its lock status in the database.

saveAffiliationToDB

public static void saveAffiliationToDB(MUCRoom room,
                                       String bareJID,
                                       String nickname,
                                       MUCRole.Affiliation newAffiliation,
                                       MUCRole.Affiliation oldAffiliation)
Update the DB with the new affiliation of the user in the room. The new information will be saved only if the room is_persistent and has already been saved to the database previously.

Parameters:
room - The room where the affiliation of the user was updated.
bareJID - The bareJID of the user to update this affiliation.
nickname - The reserved nickname of the user in the room or null if none.
newAffiliation - the new affiliation of the user in the room.
oldAffiliation - the previous affiliation of the user in the room.

removeAffiliationFromDB

public static void removeAffiliationFromDB(MUCRoom room,
                                           String bareJID,
                                           MUCRole.Affiliation oldAffiliation)
Removes the affiliation of the user from the DB if the room is persistent.

Parameters:
room - The room where the affiliation of the user was removed.
bareJID - The bareJID of the user to remove his affiliation.
oldAffiliation - the previous affiliation of the user in the room.

saveConversationLogEntry

public static boolean saveConversationLogEntry(org.jivesoftware.wildfire.muc.spi.ConversationLogEntry entry)
Saves the conversation log entry to the database.

Parameters:
entry - the ConversationLogEntry to save to the database.
Returns:
true if the ConversationLogEntry was saved successfully to the database.

Wildfire 3.2.4 Javadoc

Copyright © 2003-2007 Jive Software.