|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
project.biota.digir.DiGIRRequestParser
DiGIRRequestParser parses a DiGIR request and saves the info later needed in constructing a DiGIR response.
Constructor Summary | |
DiGIRRequestParser(InputSource source)
Constructs a DiGIRRequestParser object to parse the DiGIR request in the InputSource object. |
Method Summary | |
void |
addDiagnostics(String severity,
int errorConst,
String msg)
Adds a diagnoistic element to the DiGIR response. |
protected void |
addRecordConcept(RecordConcept concept)
Adds a RecordConcept object to the list of record concepts specified in the DiGIR request. |
void |
characters(char[] ch,
int start,
int length)
Receives notification of character data inside an element. |
void |
endDocument()
Receives notification of the end of the document to take any specific actions at the end of a document. |
void |
endElement(String namespaceURI,
String localName,
String qName)
Receives notification of the end of an element. |
void |
endPrefixMapping(String prefix)
Receives notification of the end of a Namespace mapping. |
void |
error(SAXParseException e)
Receives notification of a recoverable parser error. |
void |
fatalError(SAXParseException e)
Reports a fatal XML parsing error. |
String |
getClientIP()
Gets the IP address string of the client that makes the HTTP request to the servlet. |
String |
getConceptualSchemaName()
Returns the conceptual schema namespace identifier used in this DiGIR request. |
String |
getConceptualSchemaURI()
Returns the conceptual schema URI string used in this DiGIR request. |
boolean |
getCount()
Returns the boolean value of the "count" element specified in this DiGIR request. |
Map |
getDiagnostics()
Returns a map mapping error level strings to a list of DiGIRProvError objects. |
int |
getErrorCode()
Returns the error code. |
String |
getFilterString()
Gets the string representation of this DiGIR request filter contents from the DiGIRRequestParser. |
String |
getInventoryClause()
Gets the schema concept to be used to construct a DiGIR response to an inventory request. |
int |
getLimit()
Returns the "limit" attribute specified in the "records" element of the request. |
List |
getRecordConcepts()
Returns a list of concepts requested via a schema location or a sequence of elements specified in the "structure" element of the DiGIR search request. |
String |
getRequestDestinationText()
Gets the the text associated with the "destination" element of a DiGIR request. |
String |
getRequestedResource()
Returns the name of the resource requested in this DiGIR request. |
String |
getRequestSourceText()
Gets the the text associated with the "source" element of a DiGIR request. |
String |
getRequestType()
Gets the type of this DiGIR request. |
Set |
getRequiredConcepts()
Returns a set of schema concept names required to build the DiGIR response. |
String |
getSourceResource()
Gets the resource attribute of the "source" element of a DiGIR request. |
String |
getSourceURL()
Gets the URL string of the client that makes the HTTP request to the servlet. |
int |
getStart()
Returns the start attribute specified in the "records" element of the request. |
boolean |
hasErrorDiagnose()
Checks whether there is an error diagnostic already. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receives notification of ignorable whitespace in element content. |
void |
init()
Initializes the SAX parser. |
void |
processingInstruction(String instruction,
String data)
Receives notification of a processing instruction. |
void |
setClientIP(String ip)
Sets the IP address string of the client that makes the HTTP request to the servlet. |
void |
setDocumentLocator(Locator locator)
Receive a Locator object for document events. |
void |
setSourceURL(String urlString)
Sets the URL string of the client that makes the HTTP request to the servlet. |
void |
skippedEntity(String name)
Receives notification of a skipped entity. |
void |
startDocument()
Receives notification of the beginning of the document to take any specific actions at the beginning of a document. |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Receives notification of the start of an element. |
void |
startParsing(InputSource source)
Starts parsing the DiGIR request. |
void |
startPrefixMapping(String prefix,
String uri)
Receives notification of the start of a Namespace mapping. |
void |
warning(SAXParseException e)
Receives notification of a parser warning. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
notationDecl, resolveEntity, unparsedEntityDecl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DiGIRRequestParser(InputSource source)
source
- the InputSource object of the xml entityMethod Detail |
public void init()
public void startParsing(InputSource source)
source
- the InputSource object of the xml entitypublic void startDocument() throws SAXException
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void endDocument() throws SAXException
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void setDocumentLocator(Locator locator)
locator
- the locator for all SAX document eventspublic void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
namespaceURI
- the Namespace URI, or the empty string if the element
has no Namespace URI or if Namespace processing is not being performedlocalName
- the local name (without prefix), or the empty string if
Namespace processing is not being performedqName
- the qualified name (with prefix), or the empty string if
qualified names are not availableatts
- the attributes attached to the element. If there are no attributes,
it shall be an empty Attributes object
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void characters(char[] ch, int start, int length) throws SAXException
ch
- the charactersstart
- the start position in the character arraylength
- the number of characters to use from the character array
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void endElement(String namespaceURI, String localName, String qName) throws SAXException
namespaceURI
- the Namespace URI, or the empty string if the element
has no Namespace URI or if Namespace processing is not being performedlocalName
- the local name (without prefix), or the empty string if
Namespace processing is not being performedqName
- the qualified name (with prefix), or the empty string if
qualified names are not available
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ch
- the whitespace charactersstart
- the start position in the character arraylength
- the number of characters to use from the character array
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void startPrefixMapping(String prefix, String uri) throws SAXException
prefix
- the Namespace prefix being declareduri
- the Namespace URI mapped to the prefix
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void endPrefixMapping(String prefix) throws SAXException
prefix
- the Namespace prefix being declared
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void processingInstruction(String instruction, String data) throws SAXException
instruction
- the processing instruction targetdata
- the processing instruction data, or null if none is supplied
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void skippedEntity(String name) throws SAXException
name
- the name of the skipped entity
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void error(SAXParseException e) throws SAXException
e
- the error information encoded as an SAXParseException
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void warning(SAXParseException e) throws SAXException
e
- the warning information encoded as an SAXParseException
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void fatalError(SAXParseException e) throws SAXException
e
- the warning information encoded as an SAXParseException
SAXException
- any SAX exception, possibly wrapping another exceptionpublic void setSourceURL(String urlString)
urlString
- the URL string of the servlet clientpublic String getSourceURL()
public void setClientIP(String ip)
ip
- the IP address string of the servlet clientpublic String getClientIP()
public String getInventoryClause()
public String getSourceResource()
public String getRequestSourceText()
public String getRequestDestinationText()
public String getRequestType()
public int getStart()
public int getLimit()
public boolean getCount()
public String getFilterString()
The string uses parentheses to represent the structure of the DiGIR filter. e.g.
( ( concpet_A EQUALS value_A AND concept_B EQUALS value_B ) OR concept_C NOTEQUALS value_C )
public int getErrorCode()
DiGIRProvError
public String getRequestedResource()
public Map getDiagnostics()
public String getConceptualSchemaURI()
public String getConceptualSchemaName()
public Set getRequiredConcepts()
If it fails to parse the schema specified in the request, it uses the default record schema for the requested resource.
public List getRecordConcepts()
This method calls getRequiredConcepts()
to build the list of record
concepts as well as the set of required schema concepts if they are not already found.
getRequiredConcepts()
protected void addRecordConcept(RecordConcept concept)
concept
- the RecordConcept object representing a record conceptpublic void addDiagnostics(String severity, int errorConst, String msg)
addDiagnostics("error", DiGIRProvError.RESOURCE_FAILURE, "SOMETHING WRONG");
results in a "diagnostic" element like the following
<diagnostic code="RESOURCE_FAILURE" severity="error">SOMETHING WRONG</diagnostic>
in the DiGIR response.
severity
- the severity of the message, could be debug, info, warn, error, or fatal.errorConst
- the error constants defined by DiGIRProvErrormsg
- the error messageDiGIRProvError
public boolean hasErrorDiagnose()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |