Package com.xpn.xwiki.plugin
Interface XWikiPluginInterface
-
- All Known Implementing Classes:
FileUploadPlugin
,MailPlugin
,MonitorPlugin
,PackagePlugin
,RightsManagerPlugin
,SVGPlugin
,XWikiDefaultPlugin
@Deprecated public interface XWikiPluginInterface
Deprecated.the plugin technology is deprecated, consider rewriting as componentsDeprecated platform extension mechanism allowing three things:- provide custom services usable from other parts of the platform, or as public services in Velocity scripts using
a
PluginApi
wrapper; this can now be achieved using components for use inside Java, or usingScriptService
components for public scriptable APIs - alter the request processing by implementing one or more of the hook methods that plug into the rendering engine,
such as
endParsing(String, XWikiContext)
ordownloadAttachment(XWikiAttachment, XWikiContext)
; this can now be achieved usingrendering transformations
for changing the rendering result, orevent listeners
for doing custom actions when different events occur - perform extra initialization steps whenever starting the platform, or when loading each virtual wiki; this can be
achieved by writing
event listeners
that wait forapplication events
orwiki events
In order for a plugin to be active, it must be registered in
xwiki.cfg
.Public scriptable APIs are implemented in a custom
PluginApi
wrapper, which is instantiated by calling thegetPluginApi(XWikiPluginInterface, XWikiContext)
method. If a plugin doesn't need a scriptable API, it should returnnull
instead.The methods of a specific plugin are called only if the actual class implements that method, so inherited methods are never called. If a plugin wants to provide an implementation for one of the hook methods, it must provide an implementation for it, even if that implementation only calls a parent method.
- Version:
- $Id: 8d7045844ef4917fd5f65de5e008a7a7b2a91d3e $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
beginParsing(XWikiContext context)
Deprecated.Hook method called at the start of the response generation process, before the parsing of the root template begins.void
beginRendering(XWikiContext context)
Deprecated.Hook method, called before the 1.0 rendering engine starts processing a wiki document, afterbeginParsing(XWikiContext)
and beforecommonTagsHandler(String, XWikiContext)
.String
commonTagsHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, afterbeginRendering(XWikiContext)
and right beforestartRenderingHandler(String, XWikiContext)
.XWikiAttachment
downloadAttachment(XWikiAttachment attachment, XWikiContext context)
Deprecated.Plugin extension point allowing the plugin to perform modifications to an attachment when the user opens a document attachment.String
endParsing(String content, XWikiContext context)
Deprecated.Hook method called at the end of the response generation process, after the parsing of the root template is finished.void
endRendering(XWikiContext context)
Deprecated.Hook method, called after the 1.0 rendering engine finished processing a wiki document.String
endRenderingHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, afteroutsidePREHandler(String, XWikiContext)
and right beforeendRendering(XWikiContext)
.void
flushCache(XWikiContext context)
Deprecated.A "flush cache" method usually called by the globalXWiki.flushCache(XWikiContext)
, requesting plugins to clear their cached data.String
getName()
Deprecated.The name which can be used for accessing this plugin fromXWiki.getPlugin(String, XWikiContext)
.Api
getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
Deprecated.Get a public scriptable API that can be used to call methods of the (privileged) plugin.void
init(XWikiContext context)
Deprecated.Global initialization, called when the platform is started and the plugin list is initialized.String
insidePREHandler(String line, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, once for each line of content insidepre
blocks, afterstartRenderingHandler(String, XWikiContext)
and beforeendRenderingHandler(String, XWikiContext)
.String
outsidePREHandler(String line, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, once for each line of content outsidepre
blocks, afterstartRenderingHandler(String, XWikiContext)
and beforeendRenderingHandler(String, XWikiContext)
.String
startRenderingHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, aftercommonTagsHandler(String, XWikiContext)
and beforeoutsidePREHandler(String, XWikiContext)
.void
virtualInit(XWikiContext context)
Deprecated.Initialization method called each time a virtual wiki is started, allowing plugins to perform initialization tasks needed in each wiki.
-
-
-
Method Detail
-
getName
String getName()
Deprecated.The name which can be used for accessing this plugin fromXWiki.getPlugin(String, XWikiContext)
.- Returns:
- the plugin name, usually a lowercase identifier
-
getPluginApi
Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
Deprecated.Get a public scriptable API that can be used to call methods of the (privileged) plugin.- Parameters:
plugin
- the plugin instance to wrapcontext
- the current request context- Returns:
- an instance of the corresponding API, or
null
if the plugin doesn't want to expose a public API
-
init
void init(XWikiContext context) throws XWikiException
Deprecated.Global initialization, called when the platform is started and the plugin list is initialized.- Parameters:
context
- the current context, should not be stored since it will become mostly unreliable once the initial request is terminated- Throws:
XWikiException
- if the plugin fails to initialize
-
virtualInit
void virtualInit(XWikiContext context)
Deprecated.Initialization method called each time a virtual wiki is started, allowing plugins to perform initialization tasks needed in each wiki.- Parameters:
context
- the current request context
-
flushCache
void flushCache(XWikiContext context)
Deprecated.A "flush cache" method usually called by the globalXWiki.flushCache(XWikiContext)
, requesting plugins to clear their cached data. When this method is called, plugins should discard all the information they hold from the wiki and re-read it if needed.- Parameters:
context
- the current request context
-
beginParsing
void beginParsing(XWikiContext context)
Deprecated.Hook method called at the start of the response generation process, before the parsing of the root template begins. This allows a plugin to initialize its per-request variables, or to modify the (velocity) context. This method is called at most once per request. It is not called at all if the response is not rendered using a velocity template, for example during the PDF export or for AJAX requests that don't send back a rendered response.- Parameters:
context
- the current request context- See Also:
the pair method called at the end of the response generation process
-
beginRendering
void beginRendering(XWikiContext context)
Deprecated.Hook method, called before the 1.0 rendering engine starts processing a wiki document, afterbeginParsing(XWikiContext)
and beforecommonTagsHandler(String, XWikiContext)
. This allows a plugin to initialize its per-rendering variables, or to modify the (velocity) context. This method can be called multiple times per request, once for each time the 1.0 rendering engine is invoked. At this point the content is not yet processed by any of the rendering components.- Parameters:
context
- the current request context- See Also:
the pair method called at the end of the content processing
-
commonTagsHandler
String commonTagsHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, afterbeginRendering(XWikiContext)
and right beforestartRenderingHandler(String, XWikiContext)
. At this point the content has already been processed by all of the important rendering components (Velocity, Radeox, Groovy). The content can be altered before returning, and the rendering process will continue on the returned value.- Parameters:
content
- the current content being rendered; already processed by Radeox, Velocity and Groovycontext
- the current request context- Returns:
- the processed content, must be the same as the input content if no processing is needed
-
startRenderingHandler
String startRenderingHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, aftercommonTagsHandler(String, XWikiContext)
and beforeoutsidePREHandler(String, XWikiContext)
. The content can be altered before returning. This method should be avoided, since the place where the hook is used isn't actually reliable, since at this point the rendering process is almost done.- Parameters:
content
- the current content being rendered; already processed by Radeox, Velocity and Groovycontext
- the current request context- Returns:
- the processed content, must be the same as the input content if no processing is needed
- See Also:
the pair method called after the content is processed
,the method called before the content has been processed by the rendering engine
-
outsidePREHandler
String outsidePREHandler(String line, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, once for each line of content outsidepre
blocks, afterstartRenderingHandler(String, XWikiContext)
and beforeendRenderingHandler(String, XWikiContext)
. The content can be altered before returning.- Parameters:
line
- the current line being rendered; already processed by Radeox, Velocity and Groovycontext
- the current request context- Returns:
- the processed line, must be the same as the input content if no processing is needed
- See Also:
the pair method called for content inside blocks
-
insidePREHandler
String insidePREHandler(String line, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, once for each line of content insidepre
blocks, afterstartRenderingHandler(String, XWikiContext)
and beforeendRenderingHandler(String, XWikiContext)
. The content can be altered before returning.- Parameters:
line
- the current line being rendered; already processed by Radeox, Velocity and Groovycontext
- the current request context- Returns:
- the processed line, must be the same as the input content if no processing is needed
- See Also:
the pair method called for content outside blocks
-
endRenderingHandler
String endRenderingHandler(String content, XWikiContext context)
Deprecated.Hook method called during the 1.0 rendering process, afteroutsidePREHandler(String, XWikiContext)
and right beforeendRendering(XWikiContext)
. The content can be altered before returning, and the returned value is the one coming out of the rendering process.- Parameters:
content
- the current content being rendered; already processed by Radeox, Velocity and Groovycontext
- the current request context- Returns:
- the processed content, must be the same as the input content if no processing is needed
- See Also:
the pair method called before the content is processed
,the method called after the full rendering process is finished
-
endRendering
void endRendering(XWikiContext context)
Deprecated.Hook method, called after the 1.0 rendering engine finished processing a wiki document. This allows a plugin to clean up its per-rendering variables, or to modify the (velocity) context. This method can be called multiple times per request, once for each time the 1.0 rendering engine is invoked. At this point the content is processed by all of the rendering components and is ready to be included in the response.- Parameters:
context
- the current request context- See Also:
allows to also alter the rendering result
-
endParsing
String endParsing(String content, XWikiContext context)
Deprecated.Hook method called at the end of the response generation process, after the parsing of the root template is finished. This allows a plugin to clean up its per-request variables, to modify the (velocity) context, or to post-process the response. This method is called at most once per request. It is not called at all if the response is not rendered using a velocity template, for example during the PDF export or for AJAX requests that don't send back a rendered response.- Parameters:
content
- the full response to send to the clientcontext
- the current request context- Returns:
- the post-processed content, must be the same as the input content if no processing is needed
- See Also:
the pair method called at the start of the response generation process
-
downloadAttachment
XWikiAttachment downloadAttachment(XWikiAttachment attachment, XWikiContext context)
Deprecated.Plugin extension point allowing the plugin to perform modifications to an attachment when the user opens a document attachment. The plugin is passed the original attachment and it has to return the new modified attachment.- Parameters:
attachment
- the original attachmentcontext
- the current request context- Returns:
- the modified attachment
-
-