|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.cri.xcat.api.helpers.DefaultResponseHandler
public class DefaultResponseHandler
This class is the default handler for a xCAT response from the xCAT daemon. It prints out the contents of the XML response to the console using SAX parsing techniques.
This class manages error handling by logging and printing the error to the console.
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
responseData
|
protected boolean |
serverDone
|
| Constructor Summary | |
|---|---|
DefaultResponseHandler()
|
|
| Method Summary | |
|---|---|
void |
characters(char[] buf,
int offset,
int len)
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String name)
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getResponseData()
Returns a map that contains the information contained in the XML. |
void |
handleError(java.lang.Exception e)
Logs the error that occurred and prints the error to the console. |
void |
handleXmlResponse(java.io.InputStream inputStream)
Saves the XML response to the an internal |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> responseData
protected boolean serverDone
| Constructor Detail |
|---|
public DefaultResponseHandler()
| Method Detail |
|---|
public void handleError(java.lang.Exception e)
handleError in interface IResponseHandlere - The error that occurred.public void handleXmlResponse(java.io.InputStream inputStream)
getResponseData method.
Assumes each non-parent XML tag has text content which is assumed to be the value of the xml node.
Continues to read xCAT responses until the serverdone tag is
met.
handleXmlResponse in interface IResponseHandlerinputStream - the input stream from the xCAT daemon to this client.
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String name)
throws org.xml.sax.SAXException
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void characters(char[] buf,
int offset,
int len)
throws org.xml.sax.SAXException
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseData()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||