com.simonstl.moe.factory
Class SAXFactory

java.lang.Object
  |
  +--org.xml.sax.helpers.XMLFilterImpl
        |
        +--com.simonstl.moe.factory.SAXFactory
All Implemented Interfaces:
ComponentOutputI, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class SAXFactory
extends org.xml.sax.helpers.XMLFilterImpl
implements ComponentOutputI

The SAXFactory class provides a relatively simple mechanism for creating new MOE components, hardwired to the components provided in the com.simonstl.moe package. It in turn relies on the ComponentFactory class.

This class extends XMLFilterImpl rather than DefaultHandler so that it can be used as a pass-through if appropriate.

Version:
0.01 29 August 2001
Author:
Simon St.Laurent

Field Summary
protected  ComponentQFactory cqf
           
protected  ComponentInputI listener
           
protected  int status
           
 
Fields inherited from interface com.simonstl.moe.ComponentOutputI
CHUNKS, COLLECTING, FINISHED, NOTSTARTED, SAX
 
Constructor Summary
SAXFactory(org.xml.sax.XMLReader parent)
           
 
Method Summary
 void characters(char[] ch, int offset, int len)
           
 void endElement(java.lang.String uri, java.lang.String localname, java.lang.String qname)
           
 void endPrefixMapping(java.lang.String prefix)
           
 CoreComponentI getCurrentComponent()
          Not sure I'll keep this.
 int getStatus()
          getStatus allows impatient listeners to find out what's going on.
 void ignorableWhitespace(char[] ch, int offset, int len)
           
static void main(java.lang.String[] args)
          FilterTester's main method requires two arguments - a rules file and then a target XML file.
static void printHelp()
          printHelp() lists options if the user doesn't specify any files.
 void setListener(ComponentInputI _listener)
          It's all gotta go someplace.
 boolean setReport(int typeReport)
          setReport tells the outputter whether to report content as the largest objects it knows (0), a SAX-like view of content(1), or some other view (other numbers.) If an outputter doesn't understand a request, it should return false.
 void startElement(java.lang.String uri, java.lang.String localname, java.lang.String qname, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

protected int status

listener

protected ComponentInputI listener

cqf

protected ComponentQFactory cqf
Constructor Detail

SAXFactory

public SAXFactory(org.xml.sax.XMLReader parent)
Method Detail

getStatus

public int getStatus()
Description copied from interface: ComponentOutputI
getStatus allows impatient listeners to find out what's going on. A status of 0 means that no information has been retrieved yet, a status of 1 means that it's collecting information locally, and maybe I'll come up with other useful bits. 2 means it's done.
Specified by:
getStatus in interface ComponentOutputI

setReport

public boolean setReport(int typeReport)
Description copied from interface: ComponentOutputI
setReport tells the outputter whether to report content as the largest objects it knows (0), a SAX-like view of content(1), or some other view (other numbers.) If an outputter doesn't understand a request, it should return false.
Specified by:
setReport in interface ComponentOutputI

getCurrentComponent

public CoreComponentI getCurrentComponent()
Not sure I'll keep this.
Specified by:
getCurrentComponent in interface ComponentOutputI

setListener

public void setListener(ComponentInputI _listener)
It's all gotta go someplace.
Specified by:
setListener in interface ComponentOutputI

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localname,
                         java.lang.String qname,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Overrides:
startElement in class org.xml.sax.helpers.XMLFilterImpl

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localname,
                       java.lang.String qname)
                throws org.xml.sax.SAXException
Overrides:
endElement in class org.xml.sax.helpers.XMLFilterImpl

characters

public void characters(char[] ch,
                       int offset,
                       int len)
                throws org.xml.sax.SAXException
Overrides:
characters in class org.xml.sax.helpers.XMLFilterImpl

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int offset,
                                int len)
                         throws org.xml.sax.SAXException
Overrides:
ignorableWhitespace in class org.xml.sax.helpers.XMLFilterImpl

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Overrides:
startPrefixMapping in class org.xml.sax.helpers.XMLFilterImpl

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Overrides:
endPrefixMapping in class org.xml.sax.helpers.XMLFilterImpl

printHelp

public static void printHelp()
printHelp() lists options if the user doesn't specify any files.

main

public static void main(java.lang.String[] args)
                 throws org.xml.sax.SAXException,
                        java.io.IOException,
                        java.io.FileNotFoundException
FilterTester's main method requires two arguments - a rules file and then a target XML file. Options may appear before those arguments:
-p [parser wrapper class name] - specifies a SAX2 parser for use with this tool
/>