Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.renderer.impl
Class JiveRenderManager

java.lang.Object
  extended by com.jivesoftware.forum.renderer.impl.JiveRenderManager
All Implemented Interfaces:
JiveManager, CategoryListener, ForumListener, ForumRenderManager, RenderManager

public class JiveRenderManager
extends java.lang.Object
implements ForumRenderManager, JiveManager, CategoryListener, ForumListener

Default implementation of the RenderManager interface.


Field Summary
static java.lang.String[] DEFAULT_FILTER_CLASSES
           
static long[] DEFAULT_FILTER_RENDER_TYPES
           
protected static java.util.Map inheritedFilters
           
 
Constructor Summary
JiveRenderManager(DbForumFactory factory, int objectType, long objectID)
          Creates a new render manager.
 
Method Summary
 void addFilterRenderTypes(java.lang.String filterName, java.util.List renderTypes)
          Adds a set of render types for the given filter.
 void addRenderFilter(java.lang.String className)
          Installs a new class into the list of render filters for the system.
 void categoryAdded(CategoryEvent event)
          Fired when a category has been added to the system.
 void categoryDeleted(CategoryEvent event)
          Fired when a category is about to be deleted from the system.
 void categoryModified(CategoryEvent event)
          Fired when a category has been modified.
 void categoryMoved(CategoryEvent event)
          Fired when a category has been moved from one category to another.
 void copyGlobalFilters()
          Copy all global filters to the current context.
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 void forumAdded(ForumEvent event)
          Fired when a forum has been added to the system.
 void forumDeleted(ForumEvent event)
          Fired when a forum is about to be deleted from the system.
 void forumMerged(ForumEvent event)
          Fired when a forum is merged into another forum.
 void forumModified(ForumEvent event)
          Fired when a forum is modified.
 void forumMoved(ForumEvent event)
          Fired when a forum has been moved from one category to another.
static JiveRenderManager getCategoryRenderManager(long categoryID)
           
static RenderFilter[] getDefaultFilterList(RenderType renderType)
          Returns an array of default filters in the system.
 long getFilterRenderTypes(java.lang.String filterName)
          Returns the bitset render types installed for the filter at the given index.
static JiveRenderManager getForumRenderManager(long forumID)
           
 java.util.Map getInheritedRenderFilters()
          Retrieve the map of render filters-> renderTypes searching up the tree to the global level if no render filters are defined at the current/parent(s) level.
 java.util.List getInheritedRenderFilters(RenderType renderType)
          Retrieve the array of render filters for the given render type searching up the tree to the global level if no render filters are defined at the current/parent(s) level.
 RenderFilter getRenderFilter(java.lang.String filterName)
          Return the render filter with the specified name
 int getRenderFilterCount()
          Returns the count of currently installed render filters.
 RenderFilter[] getRenderFilters()
          Returns an array of RenderFilter objects that list all the currently configured render filters.
 java.util.List getTags()
           
 void initialize()
          Initialize the manager.
 void removeAllFilters()
          Removes all filters from the current context.
 void removeFilterRenderTypes(java.lang.String filterName, java.util.List renderTypes)
          Removes a set of render types from the given filter.
 void removeRenderFilter(java.lang.String filterName)
          Removes the specified filter from the list of currently configured filters.
 java.lang.String render(java.lang.Object source, RenderType renderType, RenderStrategy strategy, java.lang.String string)
          Applies filters to the specified string.
 java.lang.String render(java.lang.Object source, RenderType renderType, java.lang.String string)
          Applies filters to the specified string.
 void save()
          Saves all filters to the persistent store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILTER_CLASSES

public static final java.lang.String[] DEFAULT_FILTER_CLASSES

DEFAULT_FILTER_RENDER_TYPES

public static final long[] DEFAULT_FILTER_RENDER_TYPES

inheritedFilters

protected static java.util.Map inheritedFilters
Constructor Detail

JiveRenderManager

public JiveRenderManager(DbForumFactory factory,
                         int objectType,
                         long objectID)
Creates a new render manager.

Parameters:
factory - the forum factory
objectType - the type of object to create a render manager for
objectID - the object ID of the object to create a render manager for
Method Detail

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

render

public java.lang.String render(java.lang.Object source,
                               RenderType renderType,
                               java.lang.String string)
Description copied from interface: RenderManager
Applies filters to the specified string. The source object for which we're rendering the string is needed since a render filter or macro may require it to properly determine what to render. The renderType will be used to generate the list of filter to apply to the passed in string.

The RenderStrategy.RENDER_ALL render stategy will be used.

Specified by:
render in interface RenderManager
Parameters:
source - the source object for which we're rendering a string for.
renderType - the render type to use to determine which filters to apply.
string - the string to render.
Returns:
the rendered string.
See Also:
RenderType

render

public java.lang.String render(java.lang.Object source,
                               RenderType renderType,
                               RenderStrategy strategy,
                               java.lang.String string)
Description copied from interface: RenderManager
Applies filters to the specified string. The source object for which we're rendering the string is needed since a render filter or macro may require it to properly determine what to render. The renderType will be used to the proper list of filters to apply to the passed in string.

Specified by:
render in interface RenderManager
Parameters:
source - the source object for which we're rendering a string for.
renderType - the render type to use to determine which filters to apply.
strategy - the render strategy to use to render the string.
string - the string to render.
Returns:
the rendered string.
See Also:
RenderType

getRenderFilterCount

public int getRenderFilterCount()
Description copied from interface: RenderManager
Returns the count of currently installed render filters.

Specified by:
getRenderFilterCount in interface RenderManager
Returns:
a count of the currently installed render filters.

getRenderFilter

public RenderFilter getRenderFilter(java.lang.String filterName)
Description copied from interface: RenderManager
Return the render filter with the specified name

Specified by:
getRenderFilter in interface RenderManager
Parameters:
filterName - the name of the filter to return
Returns:
the RenderFilter with the given name, or null if no such filter exists.

getRenderFilters

public RenderFilter[] getRenderFilters()
Description copied from interface: RenderManager
Returns an array of RenderFilter objects that list all the currently configured render filters.

Specified by:
getRenderFilters in interface RenderManager
Returns:
an array of all configured render filters.

getDefaultFilterList

public static RenderFilter[] getDefaultFilterList(RenderType renderType)
Returns an array of default filters in the system. Used primarily for testing.

Parameters:
renderType - a render type to use to narrow down the default filter list
Returns:
an array of default filters in the system

getInheritedRenderFilters

public java.util.Map getInheritedRenderFilters()
Retrieve the map of render filters-> renderTypes searching up the tree to the global level if no render filters are defined at the current/parent(s) level.

Specified by:
getInheritedRenderFilters in interface RenderManager
Returns:
a map (RenderFilter -> Long of render types)

getInheritedRenderFilters

public java.util.List getInheritedRenderFilters(RenderType renderType)
Retrieve the array of render filters for the given render type searching up the tree to the global level if no render filters are defined at the current/parent(s) level.

Parameters:
renderType - the render type
Returns:
a list of render filters

addRenderFilter

public void addRenderFilter(java.lang.String className)
                     throws java.lang.ClassNotFoundException,
                            java.lang.IllegalArgumentException
Description copied from interface: RenderManager
Installs a new class into the list of render filters for the system. Exceptions are thrown if you're not a system administrator, the class can't be loaded from the classpath, or the class isn't an instance of RenderFilter.

Specified by:
addRenderFilter in interface RenderManager
Parameters:
className - the fully qualified name of the class to add to the list of available render filters in the system.
Throws:
java.lang.ClassNotFoundException - if the class could not be loaded.
java.lang.IllegalArgumentException

removeRenderFilter

public void removeRenderFilter(java.lang.String filterName)
Description copied from interface: RenderManager
Removes the specified filter from the list of currently configured filters.

Specified by:
removeRenderFilter in interface RenderManager
Parameters:
filterName - the name of the filter to remove.

getFilterRenderTypes

public long getFilterRenderTypes(java.lang.String filterName)
Description copied from interface: RenderManager
Returns the bitset render types installed for the filter at the given index.

Specified by:
getFilterRenderTypes in interface RenderManager
Parameters:
filterName - the name of the filter.
Returns:
a bitset of render types for the given filter.

addFilterRenderTypes

public void addFilterRenderTypes(java.lang.String filterName,
                                 java.util.List renderTypes)
Description copied from interface: RenderManager
Adds a set of render types for the given filter.

Specified by:
addFilterRenderTypes in interface RenderManager
Parameters:
filterName - the name of the filter.
renderTypes - a list of render types to add.

removeFilterRenderTypes

public void removeFilterRenderTypes(java.lang.String filterName,
                                    java.util.List renderTypes)
Description copied from interface: RenderManager
Removes a set of render types from the given filter.

Specified by:
removeFilterRenderTypes in interface RenderManager
Parameters:
filterName - the name of the filter.
renderTypes - a list of render types to remove.

save

public void save()
Description copied from interface: RenderManager
Saves all filters to the persistent store. This method should be called after setting any properties on individual filters that are being managed by this render manager.

Warning: Calling this method will expire all pertinent caches so that cache consistency is maintained.

Specified by:
save in interface RenderManager

getCategoryRenderManager

public static JiveRenderManager getCategoryRenderManager(long categoryID)

getForumRenderManager

public static JiveRenderManager getForumRenderManager(long forumID)

copyGlobalFilters

public void copyGlobalFilters()
                       throws java.lang.IllegalStateException,
                              UnauthorizedException
Description copied from interface: ForumRenderManager
Copy all global filters to the current context. If the current context already has 1 or more filters configured an IllegalStateException will be thrown.

Specified by:
copyGlobalFilters in interface ForumRenderManager
Specified by:
copyGlobalFilters in interface RenderManager
Throws:
java.lang.IllegalStateException - if the current context already has 1 or more filters configured
UnauthorizedException - if not an admin

removeAllFilters

public void removeAllFilters()
                      throws UnauthorizedException
Description copied from interface: ForumRenderManager
Removes all filters from the current context.

Specified by:
removeAllFilters in interface ForumRenderManager
Specified by:
removeAllFilters in interface RenderManager
Throws:
UnauthorizedException - if not an admin

getTags

public java.util.List getTags()

categoryAdded

public void categoryAdded(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been added to the system.

Specified by:
categoryAdded in interface CategoryListener
Parameters:
event - the event object.

categoryDeleted

public void categoryDeleted(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category is about to be deleted from the system. Because various code pieces may depend on this event for performing cleanup tasks, it's guaranteed that this method will be called before the category is deleted from the database.

Specified by:
categoryDeleted in interface CategoryListener
Parameters:
event - the event object.

categoryModified

public void categoryModified(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been modified.

Specified by:
categoryModified in interface CategoryListener
Parameters:
event - the event object.

categoryMoved

public void categoryMoved(CategoryEvent event)
Description copied from interface: CategoryListener
Fired when a category has been moved from one category to another.

Specified by:
categoryMoved in interface CategoryListener
Parameters:
event - the event object.

forumAdded

public void forumAdded(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum has been added to the system.

Specified by:
forumAdded in interface ForumListener
Parameters:
event - the event object.

forumDeleted

public void forumDeleted(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is about to be deleted from the system. This event will be fired when an individual forum is deleted or when the forum's category is deleted. Because various code pieces may depend on this event for performing cleanup tasks, it's guaranteed that this method will be called before the forum is deleted from the database.

Specified by:
forumDeleted in interface ForumListener
Parameters:
event - the event object.

forumModified

public void forumModified(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is modified.

Specified by:
forumModified in interface ForumListener
Parameters:
event - the event object.

forumMoved

public void forumMoved(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum has been moved from one category to another.

Specified by:
forumMoved in interface ForumListener
Parameters:
event - the event object.

forumMerged

public void forumMerged(ForumEvent event)
Description copied from interface: ForumListener
Fired when a forum is merged into another forum.

Specified by:
forumMerged in interface ForumListener
Parameters:
event - the event object.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.