org.ceryle.wiki.plugin.tag
Class TagPlugin

java.lang.Object
  extended by org.ceryle.wiki.plugin.tag.TagPlugin
All Implemented Interfaces:
WikiPlugin
Direct Known Subclasses:
AssertedTagPlugin, Tag

public class TagPlugin
extends Object
implements WikiPlugin

This extends the AssertionPlugin but for use in adding one or more "tags" or associated properties or facets to a wiki page.

Please note that this is different than categorizing a page, which is done using the Category. Unlike the Category plugin, there is no provision for expressing/altering the Subject or Predicate of the Assertion: the Subject is always the current page and the Predicate is the value of the tagging predicate TAG_PREDICATE). The tag must exist as a wiki page.

Metadata

This also declares a JSPWiki page property (i.e., simple page-level metadata) for the named property "DC.subject", the Dublin Core Metadata Term used for declaring keywords for a Web page. This variable may be queried using the available wiki syntax [{$DC.subject}], or a plugin designed to do so.

See also:

Syntax

The plugin does not require any parameters, only a body containing one or more tag names. Optionally, the output parameter from PluginTextUtils is available to format the output.
    [{Tag tagname }]
  

Example

To tag the current wiki page with "Honcho", you'd use the syntax:
    [{Tag Honcho }]
  
The wiki page "Honcho" would need to already exist, otherwise an error message is displayed (which does include a link to create the missing page).

Author:
Murray Altheim
See Also:
Category

Field Summary
static String CLASS_TAG_ERROR
          View anchor class attribute value for tag error messages.
static String CLASS_TAGS
          View anchor class attribute value for tag messages.
protected static org.apache.log4j.Logger log
           
protected static String LSBR
           
protected  WikiContext m_context
           
protected  boolean m_debug
           
protected  WikiEngine m_engine
           
protected  int m_outputFormat
           
protected  Map m_params
           
protected  TagManager m_tagManager
           
static String PLUGIN_NAME
           
static boolean REQUIRE_PAGE_FOR_TAG
          When true, any tag names must exist as pages or an error message is generated.
protected static String RSBR
           
static String TAG_PREDICATE
          The name of the tagging predicate.
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Constructor Summary
TagPlugin()
           
 
Method Summary
protected  void appendErrorMessage(StringBuffer out, String pagename)
          Appends a suitable error message.
protected  void error(WikiContext context, StringBuffer out, Exception e)
          Process an error by clearing the existing buffer and populating it with an error message.
 String execute(WikiContext context, Map params)
          Overrides the method in AssertionPlugin, permitting multiple Objects, creating a separate Assertion for each by reusing the Subject (the current page name) and Predicate TAG_PREDICATE.
protected  void printTagOutput(StringBuffer out, List terms)
          When the AssertionHandler is not available, the plugin uses this method to generate its output.
protected  void processTerms(String pagename, List terms)
          Process the Terms via the TagManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log

CLASS_TAGS

public static String CLASS_TAGS
View anchor class attribute value for tag messages. The default value is "tags".


CLASS_TAG_ERROR

public static String CLASS_TAG_ERROR
View anchor class attribute value for tag error messages. The default value is "tag_error".


REQUIRE_PAGE_FOR_TAG

public static boolean REQUIRE_PAGE_FOR_TAG
When true, any tag names must exist as pages or an error message is generated. Note that this is only pertinent when in simple tag mode, (ie., the AssertionHandler or WikiMapManager are not being used).


TAG_PREDICATE

public static final String TAG_PREDICATE
The name of the tagging predicate. This must exist as a wiki page. The value is "HasTag".

See Also:
Constant Field Values

PLUGIN_NAME

public static String PLUGIN_NAME

LSBR

protected static final String LSBR
See Also:
Constant Field Values

RSBR

protected static final String RSBR
See Also:
Constant Field Values

m_debug

protected boolean m_debug

m_outputFormat

protected int m_outputFormat

m_params

protected Map m_params

m_context

protected WikiContext m_context

m_tagManager

protected TagManager m_tagManager

m_engine

protected WikiEngine m_engine
Constructor Detail

TagPlugin

public TagPlugin()
Method Detail

execute

public String execute(WikiContext context,
                      Map params)
Overrides the method in AssertionPlugin, permitting multiple Objects, creating a separate Assertion for each by reusing the Subject (the current page name) and Predicate TAG_PREDICATE. Execute the plugin, obtaining the '_cmdline' parameter, processing accordingly, returning XHTML-compatible markup.

Specified by:
execute in interface WikiPlugin
Parameters:
context -
params -
Returns:
the generated output to be displayed on the wiki page.
See Also:
WikiPlugin.execute(com.ecyrd.jspwiki.WikiContext,java.util.Map)

processTerms

protected void processTerms(String pagename,
                            List terms)
                     throws QueryException
Process the Terms via the TagManager.

Throws:
QueryException

printTagOutput

protected void printTagOutput(StringBuffer out,
                              List terms)
When the AssertionHandler is not available, the plugin uses this method to generate its output.


appendErrorMessage

protected void appendErrorMessage(StringBuffer out,
                                  String pagename)
Appends a suitable error message. This replaces any existing message in the StringBuffer.


error

protected void error(WikiContext context,
                     StringBuffer out,
                     Exception e)
Process an error by clearing the existing buffer and populating it with an error message. The WikiContext is optional; if provided, it suggests help with a link to the "Assert" wiki page.



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