com.xpn.xwiki.plugin.skinx
Class AbstractDocumentSkinExtensionPlugin

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.skinx.SkinExtensionPlugin
          extended by com.xpn.xwiki.plugin.skinx.AbstractDocumentSkinExtensionPlugin
All Implemented Interfaces:
com.xpn.xwiki.notify.XWikiActionNotificationInterface, com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface, com.xpn.xwiki.plugin.XWikiPluginInterface
Direct Known Subclasses:
CssSkinExtensionPlugin, JsSkinExtensionPlugin

public abstract class AbstractDocumentSkinExtensionPlugin
extends SkinExtensionPlugin
implements com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface, com.xpn.xwiki.notify.XWikiActionNotificationInterface

Abstract SX plugin for wiki-document-based extensions (Extensions written as object of a XWiki Extension class). Provides a generic method to initialize the XWiki class upon plugin initialization if needed. Provide a notification mecanism for extensions marked as "use-always".

Since:
1.4
Version:
$Id: $
See Also:
JsSkinExtensionPlugin, CssSkinExtensionPlugin

Field Summary
protected static org.apache.commons.logging.Log LOG
          Log helper for logging messages in this class.
 
Fields inherited from interface com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface
EVENT_CHANGE, EVENT_DELETE, EVENT_NEW, EVENT_UPDATE_CLASS, EVENT_UPDATE_CONTENT, EVENT_UPDATE_OBJECT
 
Constructor Summary
AbstractDocumentSkinExtensionPlugin(java.lang.String name, java.lang.String className, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 void beginParsing(com.xpn.xwiki.XWikiContext context)
          
 java.lang.String endParsing(java.lang.String content, com.xpn.xwiki.XWikiContext context)
          
 java.util.Set<java.lang.String> getAlwaysUsedExtensions(com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.objects.classes.BaseClass getExtensionClass(com.xpn.xwiki.XWikiContext context)
           
protected abstract  java.lang.String getExtensionClassName()
           
protected abstract  java.lang.String getExtensionName()
           
 void init(com.xpn.xwiki.XWikiContext context)
           
 void notify(com.xpn.xwiki.notify.XWikiNotificationRule rule, com.xpn.xwiki.doc.XWikiDocument doc, java.lang.String action, com.xpn.xwiki.XWikiContext context)
          Resets the list of "Use always" extensions every time a XAR is imported.
 void notify(com.xpn.xwiki.notify.XWikiNotificationRule rule, com.xpn.xwiki.doc.XWikiDocument newdoc, com.xpn.xwiki.doc.XWikiDocument olddoc, int event, com.xpn.xwiki.XWikiContext context)
          Notification method called upon document changed.
 void virtualInit(com.xpn.xwiki.XWikiContext context)
           
 
Methods inherited from class com.xpn.xwiki.plugin.skinx.SkinExtensionPlugin
getImportString, getLink, getPluginApi, getRequestList, initializeRequestListIfNeeded, use
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Log helper for logging messages in this class.

Constructor Detail

AbstractDocumentSkinExtensionPlugin

public AbstractDocumentSkinExtensionPlugin(java.lang.String name,
                                           java.lang.String className,
                                           com.xpn.xwiki.XWikiContext context)
Method Detail

getExtensionClassName

protected abstract java.lang.String getExtensionClassName()

getExtensionName

protected abstract java.lang.String getExtensionName()

init

public void init(com.xpn.xwiki.XWikiContext context)
Specified by:
init in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
init in class com.xpn.xwiki.plugin.XWikiDefaultPlugin
See Also:
XWikiDefaultPlugin.init(com.xpn.xwiki.XWikiContext)

virtualInit

public void virtualInit(com.xpn.xwiki.XWikiContext context)
Specified by:
virtualInit in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
virtualInit in class com.xpn.xwiki.plugin.XWikiDefaultPlugin
See Also:
XWikiDefaultPlugin.virtualInit(com.xpn.xwiki.XWikiContext)

getAlwaysUsedExtensions

public java.util.Set<java.lang.String> getAlwaysUsedExtensions(com.xpn.xwiki.XWikiContext context)
Specified by:
getAlwaysUsedExtensions in class SkinExtensionPlugin
Parameters:
context - the XWiki context
Returns:
a set of extensions that should always be used for the context wiki. The extensions are lazily in a cache for each wiki. If the extension set for the context wiki is null, then they will be looked up in the database and added to the cache if any.

beginParsing

public void beginParsing(com.xpn.xwiki.XWikiContext context)
Description copied from class: SkinExtensionPlugin

Specified by:
beginParsing in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
beginParsing in class SkinExtensionPlugin
See Also:
XWikiDefaultPlugin.beginParsing(XWikiContext)

endParsing

public java.lang.String endParsing(java.lang.String content,
                                   com.xpn.xwiki.XWikiContext context)
Description copied from class: SkinExtensionPlugin

Specified by:
endParsing in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
endParsing in class SkinExtensionPlugin
See Also:
XWikiDefaultPlugin.endParsing(String, XWikiContext)

getExtensionClass

public com.xpn.xwiki.objects.classes.BaseClass getExtensionClass(com.xpn.xwiki.XWikiContext context)

notify

public void notify(com.xpn.xwiki.notify.XWikiNotificationRule rule,
                   com.xpn.xwiki.doc.XWikiDocument newdoc,
                   com.xpn.xwiki.doc.XWikiDocument olddoc,
                   int event,
                   com.xpn.xwiki.XWikiContext context)
Notification method called upon document changed. This method is used to keep the alwaysUsedExtensions map consistent when the database changes. Upon each document save, it looks in the newly saved document for an extension object. If one is found, then if the use field is set to "always" and the document has been saved with programming rights, we put the document in the map (considering it could already be there). If those last two conditions are not verified, we remove the document from the map (considering it could not have been there already). Last, if the old document (before the save) contained an extension object, but the new one (after the save) does not, it means the object has been deleted, so again we remove this document from the map.

Specified by:
notify in interface com.xpn.xwiki.notify.XWikiDocChangeNotificationInterface
See Also:
XWikiNotificationInterface.notify(XWikiNotificationRule, XWikiDocument, XWikiDocument, int, XWikiContext)

notify

public void notify(com.xpn.xwiki.notify.XWikiNotificationRule rule,
                   com.xpn.xwiki.doc.XWikiDocument doc,
                   java.lang.String action,
                   com.xpn.xwiki.XWikiContext context)
Resets the list of "Use always" extensions every time a XAR is imported. This way, next time a page is rendered, such extensions will be retrieved from databse, and if one has been imported during last import, it will be taken into consideration. (We have to this since the importer does not generate DocChanged notification). See http://jira.xwiki.org/jira/browse/XWIKI-2868

Specified by:
notify in interface com.xpn.xwiki.notify.XWikiActionNotificationInterface
See Also:
XWikiActionNotificationInterface.notify(XWikiNotificationRule, XWikiDocument, String, XWikiContext)


Copyright © 2004-2008 XWiki. All Rights Reserved.