Wildfire 3.2.4 Javadoc

org.jivesoftware.wildfire.muc
Class HistoryStrategy

java.lang.Object
  extended by org.jivesoftware.wildfire.muc.HistoryStrategy

public class HistoryStrategy
extends Object

Multi-User Chat rooms may cache history of the conversations in the room in order to play them back to newly arriving members.

This class is an internal component of MUCRoomHistory that describes the strategy that can be used, and provides a method of administering the history behavior.

Author:
Gaston Dombiak, Derek DeMoro

Nested Class Summary
static class HistoryStrategy.Type
          Strategy type.
 
Constructor Summary
HistoryStrategy(HistoryStrategy parentStrategy)
          Create a history strategy with the given parent strategy (for defaults) or null if no parent exists.
 
Method Summary
 void addMessage(Message packet)
          Add a message to the current chat history.
 int getMaxNumber()
          Obtain the maximum number of messages for strategies using message number limitations.
 Iterator<Message> getMessageHistory()
          Obtain the current history as an iterator of messages to play back to a new room member.
 ListIterator<Message> getReverseMessageHistory()
          Obtain the current history to be iterated in reverse mode.
 HistoryStrategy.Type getType()
          Obtain the type of history strategy being used.
 boolean hasChangedSubject()
          Returns true if there is a message within the history of the room that has changed the room's subject.
 void setContext(String prefix)
          Sets the prefix to use for retrieving and saving settings (and also triggers an immediate loading of properties).
 void setMaxNumber(int max)
          Set the maximum number of messages for strategies using message number limitations.
 void setType(HistoryStrategy.Type newType)
          Set the type of history strategy being used.
 void setTypeFromString(String typeName)
          Obtain the strategy type from string name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HistoryStrategy

public HistoryStrategy(HistoryStrategy parentStrategy)
Create a history strategy with the given parent strategy (for defaults) or null if no parent exists.

Parameters:
parentStrategy - The parent strategy of this strategy or null if none exists.
Method Detail

getMaxNumber

public int getMaxNumber()
Obtain the maximum number of messages for strategies using message number limitations.

Returns:
The maximum number of messages to store in applicable strategies.

setMaxNumber

public void setMaxNumber(int max)
Set the maximum number of messages for strategies using message number limitations.

Parameters:
max - The maximum number of messages to store in applicable strategies.

setType

public void setType(HistoryStrategy.Type newType)
Set the type of history strategy being used.

Parameters:
newType - The new type of chat history to use.

getType

public HistoryStrategy.Type getType()
Obtain the type of history strategy being used.

Returns:
The current type of strategy being used.

addMessage

public void addMessage(Message packet)
Add a message to the current chat history. The strategy type will determine what actually happens to the message.

Parameters:
packet - The packet to add to the chatroom's history.

getMessageHistory

public Iterator<Message> getMessageHistory()
Obtain the current history as an iterator of messages to play back to a new room member.

Returns:
An iterator of Message objects to be sent to the new room member.

getReverseMessageHistory

public ListIterator<Message> getReverseMessageHistory()
Obtain the current history to be iterated in reverse mode. This means that the returned list iterator will be positioned at the end of the history so senders of this message must traverse the list in reverse mode.

Returns:
A list iterator of Message objects positioned at the end of the list.

setTypeFromString

public void setTypeFromString(String typeName)
Obtain the strategy type from string name. See the Type enumeration name strings for the names strings supported. If nothing matches and parent != null DEFAULT is used, otherwise, NUMBER is used.

Parameters:
typeName - The text name of the strategy type

setContext

public void setContext(String prefix)
Sets the prefix to use for retrieving and saving settings (and also triggers an immediate loading of properties).

Parameters:
prefix - the prefix to use (without trailing dot) on property names.

hasChangedSubject

public boolean hasChangedSubject()
Returns true if there is a message within the history of the room that has changed the room's subject.

Returns:
true if there is a message within the history of the room that has changed the room's subject.

Wildfire 3.2.4 Javadoc

Copyright © 2003-2007 Jive Software.