com.xpn.xwiki.plugin.skinx
Class AbstractResourceSkinExtensionPlugin

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
          extended by com.xpn.xwiki.plugin.skinx.AbstractResourceSkinExtensionPlugin
All Implemented Interfaces:
com.xpn.xwiki.plugin.XWikiPluginInterface
Direct Known Subclasses:
CssResourceSkinExtensionPlugin, JsResourceSkinExtensionPlugin

public abstract class AbstractResourceSkinExtensionPlugin
extends AbstractSkinExtensionPlugin

Skin Extension plugin to use extension files from JAR resources.

Version:
$Id$

Field Summary
 
Fields inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
contextKey, parametersContextKey
 
Constructor Summary
AbstractResourceSkinExtensionPlugin(String name, String className, com.xpn.xwiki.XWikiContext context)
          XWiki plugin constructor.
 
Method Summary
protected abstract  String generateLink(String url, String resourceName, com.xpn.xwiki.XWikiContext context)
          Takes a URL string and outputs a link which will cause the browser to load the url.
protected abstract  String getAction()
          Get the action which the url should specify for calling this resource.
 Set<String> getAlwaysUsedExtensions(com.xpn.xwiki.XWikiContext context)
          Returns the list of always used extensions of this type.
 String getLink(String resourceName, com.xpn.xwiki.XWikiContext context)
          Abstract method for obtaining a link that points to the actual pulled resource.
 boolean hasPageExtensions(com.xpn.xwiki.XWikiContext context)
          Determines if the requested document contains on page skin extension objects of this type.
 
Methods inherited from class com.xpn.xwiki.plugin.skinx.AbstractSkinExtensionPlugin
endParsing, getImportString, getParameter, getParametersForResource, getParametersMap, getPluginApi, getPulledResources, initializeRequestListIfNeeded, parametersAsQueryString, sanitize, use, use
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginParsing, beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, flushCache, getClassName, getName, init, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler, virtualInit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractResourceSkinExtensionPlugin

public AbstractResourceSkinExtensionPlugin(String name,
                                           String className,
                                           com.xpn.xwiki.XWikiContext context)
XWiki plugin constructor.

Parameters:
name - The name of the plugin, which can be used for retrieving the plugin API from velocity. Unused.
className - The canonical classname of the plugin. Unused.
context - The current request context.
See Also:
XWikiDefaultPlugin.XWikiDefaultPlugin(String,String,com.xpn.xwiki.XWikiContext)
Method Detail

getAction

protected abstract String getAction()
Get the action which the url should specify for calling this resource.

Returns:
String Action name.

generateLink

protected abstract String generateLink(String url,
                                       String resourceName,
                                       com.xpn.xwiki.XWikiContext context)
Takes a URL string and outputs a link which will cause the browser to load the url.

Parameters:
url - String representation of the url to load (eg: /res/url.js)
resourceName - name of the pulled resource
context - the current request context
Returns:
HTML code linking to the pulled resource (eg: <script type="text/javascript" src="/res/url.js"/>)

getLink

public String getLink(String resourceName,
                      com.xpn.xwiki.XWikiContext context)
Description copied from class: AbstractSkinExtensionPlugin
Abstract method for obtaining a link that points to the actual pulled resource. Each type of resource has its own format for the link, for example Javascript uses <script src="/path/to/Document">, while CSS uses <link rel="stylesheet" href="/path/to/Document"> (the actual syntax is longer, this is just a simplified example).

Specified by:
getLink in class AbstractSkinExtensionPlugin
Parameters:
resourceName - the name of the wiki document holding the resource.
context - the current request context, needed to access the URLFactory.
Returns:
A String representation of the linking element that should be printed in the generated HTML.

getAlwaysUsedExtensions

public Set<String> getAlwaysUsedExtensions(com.xpn.xwiki.XWikiContext context)
Returns the list of always used extensions of this type. Which resources are always used depends on the type of resource, for example document based StyleSheet extensions have a property in the object, use, which can have the value always to declare that an extension should always be used.

There is no support for always used resource-based extensions yet.

Specified by:
getAlwaysUsedExtensions in class AbstractSkinExtensionPlugin
Parameters:
context - The current request context.
Returns:
A set of resource names that should be pulled in the current response. Note that this method is called for each request, as the list might change in time, and it can be different for each wiki in a farm.
See Also:
AbstractSkinExtensionPlugin.getAlwaysUsedExtensions(XWikiContext)

hasPageExtensions

public boolean hasPageExtensions(com.xpn.xwiki.XWikiContext context)
Determines if the requested document contains on page skin extension objects of this type. True if at least one of the extension objects has the currentPage value for the use property.

Not supported for resource extensions.

Specified by:
hasPageExtensions in class AbstractSkinExtensionPlugin
Parameters:
context - the current request context
Returns:
a boolean specifying if the current document contains on page skin extensions
See Also:
AbstractSkinExtensionPlugin.hasPageExtensions(com.xpn.xwiki.XWikiContext)


Copyright © 2004-2012 XWiki. All Rights Reserved.