nbi.xmlsec.biocase.protocol.filter
Class ContentFilter

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

public class ContentFilter
extends ProtocolFilter

The class ContentFilter parses the content of a BioCASE response from a SAX stream.

All SAX events are forwarded to the defined ContentHandler or to the RBACFiltersubfilter configured during the filter initialisation in parseInit(SAXElement) respectively. The RBACFilterprovides filtering of the incorporated content document and gets control over the SAX filtering process, until the document processing has finished. The parsed Contentmay be retrieved with getContent().

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

Field Summary
private  Content content
          To store the content attributes
(package private)  ProtocolFilter contentFilter
          The currently configured content filter
static String LN_CAPABILITIES
          Local name of the subelement capabilities
static String LN_CONTENT_RECORDCOUNT
          Local name of the root element attribute recordCount
static String LN_CONTENT_RECORDDROPPED
          Local name of the root element attribute recordDropped
static String LN_CONTENT_RECORDSTART
          Local name of the root element attribute recordStart
static String LN_CONTENT_TOTALSEARCHHITS
          Local name of the root element attribute totalSearchHits
static String LN_ROOT
          Local name of the root element content
static String LN_SCAN
          Local name of the subelement scan
static String LN_SEARCH
          Local name of the subelement search
(package private) static Logger logger
           
(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, PROT_URI_13, PROT_URI_20
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
 
Constructor Summary
ContentFilter(String protocolURI, int filterMode)
          Inits the filter instance.
ContentFilter(XMLReader parent, String protocolURI, int filterMode)
          Inits the filter instance with specified parent.
 
Method Summary
 Content getContent()
          Gets the content
 String getContentNamespaceURI()
          Gets the namespace URI of the content.
protected  ContentFilterParameter getParameter()
          Gets the parameter of this filter.
 Set getSignElements()
          Gets the set of element paths evaluated for signing.
protected  nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
          This method is called when the endElement event of root element was received, before it is forwarded to the content handler
protected  nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
          Configures the content filter ((@link RBACFilter RBACFilter}) based on the content filter parameters request, response header, RBACPDP and role set.
 
Methods inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
characters, checkFilterParameter, endElement, filterCharacters, filterElement, 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

logger

static Logger logger

LN_ROOT

public static final String LN_ROOT
Local name of the root element content

See Also:
Constant Field Values

LN_CONTENT_TOTALSEARCHHITS

public static final String LN_CONTENT_TOTALSEARCHHITS
Local name of the root element attribute totalSearchHits

See Also:
Constant Field Values

LN_CONTENT_RECORDDROPPED

public static final String LN_CONTENT_RECORDDROPPED
Local name of the root element attribute recordDropped

See Also:
Constant Field Values

LN_CONTENT_RECORDCOUNT

public static final String LN_CONTENT_RECORDCOUNT
Local name of the root element attribute recordCount

See Also:
Constant Field Values

LN_CONTENT_RECORDSTART

public static final String LN_CONTENT_RECORDSTART
Local name of the root element attribute recordStart

See Also:
Constant Field Values

LN_CAPABILITIES

public static final String LN_CAPABILITIES
Local name of the subelement capabilities

See Also:
Constant Field Values

LN_SCAN

public static final String LN_SCAN
Local name of the subelement scan

See Also:
Constant Field Values

LN_SEARCH

public static final String LN_SEARCH
Local name of the subelement search

See Also:
Constant Field Values

contentFilter

ProtocolFilter contentFilter
The currently configured content filter


trackMode

static final int trackMode
Track mode for the filter stack

See Also:
Constant Field Values

content

private Content content
To store the content attributes

Constructor Detail

ContentFilter

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

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

ContentFilter

public ContentFilter(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
Configures the content filter ((@link RBACFilter RBACFilter}) based on the content filter parameters request, response header, RBACPDP and role set.

The configuration must processed here, because the filter parameter response header may be unknown when creating the content subfilter in the parent filter (ResponseFilter). In case of a search response, the root element name of the (@link RBACFilter RBACFilter} subfilter is set to null, which means unknown. Then, the element of the next startElement event will define the root element of the subfilter (see ProtocolFilter#startElement(String, String, String, Attributes)). The root element names for the response types capabilities and scan are defined by the BioCASE protocol and were deduced from the response header and must be set as filter parameter before.

When the filter mode is ProtocolFilter.FILTERMODE_PARSER then a ContentObjectFilter is configured, parsing the content document.

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)

parseComplete

protected nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
                                        throws SAXException
Description copied from class: ProtocolFilter
This method is called when the endElement event of root element was received, before it is forwarded to the content handler

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.

getParameter

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

Returns:
filter parameter.

getContent

public Content getContent()
Gets the content

Returns:
Returns the content.

getSignElements

public Set getSignElements()
Gets the set of element paths evaluated for signing.

Returns:
The set of element paths evaluated for signing.

getContentNamespaceURI

public String getContentNamespaceURI()
Gets the namespace URI of the content. The namespace URI is retrieved from the protocolURI of the internal content filter.

Returns:
The namespace URI of the content.


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