net.sf.dewdrop.sqlml.xml
Class SqlmlHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bynet.sf.dewdrop.xml.DewDropDefaultHandler
          extended bynet.sf.dewdrop.sqlml.xml.SqlmlHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class SqlmlHandler
extends DewDropDefaultHandler

Class short description goes here.

Class long description goes here.

[optional JavaDoc tags here]

Author:
Les A. Hazlewood

Field Summary
static String EXPR_PACKAGE
           
static String SQLML_PACKAGE
           
 
Fields inherited from class net.sf.dewdrop.xml.DewDropDefaultHandler
_components, _locator, _namespaceMappings, logger, NL
 
Constructor Summary
SqlmlHandler()
          Default constructor.
 
Method Summary
protected  void associateParentWithChild(SqlmlComponent parent, SqlmlComponent child)
           
 void characters(char[] ch, int start, int length)
          The only xml elements that uses character data are "description", "native", and "conditionalValue"
 void endElement(String namespaceURI, String localName, String qName)
           
 Sqlml getSqlml()
           
protected  SqlmlComponent instantiateElement(String name)
           
protected  void setComponentAttributes(SqlmlComponent sc, Attributes atts)
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
           
protected  void updateDurableReferences(SqlmlComponent sc)
          Updates all stateful reference components in this instance.
 void validate(Column col)
           
protected  boolean validate(ForeignKey fk)
          Validates the ForeignKey fk.
 void validate(Ref ref)
           
protected  void validate(SqlmlComponent sc)
           
 
Methods inherited from class net.sf.dewdrop.xml.DewDropDefaultHandler
endDocument, endPrefixMapping, getDocumentLocator, resolveEntity, setDocumentLocator, setEntityResolver, startDocument, startPrefixMapping
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQLML_PACKAGE

public static final String SQLML_PACKAGE

EXPR_PACKAGE

public static final String EXPR_PACKAGE
Constructor Detail

SqlmlHandler

public SqlmlHandler()
Default constructor. Creates an XMLReader instance to do the parsing.

Method Detail

getSqlml

public Sqlml getSqlml()

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Throws:
SAXException

setComponentAttributes

protected void setComponentAttributes(SqlmlComponent sc,
                                      Attributes atts)
                               throws SAXException
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DewDropDefaultHandler
Throws:
SAXException

instantiateElement

protected SqlmlComponent instantiateElement(String name)
                                     throws SAXException
Throws:
SAXException

updateDurableReferences

protected void updateDurableReferences(SqlmlComponent sc)
Updates all stateful reference components in this instance. That is, the references to "current" components and any stack data needed to be maintained across xml element parsing. If the specified parameter does not match a type that must be maintained, this method does nothing.

Parameters:
sc - the current SqlmlComponent element being created.

validate

protected void validate(SqlmlComponent sc)
                 throws SAXException
Throws:
SAXException

validate

protected boolean validate(ForeignKey fk)
                    throws SAXException
Validates the ForeignKey fk.

This method returns true if fk can be added to a column definition, meaning an in-line foreign key definition can be made in the resulting sql output. If it returns false, it means that the fk definition references a table that hasn't been created yet. This is not considered an error, since if the table is defined later, this foreign key will be added after the referenced table is defined in the form of an alter table statement (altering the table where this foreign key is defined).

Parameters:
fk -
Returns:
true if the foreign key can be added immediately to a column definition, false otherwise.
Throws:
SAXException - if the foreign key's "foreign" field does not reference a column in a previously defined table. If the table has not been previously defined, no exception is thrown as the processor will continue to look for the table definition as processing continues. If the referenced table is found later, and fk's column reference doesn't reference a valid column in that table, an exception will be thrown at that time.

validate

public void validate(Ref ref)
              throws SAXException
Throws:
SAXException

validate

public void validate(Column col)
              throws SAXException
Throws:
SAXException

associateParentWithChild

protected void associateParentWithChild(SqlmlComponent parent,
                                        SqlmlComponent child)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
The only xml elements that uses character data are "description", "native", and "conditionalValue"

Parameters:
ch -
start -
length -
Throws:
SAXException