com.deepshiftlabs.nerrvana
Class Utils

java.lang.Object
  extended by com.deepshiftlabs.nerrvana.Utils

public class Utils
extends Object

Several kinds of utility functions: - XML parsers, helpers and cachers - HttpClient helpers - some others

Version:
1.00
Author:
Deep Shift Labs, Victor Orlov

Field Summary
static String lastXMLAsString
           
static List<Document> parsedDocuments
           
 
Constructor Summary
Utils()
           
 
Method Summary
static Document bytes2xml(byte[] ab)
           
static void cacheDocument(Document doc)
           
static Element createChildElement(Node parent, String tag)
           
static Element createChildElement(Node parent, String tag, String text)
           
static Node createChildElementIfNotExists(Node parent, String child_name)
           
static Document file2xml(String filename)
           
static Node getChildNode(Node parent, String child_tagname)
           
static Document getEntityContentAsDocument(org.apache.http.HttpEntity entity)
           
 ByteArrayInputStream getResponseContent(org.apache.http.HttpEntity entity)
           
static String getTraceAsString(Throwable e)
           
static String getUniqueChildNodeValue(Node parent, String child_tagname)
           
static String nodeValue(Node node)
           
static String parseErrorResponse(org.apache.http.HttpEntity entity)
           
static Document parseResponse(org.apache.http.HttpEntity entity)
           
static void printSystemProperties(PrintStream out)
           
static void setCDATAValue(Node node, String data)
           
static void setChildNodeCDATAValue(Node parent, String child_name, String data)
           
static void setChildNodeTextValue(Node parent, String child_name, String data)
           
static void setNodeTextValue(Node node, String text)
           
static Document string2xml(String s)
           
static String uniqueTagValue(String tagname, Document doc, boolean bMandatory)
           
static void xml2file(Document doc, File file)
           
static String xml2string(Document doc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parsedDocuments

public static List<Document> parsedDocuments

lastXMLAsString

public static String lastXMLAsString
Constructor Detail

Utils

public Utils()
Method Detail

cacheDocument

public static void cacheDocument(Document doc)

getEntityContentAsDocument

public static Document getEntityContentAsDocument(org.apache.http.HttpEntity entity)
                                           throws Exception
Throws:
Exception

string2xml

public static Document string2xml(String s)
                           throws Exception
Throws:
Exception

bytes2xml

public static Document bytes2xml(byte[] ab)
                          throws Exception
Throws:
Exception

file2xml

public static Document file2xml(String filename)
                         throws Exception
Throws:
Exception

xml2file

public static void xml2file(Document doc,
                            File file)
                     throws Exception
Throws:
Exception

getTraceAsString

public static String getTraceAsString(Throwable e)

uniqueTagValue

public static String uniqueTagValue(String tagname,
                                    Document doc,
                                    boolean bMandatory)
                             throws Exception
Throws:
Exception

getChildNode

public static Node getChildNode(Node parent,
                                String child_tagname)

getUniqueChildNodeValue

public static String getUniqueChildNodeValue(Node parent,
                                             String child_tagname)
                                      throws Exception
Throws:
Exception

parseResponse

public static Document parseResponse(org.apache.http.HttpEntity entity)
                              throws Exception
Throws:
Exception

parseErrorResponse

public static String parseErrorResponse(org.apache.http.HttpEntity entity)
                                 throws Exception
Throws:
Exception

getResponseContent

public ByteArrayInputStream getResponseContent(org.apache.http.HttpEntity entity)
                                        throws Exception
Throws:
Exception

xml2string

public static String xml2string(Document doc)
                         throws Exception
Throws:
Exception

nodeValue

public static String nodeValue(Node node)
                        throws Exception
Throws:
Exception

setCDATAValue

public static void setCDATAValue(Node node,
                                 String data)

setNodeTextValue

public static void setNodeTextValue(Node node,
                                    String text)

setChildNodeCDATAValue

public static void setChildNodeCDATAValue(Node parent,
                                          String child_name,
                                          String data)

setChildNodeTextValue

public static void setChildNodeTextValue(Node parent,
                                         String child_name,
                                         String data)

createChildElementIfNotExists

public static Node createChildElementIfNotExists(Node parent,
                                                 String child_name)

createChildElement

public static Element createChildElement(Node parent,
                                         String tag)

createChildElement

public static Element createChildElement(Node parent,
                                         String tag,
                                         String text)

printSystemProperties

public static void printSystemProperties(PrintStream out)


Copyright © 2004-2013 Deep Shift Labs. All Rights Reserved.