net.icite.blojsom.plugin
Class LinkListPlugin

java.lang.Object
  extended bynet.icite.blojsom.plugin.LinkListPlugin
All Implemented Interfaces:
org.blojsom.plugin.BlojsomPlugin

public class LinkListPlugin
extends java.lang.Object
implements org.blojsom.plugin.BlojsomPlugin

LinkListPlugin implements the BlojsomPlugin interface, and uses blojsom's startup and processes to trigger the loading and/or processing of LinkList sources utilizing the specified LinkList datastore (defaults to WTFBase)

Version:
$Id: LinkListPlugin.java,v 1.1 2005/05/11 18:42:00 jay Exp $
Author:
Jay Fienberg

Field Summary
protected  DatastoreBase _base
           
protected  org.apache.commons.logging.Log _logger
           
protected static java.lang.String BASE_FIELD
          "base" is a property that can be set in linklist.properties for setting the datastore class
protected static java.lang.String CONFIG_FILENAME
          "linklist.properties" is the properties file name
protected  java.lang.String configFilePath
           
protected static java.lang.String DEFAULT_BASE
          "net.icite.datastore.WTFBase" is the default datastore base class
protected static java.lang.String DEFAULT_BASEKEY
          "LISTINGS" is the default source "key" to assume if no key is indicated in linklist.txt files
protected static java.lang.String DEFAULT_FILENAME
          "linklist.txt" is the default linklist source filename
protected static java.lang.String[] DEFAULT_KEYS
          These values are the default source "keys" that the plugin should deal with note: this should ultimately be a setable property! note2: this is probably obsolete and needs to be removed
protected static java.lang.String DEFAULT_LISTNAME
          "list" is the fallback value for the source name if sources are not specified using SOURCE_FIELD
protected static java.lang.String DEFAULT_PREFIX
          "global" is the fallback value for the default prefix for global sources if one is not specified using PREFIX_FIELD
protected static java.lang.String ENCODING_FIELD
          "default-encoding" is a property that can be set in linklist.properties for setting the default encoding of linklist files
protected static java.lang.String FALLBACK_FIELD
          "fallback" is a property that can be set in linklist.properties for setting the fallback list source
protected  java.util.Map FileList
           
protected  java.lang.String globalConfigFile
           
protected  java.lang.String globalFallbackSourceFile
           
protected static java.lang.String GROUP_FIELD
          "list-groups" is a property that can be set in linklist.properties for setting the list of list groups
protected  org.apache.commons.collections.map.HashedMap GroupAppends
           
protected  java.lang.String[] listGroups
           
protected  java.util.Properties LLPluginGlobalProperties
           
protected static java.lang.String PREFIX_FIELD
          "global-source-prefix" is a property that can be set in linklist.properties for setting the prefix used on global linklist source names (used when there is a conflict between a user linklist source name and a global source name, e.g., user.mylist and glb.mylist) glb is an example value you'd set this property to
protected  java.lang.String prefixNameSeparator
           
protected static java.lang.String SEPARATOR
          System specific file separator
protected static java.lang.String SOURCE_FIELD
          "sources" is a property that can be set in linklist.properties for setting the list of linklist sources
protected static java.lang.String TIMER_FIELD
          "filewatch-timer" is a property that can be set in linklist.properties for setting the filewatch timer time
protected  org.apache.commons.collections.map.HashedMap UserGroups
           
protected static java.lang.String UTF8
          UTF-8 is the default character encoding
 
Constructor Summary
LinkListPlugin()
          Default constructor
 
Method Summary
 void cleanup()
          Perform any cleanup for the plugin.
 void destroy()
          Called when BlojsomServlet is taken out of service
private  DatastoreBase getBase()
           
private  java.lang.String getEncodingProperty(java.util.Properties prop)
           
 void init(javax.servlet.ServletConfig servletConfig, org.blojsom.blog.BlojsomConfiguration blojsomConfiguration)
          Initialize this plugin.
private  boolean loadProperties(java.util.Properties props, java.lang.String fullFile)
           
 org.blojsom.blog.BlogEntry[] process(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, org.blojsom.blog.BlogUser user, java.util.Map context, org.blojsom.blog.BlogEntry[] entries)
          Process the blog entries
private  void setBase(java.lang.String className)
           
private  java.lang.Object[] sourcePropertyToArray(java.util.Properties prop, java.lang.String filename, java.lang.String fileDir, java.lang.String namePrefix)
           
private  void watchAndLoadSources(java.lang.Object[] src, java.lang.String encoding, java.lang.String sourcePrefix, java.lang.String defaultFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

protected static final java.lang.String UTF8
UTF-8 is the default character encoding

See Also:
Constant Field Values

BASE_FIELD

protected static final java.lang.String BASE_FIELD
"base" is a property that can be set in linklist.properties for setting the datastore class

See Also:
Constant Field Values

ENCODING_FIELD

protected static final java.lang.String ENCODING_FIELD
"default-encoding" is a property that can be set in linklist.properties for setting the default encoding of linklist files

See Also:
Constant Field Values

TIMER_FIELD

protected static final java.lang.String TIMER_FIELD
"filewatch-timer" is a property that can be set in linklist.properties for setting the filewatch timer time

See Also:
Constant Field Values

SOURCE_FIELD

protected static final java.lang.String SOURCE_FIELD
"sources" is a property that can be set in linklist.properties for setting the list of linklist sources

See Also:
Constant Field Values

PREFIX_FIELD

protected static final java.lang.String PREFIX_FIELD
"global-source-prefix" is a property that can be set in linklist.properties for setting the prefix used on global linklist source names (used when there is a conflict between a user linklist source name and a global source name, e.g., user.mylist and glb.mylist) glb is an example value you'd set this property to

See Also:
Constant Field Values

DEFAULT_PREFIX

protected static final java.lang.String DEFAULT_PREFIX
"global" is the fallback value for the default prefix for global sources if one is not specified using PREFIX_FIELD

See Also:
Constant Field Values

DEFAULT_LISTNAME

protected static final java.lang.String DEFAULT_LISTNAME
"list" is the fallback value for the source name if sources are not specified using SOURCE_FIELD

See Also:
Constant Field Values

GROUP_FIELD

protected static final java.lang.String GROUP_FIELD
"list-groups" is a property that can be set in linklist.properties for setting the list of list groups

See Also:
Constant Field Values

FALLBACK_FIELD

protected static final java.lang.String FALLBACK_FIELD
"fallback" is a property that can be set in linklist.properties for setting the fallback list source

See Also:
Constant Field Values

DEFAULT_BASE

protected static final java.lang.String DEFAULT_BASE
"net.icite.datastore.WTFBase" is the default datastore base class

See Also:
Constant Field Values

DEFAULT_FILENAME

protected static final java.lang.String DEFAULT_FILENAME
"linklist.txt" is the default linklist source filename

See Also:
Constant Field Values

CONFIG_FILENAME

protected static final java.lang.String CONFIG_FILENAME
"linklist.properties" is the properties file name

See Also:
Constant Field Values

DEFAULT_BASEKEY

protected static final java.lang.String DEFAULT_BASEKEY
"LISTINGS" is the default source "key" to assume if no key is indicated in linklist.txt files

See Also:
Constant Field Values

DEFAULT_KEYS

protected static final java.lang.String[] DEFAULT_KEYS
These values are the default source "keys" that the plugin should deal with note: this should ultimately be a setable property! note2: this is probably obsolete and needs to be removed


SEPARATOR

protected static final java.lang.String SEPARATOR
System specific file separator


_logger

protected org.apache.commons.logging.Log _logger

_base

protected DatastoreBase _base

configFilePath

protected java.lang.String configFilePath

globalConfigFile

protected java.lang.String globalConfigFile

prefixNameSeparator

protected java.lang.String prefixNameSeparator

listGroups

protected java.lang.String[] listGroups

UserGroups

protected org.apache.commons.collections.map.HashedMap UserGroups

GroupAppends

protected org.apache.commons.collections.map.HashedMap GroupAppends

globalFallbackSourceFile

protected java.lang.String globalFallbackSourceFile

FileList

protected java.util.Map FileList

LLPluginGlobalProperties

protected java.util.Properties LLPluginGlobalProperties
Constructor Detail

LinkListPlugin

public LinkListPlugin()
Default constructor

Method Detail

init

public void init(javax.servlet.ServletConfig servletConfig,
                 org.blojsom.blog.BlojsomConfiguration blojsomConfiguration)
          throws org.blojsom.plugin.BlojsomPluginException
Initialize this plugin. This method only called when the plugin is instantiated.

Specified by:
init in interface org.blojsom.plugin.BlojsomPlugin
Parameters:
servletConfig - Servlet config object for the plugin to retrieve any initialization parameters
blojsomConfiguration - BlojsomConfiguration information
Throws:
org.blojsom.plugin.BlojsomPluginException - If there is an error initializing the plugin

process

public org.blojsom.blog.BlogEntry[] process(javax.servlet.http.HttpServletRequest httpServletRequest,
                                            javax.servlet.http.HttpServletResponse httpServletResponse,
                                            org.blojsom.blog.BlogUser user,
                                            java.util.Map context,
                                            org.blojsom.blog.BlogEntry[] entries)
                                     throws org.blojsom.plugin.BlojsomPluginException
Process the blog entries

Specified by:
process in interface org.blojsom.plugin.BlojsomPlugin
Parameters:
httpServletRequest - Request
httpServletResponse - Response
context - Context
entries - Blog entries retrieved for the particular request
Returns:
Modified set of blog entries
Throws:
org.ignition.blojsom.plugin.BlojsomPluginException - If there is an error processing the blog entries
org.blojsom.plugin.BlojsomPluginException

loadProperties

private boolean loadProperties(java.util.Properties props,
                               java.lang.String fullFile)

getEncodingProperty

private java.lang.String getEncodingProperty(java.util.Properties prop)

setBase

private void setBase(java.lang.String className)

getBase

private DatastoreBase getBase()

watchAndLoadSources

private void watchAndLoadSources(java.lang.Object[] src,
                                 java.lang.String encoding,
                                 java.lang.String sourcePrefix,
                                 java.lang.String defaultFile)

sourcePropertyToArray

private java.lang.Object[] sourcePropertyToArray(java.util.Properties prop,
                                                 java.lang.String filename,
                                                 java.lang.String fileDir,
                                                 java.lang.String namePrefix)

cleanup

public void cleanup()
             throws org.blojsom.plugin.BlojsomPluginException
Perform any cleanup for the plugin. Called after process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.blojsom.blog.BlogUser, java.util.Map, org.blojsom.blog.BlogEntry[]).

Specified by:
cleanup in interface org.blojsom.plugin.BlojsomPlugin
Throws:
org.ignition.blojsom.plugin.BlojsomPluginException - If there is an error performing cleanup for this plugin
org.blojsom.plugin.BlojsomPluginException

destroy

public void destroy()
             throws org.blojsom.plugin.BlojsomPluginException
Called when BlojsomServlet is taken out of service

Specified by:
destroy in interface org.blojsom.plugin.BlojsomPlugin
Throws:
org.ignition.blojsom.plugin.BlojsomPluginException - If there is an error in finalizing this plugin
org.blojsom.plugin.BlojsomPluginException