nbi.xmlsec.biocase.protocol.filter
Class COPFilter

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

public class COPFilter
extends ProtocolFilter

The class COPFilter parses the content of a COP operator of BioCASE search request from a SAX stream.

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

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

Field Summary
protected  COP cop
          Stores the parsed COP
static String LN_COP_PATH
          Local name of the attribute path of any COP element
static String LN_EQUALS
          Local name of the Simple COP equals
static String LN_GREATERTHAN
          Local name of the Simple COP greaterThan
static String LN_GREATERTHANOREQUALS
          Local name of the Simple COP greaterThanEquals
static String LN_IN
          Local name of the Multi COP in
static String LN_ISNOTNULL
          Local name of the Unary COP isNotNull
static String LN_ISNULL
          Local name of the Unary COP isNull
static String LN_LESSTHAN
          Local name of the Simple COP lessThan
static String LN_LESSTHANOREQUALS
          Local name of the Simple COP lessThanEquals
static String LN_LIKE
          Local name of the Simple COP like
static String LN_NOTEQUALS
          Local name of the Simple COP notEquals
static String LN_VALUE
          Local name of the element value fo the Multi COP in
(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
COPFilter(String protocolURI, String filterRoot, int trackMode, int filterMode)
          Inits the COP filter.
COPFilter(XMLReader parent, String protocolURI, String filterRoot, int trackMode, int filterMode)
          Inits the COP filter with the specified parent.
 
Method Summary
 COP getOperator()
          Gets the cop
private  void initSubFilter()
          Initialises subfilters of this filter
static boolean isMulti(String operator)
          Checks if the given operator is a MultiCOP operator.
static boolean isOperator(String operator)
          Checks if the given operator is a COP operator.
static boolean isSimple(String operator)
          Checks if the given operator is a SimpleCOP operator.
static boolean isUnary(String operator)
          Checks if the given operator is a UnaryCOP operator.
protected  nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
          If parsing complete, keeps Unary unchanged, add the value of the root element for a simple operator.
protected  nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
          Adds a parsed value subelement to the cop.
protected  nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
          Initialises the COP setting its parsed type and path(Unary).
 
Methods inherited from class nbi.xmlsec.biocase.protocol.filter.ProtocolFilter
characters, checkFilterParameter, endElement, filterCharacters, filterElement, getFilterMode, getFilterParameter, getProtocolURI, isParsingComplete, 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_COP_PATH

public static String LN_COP_PATH
Local name of the attribute path of any COP element


LN_ISNULL

public static String LN_ISNULL
Local name of the Unary COP isNull


LN_ISNOTNULL

public static String LN_ISNOTNULL
Local name of the Unary COP isNotNull


LN_EQUALS

public static String LN_EQUALS
Local name of the Simple COP equals


LN_GREATERTHAN

public static String LN_GREATERTHAN
Local name of the Simple COP greaterThan


LN_GREATERTHANOREQUALS

public static String LN_GREATERTHANOREQUALS
Local name of the Simple COP greaterThanEquals


LN_LESSTHAN

public static String LN_LESSTHAN
Local name of the Simple COP lessThan


LN_LESSTHANOREQUALS

public static String LN_LESSTHANOREQUALS
Local name of the Simple COP lessThanEquals


LN_LIKE

public static String LN_LIKE
Local name of the Simple COP like


LN_NOTEQUALS

public static String LN_NOTEQUALS
Local name of the Simple COP notEquals


LN_IN

public static String LN_IN
Local name of the Multi COP in


LN_VALUE

public static String LN_VALUE
Local name of the element value fo the Multi COP in


trackMode

static final int trackMode
Track mode for the filter stack

See Also:
Constant Field Values

cop

protected COP cop
Stores the parsed COP

Constructor Detail

COPFilter

public COPFilter(String protocolURI,
                 String filterRoot,
                 int trackMode,
                 int filterMode)
Inits the COP filter.

Parameters:
protocolURI - URI of the protocol version.
filterRoot - Local name of the root element.
trackMode - Define track mode for the internal FilterStack.
filterMode - filterMode of this filter ProtocolFilter.filterMode.

COPFilter

public COPFilter(XMLReader parent,
                 String protocolURI,
                 String filterRoot,
                 int trackMode,
                 int filterMode)
Inits the COP filter with the specified parent.

Parameters:
parent - Parent reader.
protocolURI - URI of the protocol version.
filterRoot - Local name of the root element.
trackMode - Define track mode for the internal FilterStack.
filterMode - filterMode of this filter ProtocolFilter.filterMode.
Method Detail

initSubFilter

private void initSubFilter()
Initialises subfilters of this filter


parseInit

protected nbi.xml.sax.SAXElement parseInit(nbi.xml.sax.SAXElement element)
                                    throws SAXException
Initialises the COP setting its parsed type and path(Unary).

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)

parseElement

protected nbi.xml.sax.SAXElement parseElement(nbi.xml.sax.SAXElement element)
                                       throws SAXException
Adds a parsed value subelement to the cop. Is only called when a registered value element is finished.

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

parseComplete

protected nbi.xml.sax.SAXElement parseComplete(nbi.xml.sax.SAXElement element)
                                        throws SAXException
If parsing complete, keeps Unary unchanged, add the value of the root element for a simple operator.

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)

isUnary

public static boolean isUnary(String operator)
Checks if the given operator is a UnaryCOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is unary, false otherwise.

isSimple

public static boolean isSimple(String operator)
Checks if the given operator is a SimpleCOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is simple, false otherwise.

isMulti

public static boolean isMulti(String operator)
Checks if the given operator is a MultiCOP operator.

Parameters:
operator - operator to check
Returns:
true if operator is multi, false otherwise.

isOperator

public static boolean isOperator(String operator)
Checks if the given operator is a COP operator.

Parameters:
operator - operator to check
Returns:
true if operator is COP, false otherwise.

getOperator

public COP getOperator()
Gets the cop

Returns:
Returns the cop.


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