net.sundog.hoople
Class BaseXMLGeneratingParser

java.lang.Object
  extended bynet.sundog.hoople.BaseParser
      extended bynet.sundog.hoople.BaseXMLGeneratingParser
Direct Known Subclasses:
JSFParser, SpringParser, StrutsParser

public abstract class BaseXMLGeneratingParser
extends BaseParser

A convenient super class for HooperParsers that take the XML in the URL Config file and insert it into a new XML file.


Constructor Summary
protected BaseXMLGeneratingParser(java.lang.String configSectionParentTagName)
           
 
Method Summary
protected  void addElementToBase(org.w3c.dom.Element element)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String elementText, java.io.File file, java.io.File documentRoot)
          Override this method with things to do when the URLConfigParser finds the end of an element and isActive() returns true.
protected  void finalizeElement(org.w3c.dom.Element element)
          Called after the element has been copied from the URL Configuration.
 java.io.File getBaseFile()
          The orginal XML file that will have elements added to it.
 org.w3c.dom.Document getBaseFileDOM()
          Returns the baseFile's DOM tree.
 java.io.File getFinalFile()
          The final XML file with elements from the URL Confings.
protected abstract  org.w3c.dom.Element getParentConfigElement(org.w3c.dom.Document baseAsDOM)
          Return the element for which all generated Elements should be appended to.
 boolean isCheckVCSIgnore()
           
 boolean isVCSIgnoreSet()
          Most of the time, you don't want your generated final file to be checked into your source control system.
 void setActive(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Called at the start and end of all tags to let this parser opt-in or out of having its startElelment and endElement methods called.
 void setBaseFile(java.io.File baseFile)
           
 void setCheckVCSIgnore(boolean checkVCSIgnore)
           
 void setFinalFile(java.io.File finalFile)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes, java.io.File urlConfigFile, java.io.File documentRoot)
          Override this method with things to do when the URLConfigParser finds the start of an element and isActive() returns true.
 void writeFinalFile()
          Write the final file to the file system.
 
Methods inherited from class net.sundog.hoople.BaseParser
convertToAbsolutePath, getDocumentBuilder, getUrlConfigurationParser, isActive, setActive, setDocumentBuilder, setUrlConfigurationParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseXMLGeneratingParser

protected BaseXMLGeneratingParser(java.lang.String configSectionParentTagName)
Method Detail

getBaseFile

public java.io.File getBaseFile()
The orginal XML file that will have elements added to it.


setBaseFile

public void setBaseFile(java.io.File baseFile)

getFinalFile

public java.io.File getFinalFile()
The final XML file with elements from the URL Confings.


setFinalFile

public void setFinalFile(java.io.File finalFile)

getBaseFileDOM

public org.w3c.dom.Document getBaseFileDOM()
                                    throws org.xml.sax.SAXException,
                                           java.io.IOException
Returns the baseFile's DOM tree. The DOM is just created once, so multiple calls to this method will return the same DOM object.

Throws:
org.xml.sax.SAXException
java.io.IOException

writeFinalFile

public void writeFinalFile()
                    throws java.io.IOException,
                           org.xml.sax.SAXException
Write the final file to the file system.

Throws:
java.io.IOException
org.xml.sax.SAXException

isCheckVCSIgnore

public boolean isCheckVCSIgnore()

setCheckVCSIgnore

public void setCheckVCSIgnore(boolean checkVCSIgnore)

isVCSIgnoreSet

public boolean isVCSIgnoreSet()
                       throws java.io.IOException
Most of the time, you don't want your generated final file to be checked into your source control system. This checks that your VCS system is set to not check the final file in. Currently, this method only supports CVS

Throws:
java.io.IOException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes,
                         java.io.File urlConfigFile,
                         java.io.File documentRoot)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Description copied from class: BaseParser
Override this method with things to do when the URLConfigParser finds the start of an element and isActive() returns true.

Specified by:
startElement in class BaseParser
Throws:
org.xml.sax.SAXException
java.io.IOException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName,
                       java.lang.String elementText,
                       java.io.File file,
                       java.io.File documentRoot)
                throws org.xml.sax.SAXException
Description copied from class: BaseParser
Override this method with things to do when the URLConfigParser finds the end of an element and isActive() returns true.

Specified by:
endElement in class BaseParser
Throws:
org.xml.sax.SAXException

addElementToBase

protected void addElementToBase(org.w3c.dom.Element element)
                         throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

setActive

public void setActive(java.lang.String uri,
                      java.lang.String localName,
                      java.lang.String qName,
                      org.xml.sax.Attributes attributes)
               throws org.xml.sax.SAXException
Description copied from class: BaseParser
Called at the start and end of all tags to let this parser opt-in or out of having its startElelment and endElement methods called.

Overrides:
setActive in class BaseParser
Throws:
org.xml.sax.SAXException

finalizeElement

protected void finalizeElement(org.w3c.dom.Element element)
                        throws java.io.IOException,
                               org.xml.sax.SAXException
Called after the element has been copied from the URL Configuration. Useful for setting default and/or derivable attributes.

Throws:
java.io.IOException
org.xml.sax.SAXException

getParentConfigElement

protected abstract org.w3c.dom.Element getParentConfigElement(org.w3c.dom.Document baseAsDOM)
Return the element for which all generated Elements should be appended to.



Copyright © 2005 Sundog. All Rights Reserved.