nbi.xmlsec.biocase.protocol.filter
Class DiagnosticsFilter

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended bynbi.xmlsec.biocase.protocol.filter.ProtocolFilter
          extended bynbi.xmlsec.biocase.protocol.filter.DiagnosticsFilter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public class DiagnosticsFilter
extends ProtocolFilter

This class parses a BioCASE diagnostics from a SAX stream.

All SAX events are forwarded to the defined ContentHandler. The parsed Diagnosticsmay be retrieved with getDiagnostics().

Since:
Version:
$Revision: 1.13 $
Author:
Lutz Suhrbier

Field Summary
(package private)  Diagnostics diagnostics
          The parsed BioCASE diagnostics
private  boolean firstElement
          Signals if the first diagnostic subelement has been written
static String LN_DIAGNOSTIC
          Local name of the element diagnostic
static String LN_DIAGNOSTIC_CODE
          Local name of the attribute code of the element diagnostic
static String LN_DIAGNOSTIC_SEVERITY
          Local name of the attribute severity of the element diagnostic
static String LN_ROOT
          Local name of the root element diagnostics
(package private) static int trackMode
          Track mode for the filter stack
 
Fields inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
elementStack, filterMode, FILTERMODE_FILTER, FILTERMODE_NONE, FILTERMODE_PARSER, filterRoot, logger, PROT_URI_13, PROT_URI_20
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
 
Constructor Summary
DiagnosticsFilter(String protocolURI, int filterMode)
          Inits the filter instance.
DiagnosticsFilter(XMLReader parent, String protocolURI, int filterMode)
          Inits the filter instance with specified parent.
 
Method Summary
 Diagnostics addDiagnostics(Diagnostics diagnostics)
          Adds diagnostics, and creates them when null.
protected  nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
          Writes predefined Diagnostics to the content handler.
 Diagnostics getDiagnostics()
          Gets the diagnostics
protected  void initSubFilter()
          Registers subfilters for subelements.
protected  nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
          Parses a Diagnostic treeElements and adds it to the Diagnostics.
protected  nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
          Initialises Diagnostics
 void writeDiagnostics()
          Write diagnostics to the content handler.
 
Methods inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
characters, checkFilterParameter, endElement, filterCharacters, getFilterMode, getFilterParameter, getProtocolURI, isParsingComplete, parseComplete, registerSubFilter, setFilterParameter, setProtocolURI, startElement, unregisterSubFilter
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, 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

LN_ROOT

public static String LN_ROOT
Local name of the root element diagnostics


LN_DIAGNOSTIC

public static final String LN_DIAGNOSTIC
Local name of the element diagnostic

See Also:
Constant Field Values

LN_DIAGNOSTIC_CODE

public static final String LN_DIAGNOSTIC_CODE
Local name of the attribute code of the element diagnostic

See Also:
Constant Field Values

LN_DIAGNOSTIC_SEVERITY

public static final String LN_DIAGNOSTIC_SEVERITY
Local name of the attribute severity of the element diagnostic

See Also:
Constant Field Values

trackMode

static final int trackMode
Track mode for the filter stack

See Also:
Constant Field Values

diagnostics

Diagnostics diagnostics
The parsed BioCASE diagnostics


firstElement

private boolean firstElement
Signals if the first diagnostic subelement has been written

Constructor Detail

DiagnosticsFilter

public DiagnosticsFilter(String protocolURI,
                         int filterMode)
Inits the filter instance.

Parameters:
protocolURI - protocol version URI of this filter.
filterMode - filterMode of this filter ProtocolFilter.filterMode.

DiagnosticsFilter

public DiagnosticsFilter(XMLReader parent,
                         String protocolURI,
                         int filterMode)
Inits the filter instance with specified parent.

Parameters:
parent - parent reader.
protocolURI - protocol version URI of this filter.
filterMode - filterMode of this filter ProtocolFilter.filterMode.
Method Detail

initSubFilter

protected void initSubFilter()
Registers subfilters for subelements.


filterElement

protected nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
                                        throws SAXException
Writes predefined Diagnostics to the content handler.

Overrides:
filterElement in class ProtocolFilter
Parameters:
element - The element corresponding to the startElement event.
Returns:
The (modified) element or null when element shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.filterElement(SAXElement)

parseElement

protected nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
                                       throws SAXException
Parses a Diagnostic treeElements and adds it to the Diagnostics.

Overrides:
parseElement in class ProtocolFilter
Parameters:
element - The element corresponding to the endElement event.
Returns:
The (modified) element or null when element shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.parseElement(SAXElement)

parseInit

protected nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
                                    throws SAXException
Initialises Diagnostics

Overrides:
parseInit in class ProtocolFilter
Parameters:
element - The element of the startElement event (contains no value).
Returns:
The (modified) element or null when the event shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.parseInit(SAXElement)

getDiagnostics

public Diagnostics getDiagnostics()
Gets the diagnostics

Returns:
Returns the diagnostics.

addDiagnostics

public Diagnostics addDiagnostics(Diagnostics diagnostics)
Adds diagnostics, and creates them when null.

Returns:
Returns the diagnostics.

writeDiagnostics

public void writeDiagnostics()
                      throws SAXException
Write diagnostics to the content handler.

Returns:
Returns the diagnostics.
Throws:
SAXException


Copyright © 2006 Lutz Suhrbier, Freie Universitšt Berlin. All Rights Reserved.