|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.wiki.WikiUtils
public class WikiUtils
Provides a utility shell for managing an instance of JSPWiki engine. For convenience' sake, the class itself provides all application services so that no methods are static.
setWikiProperties(WikiEngine), if you want a
wiki to be untouched by this utility, just deliberately mismatch its
directory name and the appname specified in its
WEB-INF/jspwiki.properties. This wiki type is meant for those
willing to hack the jspwiki.properties file, generally comfortable
with such things.
Earlier versions used a concept of a "default wiki", and there may be remnants of that in the documentation. Now, all wikis installed in the webapps directory (except for the CeryleWiki) are treated the same, and have their individual settings set by a combination of the UI Prefs dialog and their own WEB-INF/jspwiki.properties file.
While the WikiEventManager was written as a singleton, because the servlet
environment (e.g., Jetty) may create multiple JVMs multiple managers may
actually exist. To avoid issues with this the first WikiEventManager
returned by getInstance() is captured and available via
getWikiEventManager().
There is a WikiEventListener created each time
getWikiEventListener() is called. Since each listener calls the
same wikiStateChanged(WikiEngine,WikiEvent) method it this might
seem unnecessary to use multiple listeners, but given that each WikiEngine
runs independently there's little rationale to tying them together by a
listener.
If the wiki being opened is identified as the Ceryle wiki, its settings are set according to the defaults for the Ceryle wiki. Otherwise, the template is determined according to this preference selection order:
| Field Summary | |
|---|---|
protected boolean |
harvestAssertions
When true, enables the WikiMapManager to perform an assertion harvest. |
protected boolean |
listenToChat
When true, enables the WikiChatManager to listen to chat events. |
static String |
LOC_COLLECTION
An enumerated String constant indicating that wiki pages are provided from an XNodeStore collection. |
static String |
LOC_CUSTOM
An enumerated String constant indicating that wiki pages are provided from a custom, user-selected directory. |
static String |
LOC_DEFAULT
An enumerated String constant indicating that wiki pages are provided from the default directory. |
static String |
PROPERTY_FACTORY_ENABLED
The Ceryle property name of the property enabling or disabling creation of AssertionHandlers. |
static String |
PROPERTY_USECACHE
The Ceryle property name of the property enabling or disabling caching by the TagManager (actually, TagManagerImpl). |
static String |
PROPERTY_WIKIMAP_ENABLED
The Ceryle property name of the property enabling or disabling usurpation of a AssertionHandler by WikiMapManager. |
static File |
webappsDir
The default webapps directory. |
| Constructor Summary | |
|---|---|
WikiUtils()
|
|
| Method Summary | |
|---|---|
protected void |
configureEngine(WikiEngine engine)
Configures the engine by adding any listeners or filters. |
WikiEngine |
getEngine(String appname)
Returns the WikiEngine whose wiki application name matches appname, or null if there is no match. |
Set |
getEngines()
Returns the Set of WikiEngines. |
static File |
getWebappsDirectory()
Returns the webapps directory, the base directory for any installed wiki applications. |
String |
getWikiBaseURL(String appname,
boolean isCeryleWiki)
Return the base URL of the WikiEngine installation with application name appname. |
static File[] |
getWikiDirectories()
Returns an array of Files, each the root of a wiki installation. |
WikiEventListener |
getWikiEventListener()
Returns a new WikiEventListener. |
WikiEventManager |
getWikiEventManager()
Returns the WikiEventManager being used. |
static boolean |
hasWikiInstallation()
Returns true if there is a JSPWiki installation directory, either the Ceryle wiki or a directory in the $CERYLE_HOME/resource/webapps/[name] directory containing a file named "Wiki.jsp", indicating availability of the default service. |
static boolean |
hasWikiInstallation(String name)
Returns true if there is a JSPWiki installation directory matching the supplied wiki name (which will be tested against the name of the directory, as in $CERYLE_HOME/resource/webapps/[name], indicating availability of a wiki service and the file "Wiki.jsp" from that directory. |
void |
openWiki(String name)
Attempts to start the default wiki by opening its base URL within the default web browser. |
void |
presetWikiProperties()
Presets wiki properties prior to firing up the WikiEngine. |
void |
removeWikiEventListeners()
Removes all WikiListeners from the WikiEventManager. |
protected void |
setWikiProperties(WikiEngine engine)
Sets the properties of the WikiEngine based on application settings. |
void |
shutdown()
Can be used to externally signal to any listeners that the Wiki is being shut down. |
void |
wikiStateChanged(WikiEngine engine,
WikiEvent event)
Process a state change from the wiki. |
protected void |
writeCascadeProperties(int index,
File wikihome,
Properties props)
Writes the cascading properties of the WikiEngine based on application settings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY_FACTORY_ENABLED
public static final String PROPERTY_WIKIMAP_ENABLED
public static final String PROPERTY_USECACHE
public static final String LOC_DEFAULT
public static final String LOC_COLLECTION
public static final String LOC_CUSTOM
public static File webappsDir
protected boolean harvestAssertions
protected boolean listenToChat
| Constructor Detail |
|---|
public WikiUtils()
| Method Detail |
|---|
public static boolean hasWikiInstallation()
public static boolean hasWikiInstallation(String name)
This will return false if name is null or if it is "root" (as that is already used as the name of the HTTP installation) or "CVS".
public static File getWebappsDirectory()
public WikiEventManager getWikiEventManager()
public WikiEventListener getWikiEventListener()
public void presetWikiProperties()
protected void writeCascadeProperties(int index,
File wikihome,
Properties props)
index - the property file index (1,2,3, etc.) Note that the index starts with 1, not 0.wikihome - the wiki home directoryprops - the Properties object to be modifiedpublic static File[] getWikiDirectories()
public void removeWikiEventListeners()
public void shutdown()
public Set getEngines()
public WikiEngine getEngine(String appname)
public void wikiStateChanged(WikiEngine engine,
WikiEvent event)
protected void setWikiProperties(WikiEngine engine)
public String getWikiBaseURL(String appname,
boolean isCeryleWiki)
public void openWiki(String name)
throws IOException
IOException - if the HTTP server is not already runningprotected void configureEngine(WikiEngine engine)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||