ca.cbc.sportwire.servlet.data
Class DOMFileFactory

java.lang.Object
  |
  +--ca.cbc.sportwire.servlet.data.DOMFileFactory
All Implemented Interfaces:
DOMFactory, GlobalCacheProperties, SportPageProperties

public class DOMFileFactory
extends java.lang.Object
implements DOMFactory, SportPageProperties, GlobalCacheProperties

DOMFileFactory: creates DocumentFile DOM xml-doc data object; installed by the BasicPageHandler as the $xml variable into the context; this provides access to a DOM built from the remainder of the pathinfo.

This class is a little strange; historically, it was a page handler but it migrated to become a factory for the DefaultPageHandler's selection of the means to load a page ending in the XML_SUFFIX. Note too that it can't be a singleton because it needs the webapp properties to function, so it stashes itself in the global ExtendedProperties' MRU

Created: Wed Dec 5 23:49:11 2001
 $Log: DOMFileFactory.java,v $
 Revision 1.8  2002/04/13 05:36:02  garym
 Fixed XSL search path bug

 Revision 1.7  2002/02/18 20:34:04  garym
 implement ad-hoc SQL from $sql.dom()

 Revision 1.6  2002/02/10 05:45:43  garym
 implement $xml.doms(perlregex)

 Revision 1.5  2002/01/31 05:36:59  garym
 added xsl example

 Revision 1.4  2002/01/31 05:33:27  garym
 fixed bug in search for xsl files

 Revision 1.3  2002/01/29 19:33:45  garym
 fixed concurrency bug with global config

 Revision 1.2  2002/01/28 07:01:36  garym
 Implement JDOM transform caching and document parse thread.

 Revision 1.1  2002/01/24 19:50:20  garym
 Major restructuring of beans and pagehandlers

 Revision 1.12  2002/01/14 21:51:46  garym
 bug fixes in topics and config files migration to Extended Properties

 Revision 1.11  2002/01/04 06:12:46  garym
 default page handling of XML files obsolesces DOMPageHandler

 Revision 1.10  2002/01/03 03:36:27  garym
 Abstracted periodic-refresh data cache objects

 Revision 1.9  2001/12/24 05:47:56  garym
 Fixed interface error on DOM data item loading

 Revision 1.8  2001/12/23 17:55:23  garym
 Allow for multiple SportPage apps on one JVM

 Revision 1.7  2001/12/17 09:36:28  garym
 default page bug fixed. debug msg errors in Lineup and vcal

 Revision 1.5  2001/12/15 02:15:59  garym
 initial release to CBC staging server

 Revision 1.4  2001/12/14 21:12:29  garym
 include file debugging

 Revision 1.3  2001/12/08 02:53:15  garym
 Defaults are overlaid with the topic defaults

 Revision 1.2  2001/12/06 21:03:24  garym
 Needed List wrapper around W3C NodeList

 Revision 1.1  2001/12/06 16:29:51  garym
 Implemented DOM object support and the Bio page handler


 

Version:
$Id: DOMFileFactory.java,v 1.8 2002/04/13 05:36:02 garym Exp $
Author:
Gary Lawrence Murphy
See Also:
BioPageHandler, DocumentFile

Field Summary
(package private) static org.apache.log4j.Category cat
           
private static java.lang.String DOMFILEFACTORY_PROPERTY
           
protected  org.apache.commons.collections.ExtendedProperties sc
          sc: holds the webapp configuration; set when the first instance is created.
 
Fields inherited from interface ca.cbc.sportwire.servlet.data.SportPageProperties
BEAN_SUFFIX, BEANFACTORY_VAR, CONTEXT_VAR, DATE_VAR, DEFAULT_EXTS, DEFAULT_INDEXES, DEFAULT_PAGE_SUFFIX, DEFAULT_SAX_DRIVER_CLASS, DEFAULT_TIMEZONE, DEFAULT_TOPIC, DOM_VAR, ERROR_TEMPLATE_VAR, EXCEPTION_VAR, EXTENSIONS_VAR, FALSE, GLOBAL_VAR, HOME_PROPERTY, INCLUDE_EXTS_PROPERTY, INCLUDE_VAR, INDEX_INDICATOR_VAR, INDEX_TEMPLATE_VAR, LAYOUT_TEMPLATE_VAR, MACRO_LIB_PROPERTY, MISSING_TEMPLATE_VAR, OUTPUT_VAR, PAGE_EXPIRE, PAGE_TEMPLATE_VAR, PANIC_404_PAGE, PANIC_404_PROPERTY, PANIC_500_PAGE, PANIC_500_PROPERTY, PARAM_PARSER_VAR, PATH_VAR, REQUEST_VAR, RESPONSE_VAR, SAX_CLASS_PROPERTY, SERVLET_DEBUG, SERVLET_LOGCONF_PROPERTY, SQL_SUFFIX, TEMPLATE_PATHS_PROPERTY, TIMEZONE_PROPERTY, TRUE, URI_VAR, VELOCITY_LOGFILE_DEFAULT, VELOCITY_LOGFILE_PROPERTY, XML_EXTS, XML_EXTS_PROPERTY, XML_PATHS_PROPERTY, XML_SUFFIX, XSL_EXTS, XSL_EXTS_PROPERTY, XSL_PATHS_PROPERTY
 
Fields inherited from interface ca.cbc.sportwire.servlet.data.GlobalCacheProperties
CACHE_DEFAULT_PERIOD, CACHE_DEFAULT_TIMEOUT, CACHE_PERIOD, CACHE_TIMEOUT, MRU_PROPERTY, MRU_VAR, TTL_PROPERTY, TTL_VAR
 
Constructor Summary
private DOMFileFactory(org.apache.commons.collections.ExtendedProperties sc)
           
 
Method Summary
 DOMFile dom(PathList pathinfo)
          dom: Returns the DOM object from pathlist; this is used in SportPage to get a DOM from the remainder of the path_info
 DOMFile dom(java.lang.String pathinfo)
          dom returns the DOM object according to a possibly custom DOM class specified by a dom.data.class property.
 java.util.List doms(java.lang.String regex)
          doms: like the singular version, but this one returns a list of files matching the perl-regex base filename (XML path and default extensions will be added to this regex).
static java.lang.String findXmlFile(org.apache.commons.collections.ExtendedProperties sc, java.lang.String base)
          findXmlFile: try the xml.home paths and xml.extensions and default to the webapp home as the file doc-root and .xml
static java.util.List findXmlFiles(org.apache.commons.collections.ExtendedProperties sc, java.lang.String regex)
          findXmlFiles: Similar to the singular version, but this one will return a list of File objects instead of filename strings.
static java.lang.String findXslFile(org.apache.commons.collections.ExtendedProperties sc, java.lang.String base)
          findXslFile: try the xsl.home paths and xml.extensions and default to the webapp home as the file doc-root and .xsl
static DOMFileFactory getInstance(org.apache.commons.collections.ExtendedProperties sc)
          getInstance: returns a factory for use in a template
 DOMFile loadDom(java.lang.String filename)
          loadDom: loads the file as a DOMFile, based on the property setting for the type of DOM object
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cat

static org.apache.log4j.Category cat

DOMFILEFACTORY_PROPERTY

private static final java.lang.String DOMFILEFACTORY_PROPERTY

sc

protected org.apache.commons.collections.ExtendedProperties sc
sc: holds the webapp configuration; set when the first instance is created.
Constructor Detail

DOMFileFactory

private DOMFileFactory(org.apache.commons.collections.ExtendedProperties sc)
Method Detail

getInstance

public static DOMFileFactory getInstance(org.apache.commons.collections.ExtendedProperties sc)
getInstance: returns a factory for use in a template
Parameters:
sc - an ExtendedProperties value
Returns:
the DOMFileFactory value

findXmlFile

public static java.lang.String findXmlFile(org.apache.commons.collections.ExtendedProperties sc,
                                           java.lang.String base)
findXmlFile: try the xml.home paths and xml.extensions and default to the webapp home as the file doc-root and .xml
Parameters:
sc - an ExtendedProperties value
base - a String value
Returns:
a String value

findXmlFiles

public static java.util.List findXmlFiles(org.apache.commons.collections.ExtendedProperties sc,
                                          java.lang.String regex)
findXmlFiles: Similar to the singular version, but this one will return a list of File objects instead of filename strings. If no files are found, it returns an empty list.
Parameters:
sc - an ExtendedProperties value
regex - a String value
Returns:
a List value

findXslFile

public static java.lang.String findXslFile(org.apache.commons.collections.ExtendedProperties sc,
                                           java.lang.String base)
findXslFile: try the xsl.home paths and xml.extensions and default to the webapp home as the file doc-root and .xsl
Parameters:
sc - an ExtendedProperties value
base - a String value
Returns:
a String value

dom

public DOMFile dom(PathList pathinfo)
dom: Returns the DOM object from pathlist; this is used in SportPage to get a DOM from the remainder of the path_info
Specified by:
dom in interface DOMFactory
Parameters:
pathinfo - a PathList value
Returns:
a DOMFile value

dom

public DOMFile dom(java.lang.String pathinfo)
dom returns the DOM object according to a possibly custom DOM class specified by a dom.data.class property. The specified filename is searched for in the dom.home directories; if the file is not found, a null is returned and the trouble logged.
Specified by:
dom in interface DOMFactory
Parameters:
pathinfo - a String filename value
Returns:
a DOMFile value or null if there were problems

doms

public java.util.List doms(java.lang.String regex)
doms: like the singular version, but this one returns a list of files matching the perl-regex base filename (XML path and default extensions will be added to this regex). If no files are found, returns an empty list.
Parameters:
regex - a String (perl regex rules)
Returns:
a List of DOM objects

loadDom

public DOMFile loadDom(java.lang.String filename)
loadDom: loads the file as a DOMFile, based on the property setting for the type of DOM object
Parameters:
filename - a String value
Returns:
a DOMFile value