ca.cbc.sportwire.dochandler
Class JDOMToFile

java.lang.Object
  |
  +--ca.cbc.sportwire.dochandler.JDOMToFile
All Implemented Interfaces:
DocHandler, WireFeederProperties

public class JDOMToFile
extends java.lang.Object
implements DocHandler, WireFeederProperties

JDOMToFile is used by the DocQueue to process JDOM items on the queue. This handler assumes the doc is a JDOM Document, then writes the XML to a file

Created: Wed Apr 3 16:05:01 EST 2002

Version:
$Id: JDOMToFile.java,v 1.4 2002/04/23 04:55:51 garym Exp $
Author:
Gary Lawrence Murphy

Field Summary
(package private) static org.apache.log4j.Category cat
          Set up a reporting category in Log4J
private  org.apache.commons.collections.ExtendedProperties config
           
(package private) static org.apache.log4j.Category dump
           
 
Fields inherited from interface ca.cbc.sportwire.WireFeederProperties
CONFIGFILE_DEFAULT, CONFIGFILE_PROPERTY, DEFAULT_FILENAME_XPATH, DEFAULT_SAX_DRIVER_CLASS, DEFAULT_XML_PATH, DEFAULT_XMLRPC_PORT, DOCHANDLER_DEFAULT, DOCHANDLER_PROPERTY, DOCWORKERS_DEFAULT, DOCWORKERS_PROPERTY, DTD_PATH_PROPERTY, FEED_REGEX_PROPERTY, FEEDCLASS_DEFAULT, FEEDCLASS_PROPERTY, FEEDFILTER_DEFAULT, FEEDFILTER_PROPERTY, FILENAME_XPATH_PROPERTY, IGNOREFILE_PROPERTY, LOGFILE_DEFAULT, LOGFILE_PROPERTY, MAP_PATH_PROPERTY, SAX_CLASS_PROPERTY, WATCHDOG_IDLE_DEFAULT, WATCHDOG_IDLE_PROPERTY, XML_PATH_PROPERTY, XMLRPC_PORT_PROPERTY, XSL_PATH_PROPERTY
 
Constructor Summary
JDOMToFile(org.apache.commons.collections.ExtendedProperties config)
          JDOMToFile constructor stores the config so we can get at connection details later
 
Method Summary
 org.apache.commons.collections.ExtendedProperties getConfig()
          Get the value of config.
private  java.lang.String getSaxClass()
           
 java.lang.Object processDocument(java.lang.Object d)
          processDocument: handler for the DocQueue, this method parses the doc.toString() through Xerces to create a DOM, then selected the Map appropriate to the DocType and stuffs the DOM in the database using that O:R Map.
 void setConfig(org.apache.commons.collections.ExtendedProperties v)
          Set the value of config.
private  java.lang.String SportsMLToFilename(org.jdom.Document dom)
           
 
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
Set up a reporting category in Log4J

dump

static org.apache.log4j.Category dump

config

private org.apache.commons.collections.ExtendedProperties config
Constructor Detail

JDOMToFile

public JDOMToFile(org.apache.commons.collections.ExtendedProperties config)
JDOMToFile constructor stores the config so we can get at connection details later
Parameters:
config - an ExtendedProperties value
Method Detail

getConfig

public org.apache.commons.collections.ExtendedProperties getConfig()
Get the value of config.
Returns:
ExtendedProperties value of config.

setConfig

public void setConfig(org.apache.commons.collections.ExtendedProperties v)
Set the value of config.
Parameters:
v - Value to assign to config.

getSaxClass

private java.lang.String getSaxClass()

SportsMLToFilename

private java.lang.String SportsMLToFilename(org.jdom.Document dom)
                                     throws java.io.FileNotFoundException

processDocument

public java.lang.Object processDocument(java.lang.Object d)
processDocument: handler for the DocQueue, this method parses the doc.toString() through Xerces to create a DOM, then selected the Map appropriate to the DocType and stuffs the DOM in the database using that O:R Map. If any of the inserts fail, the transaction is rolled back and the document ignored.
Specified by:
processDocument in interface DocHandler
Parameters:
doc - any Object where the string form is XML