de.tuberlin.cs.flp.jspwiki
Class CategoryManager

java.lang.Object
  extended byde.tuberlin.cs.flp.jspwiki.CategoryManager

public class CategoryManager
extends java.lang.Object

Handles Categories in the Wiki. A category is a page which contains other pages in the sense that

See Also:
Category, de.tuberlin.cs.flp.jspwiki.tags.CategoryIterator

Field Summary
static java.lang.String CATEGORY_EDITINFO_SUFFIX
           
static java.lang.String CATEGORY_INFO_SUFFIX
           
static java.lang.String CATEGORY_INITIAL_SUFFIX
          Image file suffices to identify an image by its filename.
static java.lang.String DEFAULT_CATEGORY_MEMBER_PHRASES_PAGE
           
static java.lang.String DEFAULT_CATEGORY_PAGE
          Default name of the central Categories page.
protected  WikiEngine engine
           
protected  java.util.Map existingCategoryMembersCacheByCategory
          Represents ...
protected static java.util.Map instancesByEngine
          Represents ...
protected  java.util.Map membersToBeCreatedByCategory
           
protected  java.util.Map membersToBeCreatedTimestamp
           
static long NEW_MEMBER_TIMEOUT_SECONDS
           
static java.lang.String PROPERTY_CATEGORY_MEMBER_PHRASES_PAGE
           
static java.lang.String PROPERTY_CATEGORY_PAGE
          Property holding the name of the central Categories page on which all CategoryXxx pages are registered to become known as categories.
 
Constructor Summary
protected CategoryManager(WikiEngine engine)
           
 
Method Summary
 void actionPerformed(WikiEvent e)
          Implementation of WikiEventListener.
 void addCategoryMember(java.lang.String category, java.lang.String newPage)
          Adds a new member to the category.
 java.util.Collection getAllCategories()
          Returns all categories used in the wiki.
 java.util.Collection getCategories(java.lang.String page)
          Returns all categories in which the page is a member.
 java.util.Collection getCategoryMemberPhrases()
          Returns all member-phrases that mark a page as being a member of a category.
 java.lang.String getCategoryMemberPhrasesPageName()
          Returns the name of the central CategoriePhrasesPage, which contains any number of possible textual phrases (seperated by blank lines in the Wiki markup) that mark a page as being a member of a category.
 java.util.Collection getCategoryMembers(java.lang.String category)
          Gets all embers of a category, including those that have been registered as yet-to-be-created members.
 java.lang.String getCategoryPageName()
          Returns the name of the central Categories page on which all categories are registered as links to the individual CategoryXxx pages.
 java.lang.String getDefaultCategoryMemberPhrase()
          Returns the default member-phrase that marks a page as being a member of a category, also if no CategoriesMemberPhrases page (or accordingly configured via jspwiki.category.memberPhrases.page).
 WikiEngine getEngine()
           
 java.util.Collection getExistingCategoryMembers(java.lang.String category)
          Gets the members of a category which actually exist as saved pages.
protected  java.util.Collection getExistingCategoryMembersUncached(java.lang.String category)
          Gets the members of a category which actually exist as saved pages.
static CategoryManager getInstance(WikiEngine engine)
          Static method to get an instance of CategoryManager.
 java.util.Collection getNewCategoryMembers(java.lang.String category)
          Gets those category members that have already been added to the category but do not yet exist as saved pages.
 boolean isCategory(java.lang.String page)
          Tests if a page is a category page.
protected  java.util.Collection membersToBeCreated(java.lang.String category)
          Gets those category members that have been added to the category but are not yet tested whether they might in the meantime have been actually created as saved pages.
 void setEngine(WikiEngine wikiEngine)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_INITIAL_SUFFIX

public static final java.lang.String CATEGORY_INITIAL_SUFFIX
Image file suffices to identify an image by its filename. (Simple hard-coded solution. Should be configurable or taken from the Wiki's general configuration.)

See Also:
Constant Field Values

CATEGORY_INFO_SUFFIX

public static final java.lang.String CATEGORY_INFO_SUFFIX
See Also:
Constant Field Values

CATEGORY_EDITINFO_SUFFIX

public static final java.lang.String CATEGORY_EDITINFO_SUFFIX
See Also:
Constant Field Values

PROPERTY_CATEGORY_PAGE

public static final java.lang.String PROPERTY_CATEGORY_PAGE
Property holding the name of the central Categories page on which all CategoryXxx pages are registered to become known as categories.

See Also:
Constant Field Values

DEFAULT_CATEGORY_PAGE

public static final java.lang.String DEFAULT_CATEGORY_PAGE
Default name of the central Categories page.

See Also:
Constant Field Values

PROPERTY_CATEGORY_MEMBER_PHRASES_PAGE

public static final java.lang.String PROPERTY_CATEGORY_MEMBER_PHRASES_PAGE
See Also:
Constant Field Values

DEFAULT_CATEGORY_MEMBER_PHRASES_PAGE

public static final java.lang.String DEFAULT_CATEGORY_MEMBER_PHRASES_PAGE
See Also:
Constant Field Values

NEW_MEMBER_TIMEOUT_SECONDS

public static final long NEW_MEMBER_TIMEOUT_SECONDS
See Also:
Constant Field Values

instancesByEngine

protected static java.util.Map instancesByEngine

Represents ...


membersToBeCreatedByCategory

protected java.util.Map membersToBeCreatedByCategory

membersToBeCreatedTimestamp

protected java.util.Map membersToBeCreatedTimestamp

existingCategoryMembersCacheByCategory

protected java.util.Map existingCategoryMembersCacheByCategory

Represents ...


engine

protected WikiEngine engine
Constructor Detail

CategoryManager

protected CategoryManager(WikiEngine engine)
Parameters:
engine -
Method Detail

getInstance

public static CategoryManager getInstance(WikiEngine engine)
Static method to get an instance of CategoryManager. This is the point where CategoryManager could be integrated into the existing JSPWiki codebase by replacing this method with engine.getCategoryManager().

Parameters:
engine -
Returns:

getCategoryPageName

public java.lang.String getCategoryPageName()
Returns the name of the central Categories page on which all categories are registered as links to the individual CategoryXxx pages. (Note that the concept of categories is not applied recursively to declare categories on the Categories page. Thus, a CategoryXxx page needs not to link back to the main Categories page. Instead, there are links _from_ the Categories page _to_ the individual CategoryXxx pages.) This can be configured in jspwiki.properties using jspwiki.categories.page.

Returns:

getCategoryMemberPhrasesPageName

public java.lang.String getCategoryMemberPhrasesPageName()
Returns the name of the central CategoriePhrasesPage, which contains any number of possible textual phrases (seperated by blank lines in the Wiki markup) that mark a page as being a member of a category. This can be configured in jspwiki.properties using jspwiki.categories.memberPhrases.page.

Returns:

getCategoryMemberPhrases

public java.util.Collection getCategoryMemberPhrases()
Returns all member-phrases that mark a page as being a member of a category.

Returns:

getDefaultCategoryMemberPhrase

public java.lang.String getDefaultCategoryMemberPhrase()
Returns the default member-phrase that marks a page as being a member of a category, also if no CategoriesMemberPhrases page (or accordingly configured via jspwiki.category.memberPhrases.page).

Returns:

getExistingCategoryMembersUncached

protected java.util.Collection getExistingCategoryMembersUncached(java.lang.String category)
Gets the members of a category which actually exist as saved pages.

Parameters:
category -
Returns:

getAllCategories

public java.util.Collection getAllCategories()
Returns all categories used in the wiki. Typically, this is a Collection of Strings like CategoryXXX, CategoryYYY, CategoryZZZ etc.

Returns:

getExistingCategoryMembers

public java.util.Collection getExistingCategoryMembers(java.lang.String category)
Gets the members of a category which actually exist as saved pages. This is a cached operation, subsequent accesses to this are fast if no page in the whole Wiki has been change in the meantime.

Parameters:
category -
Returns:

getCategoryMembers

public java.util.Collection getCategoryMembers(java.lang.String category)
Gets all embers of a category, including those that have been registered as yet-to-be-created members.

Parameters:
category -
Returns:

isCategory

public boolean isCategory(java.lang.String page)
Tests if a page is a category page.

Parameters:
page -
Returns:

getCategories

public java.util.Collection getCategories(java.lang.String page)
Returns all categories in which the page is a member.

Parameters:
page -
Returns:

addCategoryMember

public void addCategoryMember(java.lang.String category,
                              java.lang.String newPage)
Adds a new member to the category. The page does not need to actually exist in the Wiki yet.

Parameters:
category -
newPage -

getNewCategoryMembers

public java.util.Collection getNewCategoryMembers(java.lang.String category)
Gets those category members that have already been added to the category but do not yet exist as saved pages.

Parameters:
category -
Returns:

membersToBeCreated

protected java.util.Collection membersToBeCreated(java.lang.String category)
Gets those category members that have been added to the category but are not yet tested whether they might in the meantime have been actually created as saved pages.

Parameters:
category -
Returns:

actionPerformed

public void actionPerformed(WikiEvent e)
Implementation of WikiEventListener. This watches out for any change of a page and then invalidates the cached list of category members (as it might have changed through the page change). Using the cache is a simple optimization.

Parameters:
e -

getEngine

public WikiEngine getEngine()

setEngine

public void setEngine(WikiEngine wikiEngine)