org.jasig.portal.car
Class DatabaseTagHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.jasig.portal.car.DatabaseTagHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class DatabaseTagHandler
extends org.xml.sax.helpers.DefaultHandler

Processes the database tag looking for two element that should each contain a file path suitable for loading via classloader.findResource(). The "tables" tag should point to a file having the appropriate format for creating tables in the portal's database using DbLoader and hence should be structured identically to uPortal's default data structure definition file tables.xml. The "data" tag is optional but if included should point to file having the appropriate format for loading with DbLoader the tables created by tables.xml and hence should be structured identically to uPortal's default data set file data.xml.

Version:
$Revision: 1.6 $ $Date: 2005/04/15 19:09:14 $
Author:
Mark Boyd

Field Summary
private  java.lang.StringBuffer chars
           
private  boolean CREATE_SCRPT_DFLT
           
private  boolean CREATE_TBL_DFLT
           
private  boolean createScript
           
private  boolean createTables
           
private  ParsingContext ctx
           
private  java.lang.String data
           
private  boolean DROP_TBL_DFLT
           
private  boolean dropTables
           
private static org.apache.commons.logging.Log log
           
private  boolean POP_TBL_DFLT
           
private  boolean populateTables
           
private  java.lang.String tables
           
 
Constructor Summary
DatabaseTagHandler(ParsingContext ctx)
          Construct a DatabaseHandler that receives events from parsing a channel archive deployment descriptor but only for any contained database elements and their children.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Handle the characters event to capture textual content for elements.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Handle the closing element event.
private  boolean getBoolean(java.lang.String string, boolean deflt)
           
private  void loadDatabase()
          Load the database using DbLoader.
private  void resetValues()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Handle start element events.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

CREATE_SCRPT_DFLT

private boolean CREATE_SCRPT_DFLT

POP_TBL_DFLT

private boolean POP_TBL_DFLT

CREATE_TBL_DFLT

private boolean CREATE_TBL_DFLT

DROP_TBL_DFLT

private boolean DROP_TBL_DFLT

createScript

private boolean createScript

populateTables

private boolean populateTables

createTables

private boolean createTables

dropTables

private boolean dropTables

ctx

private ParsingContext ctx

tables

private java.lang.String tables

data

private java.lang.String data

chars

private java.lang.StringBuffer chars
Constructor Detail

DatabaseTagHandler

DatabaseTagHandler(ParsingContext ctx)
Construct a DatabaseHandler that receives events from parsing a channel archive deployment descriptor but only for any contained database elements and their children.

Parameters:
ctx -
Method Detail

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Handle start element events.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Handle the characters event to capture textual content for elements.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Handle the closing element event.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

getBoolean

private boolean getBoolean(java.lang.String string,
                           boolean deflt)
Parameters:
string -
Returns:

resetValues

private void resetValues()

loadDatabase

private void loadDatabase()
Load the database using DbLoader.