nbi.xmlsec.biocase.protocol.filter
Class ResponseFilter

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

public class ResponseFilter
extends ProtocolFilter

The ResponseFilter filters responses of the BioCASE protocol. It consists of three internal filters working together:

The HeaderFilter simply reads in the BioCASE header and forwards all incoming SAX Events to the ContentHandler. The RBACFilter cooperates with an RBACPDP and possibly filters out treeElements according to the PDP's policies. The result of this filtering process may be added to the Diagnostics of the response, which is the task of the Diagnostics Filter.

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

Field Summary
(package private)  Diagnostics contentDiagnostics
           
(package private)  ContentFilter contentFilter
          Subfilter for the content
(package private)  DiagnosticsFilter diagnosticsFilter
          Subfilter for the diagnostics
(package private)  HeaderFilter headerFilter
          Subfilter for the header
static String LN_ROOT
          Local name of the element response
(package private)  Response response
          The parsed response
(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
ResponseFilter(String protocolURI, int filterMode)
          Inits the filter instance.
ResponseFilter(XMLReader parent, String protocolURI, int filterMode)
          Inits the filter instance with specified parent.
 
Method Summary
protected  nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
          Sets the parameters of the content filter (especially the response header) and overwrites the current registration before the content filter is active.
 ContentFilter getContentFilter()
          Gets the contentFilter
 DiagnosticsFilter getDiagnosticsFilter()
          Gets the diagnosticsFilter
 HeaderFilter getHeaderFilter()
          Gets the headerFilter
protected  ResponseFilterParameter getParameter()
          Gets the parameter of this filter.
 Response getResponse()
          Gets the response
protected  nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
          Collects the response from the filters.
protected  nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
          Registers the subfilters for header, content and Diagnostics.
 void setContentFilter(ContentFilter contentFilter)
          Sets contentFilter
 void setDiagnosticsFilter(DiagnosticsFilter diagnosticsFilter)
          Sets diagnosticsFilter
 void setHeaderFilter(HeaderFilter headerFilter)
          Sets headerFilter
 
Methods inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
characters, checkFilterParameter, endElement, filterCharacters, getFilterMode, getFilterParameter, getProtocolURI, isParsingComplete, parseElement, 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 final String LN_ROOT
Local name of the element response

See Also:
Constant Field Values

trackMode

static final int trackMode
Track mode for the filter stack

See Also:
Constant Field Values

headerFilter

HeaderFilter headerFilter
Subfilter for the header


contentFilter

ContentFilter contentFilter
Subfilter for the content


diagnosticsFilter

DiagnosticsFilter diagnosticsFilter
Subfilter for the diagnostics


response

Response response
The parsed response


contentDiagnostics

Diagnostics contentDiagnostics
Constructor Detail

ResponseFilter

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

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

ResponseFilter

public ResponseFilter(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

parseInit

protected nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
                                    throws SAXException
Registers the subfilters for header, content and 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)

filterElement

protected nbi.xml.sax.SAXElement filterElement(nbi.xml.sax.SAXElement element)
                                        throws SAXException
Sets the parameters of the content filter (especially the response header) and overwrites the current registration before the content filter is active. This is necessary, because the response header is unknown, until parsing of the response header is complete.

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.parseElement(SAXElement)

parseComplete

protected nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
                                        throws SAXException
Collects the response from the filters.

Overrides:
parseComplete in class ProtocolFilter
Parameters:
element - The complete root element (including the value).
Returns:
The (modified) element or null when element shall be removed.
Throws:
SAXException - If any parsing error occurs.
See Also:
ProtocolFilter.parseComplete(SAXElement)

getParameter

protected ResponseFilterParameter getParameter()
Gets the parameter of this filter.

Returns:
filter parameter.

getContentFilter

public ContentFilter getContentFilter()
Gets the contentFilter

Returns:
Returns the contentFilter.

setContentFilter

public void setContentFilter(ContentFilter contentFilter)
Sets contentFilter

Parameters:
contentFilter - The contentFilter to set.

getDiagnosticsFilter

public DiagnosticsFilter getDiagnosticsFilter()
Gets the diagnosticsFilter

Returns:
Returns the diagnosticsFilter.

setDiagnosticsFilter

public void setDiagnosticsFilter(DiagnosticsFilter diagnosticsFilter)
Sets diagnosticsFilter

Parameters:
diagnosticsFilter - The diagnosticsFilter to set.

getHeaderFilter

public HeaderFilter getHeaderFilter()
Gets the headerFilter

Returns:
Returns the headerFilter.

setHeaderFilter

public void setHeaderFilter(HeaderFilter headerFilter)
Sets headerFilter

Parameters:
headerFilter - The headerFilter to set.

getResponse

public Response getResponse()
Gets the response

Returns:
Returns the response.


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