org.ceryle.wiki.plugin.chat
Class WikiChatManagerFactory

java.lang.Object
  extended by org.ceryle.wiki.plugin.chat.WikiChatManagerFactory

public class WikiChatManagerFactory
extends Object

WikiChatManagerFactory is a singleton class providing management of the WikiChatManagers on a per-WikiEngine basis. Each WikiChatManager adds a single listener to the WikiEngine upon instantiation. This also provides a few convenience methods that locate the WikiChatManager for the engine based on either the WikiEngine or the WikiContext, rather than you having to do so first.

Issue: Per-WikiEngine or Per-WikiPage?

Right now we generate one WikiChatManager per WikiEngine. This would then assume that the one manager handles all chat in all "rooms" (WikiPages). The alternative would be to create a new WikiChatManager for every WikiPage, basically having each manage a single room/page. There are advantages to either approach. If the level of chat is not particularly an issue then a single WikiChatManager is certainly a lot easier to deal with, whereas if the wiki became very chat-intensive and performance began to degrade it would make sense to divide the chat events on a per-page basis. This is currently as far as the thinking has gone on this issue (14 June 2007).

Since:
2.4.50
Version:
$Id: WikiChatManagerFactory.java,v 1.1 2007-06-15 12:08:17 altheim Exp $
Author:
Murray Altheim

Method Summary
static void closeAllManagers()
          Closes (interrupts the Threads of) all living WikiChatManagers, in preparation for a WikiEngine shutdown.
static WikiChatManager getManagerForEngine(WikiEngine engine)
          Registers the provided WikiEngine with the WikiChatManagerFactory, returning an WikiChatManager specific to that engine.
static boolean hasManagerForEngine(WikiEngine engine)
          Returns true if there is a WikiChatManager in the cache for the provided WikiEngine engine.
protected static boolean removeManagerForEngine(WikiChatManager manager)
          Removes the provided WikiChatManager from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasManagerForEngine

public static boolean hasManagerForEngine(WikiEngine engine)
Returns true if there is a WikiChatManager in the cache for the provided WikiEngine engine.

Parameters:
engine - the WikiEngine used as the cache key.

closeAllManagers

public static void closeAllManagers()
Closes (interrupts the Threads of) all living WikiChatManagers, in preparation for a WikiEngine shutdown.


getManagerForEngine

public static WikiChatManager getManagerForEngine(WikiEngine engine)
Registers the provided WikiEngine with the WikiChatManagerFactory, returning an WikiChatManager specific to that engine. The WikiChatManager implementation adds a WikiEventListener to the WikiEngine to receive notification of significant events.

Parameters:
engine - the WikiEngine backing the event handling.

removeManagerForEngine

protected static boolean removeManagerForEngine(WikiChatManager manager)
Removes the provided WikiChatManager from the cache. This is called by the WikiChatManager itself just prior to killing itself.

Parameters:
manager - the WikiChatManager to be removed.
Returns:
true if successfully removed.


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.