org.cdlib.xtf.servletBase
Class TextConfig

Object
  extended by TextConfig
Direct Known Subclasses:
CrossQueryConfig, DynaXMLConfig

public abstract class TextConfig
extends Object

Common members and methods for servlet configuration classes


Field Summary
 AttribList attribs
          All the configuration attributes in the form of name/value pairs
private  Configuration config
          Configuration used for parsing XML files
 boolean dependencyCheckingEnabled
          Turns on dependency checking for the caches, so that (for instance) changing a stylesheet forces it to be reloaded.
 String errorGenSheet
          Filesystem path to a stylesheet used to generate error pages (no permission, invalid document, general exceptions, etc.)
 int latencyCutoffSize
          Enables a cutoff size for latency reporting (if reportLatency is true.)
 String logLevel
          Logging level: "silent", "errors", "warnings", "info", or "debug"
 boolean reportLatency
          Turns on latency reporting for the servlet.
 long runawayKillTime
          Amount of time (in seconds) after which a request should voluntarily kill itself.
 long runawayNormalTime
          Amount of time (in seconds) that a request is allowed to run before we consider it a possible "runaway" and start logging warning messages.
 TextServlet servlet
          Servlet we are part of
 Pattern sessionEncodeURLPattern
          Which URLs to apply encoding to, if session tracking enabled and user doesn't allow cookies.
 int stylesheetCacheExpire
          Max length of time (in seconds) to cache a stylesheet.
 int stylesheetCacheSize
          Max # of stylesheets to cache
private  String tokenizeParam
           
 Map tokenizerMap
          List of parameters to tokenize specially.
private  String tokenizeTokenizer
           
 boolean trackSessions
          Whether session tracking is enabled.
 
Constructor Summary
TextConfig(TextServlet servlet)
          Create a configuration and attach it to a servlet
 
Method Summary
protected  boolean handleProperty(String tagAttr, String strVal)
          Called when a property is encountered.
static boolean parseBoolean(String tagAttr, String strVal)
          Utility function - parse a boolean value.
static int parseInt(String tagAttr, String strVal)
          Utility function - parse an integer value.
 void read(String expectedRootTag, String path)
          Constructor - Reads and parses the global configuration file (XML) for the servlet.
static void requireOrElse(String value, String descrip)
          Utility function - if the value is empty, throws an exception.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servlet

public TextServlet servlet
Servlet we are part of


logLevel

public String logLevel
Logging level: "silent", "errors", "warnings", "info", or "debug"


stylesheetCacheSize

public int stylesheetCacheSize
Max # of stylesheets to cache


stylesheetCacheExpire

public int stylesheetCacheExpire
Max length of time (in seconds) to cache a stylesheet.


errorGenSheet

public String errorGenSheet
Filesystem path to a stylesheet used to generate error pages (no permission, invalid document, general exceptions, etc.)


dependencyCheckingEnabled

public boolean dependencyCheckingEnabled
Turns on dependency checking for the caches, so that (for instance) changing a stylesheet forces it to be reloaded.


reportLatency

public boolean reportLatency
Turns on latency reporting for the servlet.


latencyCutoffSize

public int latencyCutoffSize
Enables a cutoff size for latency reporting (if reportLatency is true.) Specifies the number of bytes after which a latency message will be printed, even if the output is not complete.


runawayNormalTime

public long runawayNormalTime
Amount of time (in seconds) that a request is allowed to run before we consider it a possible "runaway" and start logging warning messages. Default: 10 seconds


runawayKillTime

public long runawayKillTime
Amount of time (in seconds) after which a request should voluntarily kill itself. Default: 5 minutes (300 seconds)


trackSessions

public boolean trackSessions
Whether session tracking is enabled. Default: true


sessionEncodeURLPattern

public Pattern sessionEncodeURLPattern
Which URLs to apply encoding to, if session tracking enabled and user doesn't allow cookies. If null, no URL rewriting will be performed.


tokenizerMap

public Map tokenizerMap
List of parameters to tokenize specially. Default: empty (meaning use default tokenizer for all parameters.)


attribs

public AttribList attribs
All the configuration attributes in the form of name/value pairs


config

private Configuration config
Configuration used for parsing XML files


tokenizeParam

private String tokenizeParam

tokenizeTokenizer

private String tokenizeTokenizer
Constructor Detail

TextConfig

public TextConfig(TextServlet servlet)
Create a configuration and attach it to a servlet

Method Detail

read

public void read(String expectedRootTag,
                 String path)
          throws GeneralException
Constructor - Reads and parses the global configuration file (XML) for the servlet.

Parameters:
path - Filesystem path to the config file.
Throws:
GeneralException

handleProperty

protected boolean handleProperty(String tagAttr,
                                 String strVal)
Called when a property is encountered. Derived classes, if they don't recognize the property, should call the base class version of handleProperty().

Parameters:
tagAttr - Combined element/attribute name being considered
strVal - It's string value
Returns:
true if handled, false if unrecognized

parseInt

public static int parseInt(String tagAttr,
                           String strVal)
                    throws GeneralException
Utility function - parse an integer value. If a valid integer isn't specified, throws an exception.

Parameters:
tagAttr - Name of the element/attribute being considered
strVal - It's string value
Throws:
GeneralException

parseBoolean

public static boolean parseBoolean(String tagAttr,
                                   String strVal)
                            throws GeneralException
Utility function - parse a boolean value. Allows "true", "false", "yes", "no", "1", or "0". If not one of these, throws an exception.

Parameters:
tagAttr - Name of the element/attribute being considered
strVal - It's string value
Throws:
GeneralException

requireOrElse

public static void requireOrElse(String value,
                                 String descrip)
                          throws GeneralException
Utility function - if the value is empty, throws an exception.

Parameters:
value - Value to check for null or ""
descrip - If thrown, the exception uses this as the message.
Throws:
GeneralException