org.xwiki.ircbot.wiki
Interface WikiIRCModel


@Role
public interface WikiIRCModel

Provides APIs to access to the Wiki Model of the Bot (ie documents in the wiki containing Bot data).

Since:
4.0M2
Version:
$Id: c7b5c9df7eadf987ae6c369d4a40f2e888b2576e $

Nested Class Summary
static interface WikiIRCModel.Executor
          Generic interface to execute code.
 
Method Summary
 void executeAsUser(org.xwiki.model.reference.DocumentReference executingUserReference, org.xwiki.model.reference.DocumentReference securityDocumentReference, WikiIRCModel.Executor executor)
          Execute some code as the passed user and using the passed document as the current security document on which permissions are verified.
 com.xpn.xwiki.doc.XWikiDocument getConfigurationDocument()
           
 com.xpn.xwiki.doc.XWikiDocument getDocument(org.xwiki.model.reference.DocumentReference reference)
           
 List<org.xwiki.ircbot.internal.BotListenerData> getWikiBotListenerData()
           
 com.xpn.xwiki.XWikiContext getXWikiContext()
           
 org.xwiki.ircbot.internal.BotData loadBotData()
           
 void setActive(boolean isActive)
           
 

Method Detail

getXWikiContext

com.xpn.xwiki.XWikiContext getXWikiContext()
                                           throws IRCBotException
Returns:
the XWiki Context
Throws:
IRCBotException - if the XWiki Context is null

getDocument

com.xpn.xwiki.doc.XWikiDocument getDocument(org.xwiki.model.reference.DocumentReference reference)
                                            throws IRCBotException
Parameters:
reference - the reference to the document to access
Returns:
the document instance
Throws:
IRCBotException - if the document cannot be retrieved

getConfigurationDocument

com.xpn.xwiki.doc.XWikiDocument getConfigurationDocument()
                                                         throws IRCBotException
Returns:
the document instance of the Bot configuration page
Throws:
IRCBotException - if the configuration document cannot be retrieved

loadBotData

org.xwiki.ircbot.internal.BotData loadBotData()
                                              throws IRCBotException
Returns:
Bot configuration data (channel, server, etc)
Throws:
IRCBotException - if the configuration document cannot be retrieved

setActive

void setActive(boolean isActive)
               throws IRCBotException
Parameters:
isActive - true if the Bot is to be marked as active or false if it's to be marked as inactive
Throws:
IRCBotException - if the XWiki Context is null

getWikiBotListenerData

List<org.xwiki.ircbot.internal.BotListenerData> getWikiBotListenerData()
                                                                       throws IRCBotException
Returns:
the Bot Listener data for all documents containing WikiIRCBotConstants.WIKI_BOT_LISTENER_CLASS objects in the current wiki
Throws:
IRCBotException - if we fail in searching the wiki

executeAsUser

void executeAsUser(org.xwiki.model.reference.DocumentReference executingUserReference,
                   org.xwiki.model.reference.DocumentReference securityDocumentReference,
                   WikiIRCModel.Executor executor)
                   throws Exception
Execute some code as the passed user and using the passed document as the current security document on which permissions are verified.

Parameters:
executingUserReference - the user under which to run
securityDocumentReference - the security document under which to run
executor - the code to execute
Throws:
Exception - if any error happens when executing the code or if the XWiki Context is null


Copyright © 2004-2012 XWiki. All Rights Reserved.