|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cybersource.ws.client.Utility
public class Utility
Class containing useful constants and methods.
| Field Summary | |
|---|---|
static String |
ENVIRONMENT
Environment information. |
static String |
VERSION
Version number of this release. |
| Method Summary | |
|---|---|
static Element |
createElement(Document owner,
String nsURI,
String elementName,
String textValue)
Creates an Element object in the CyberSource namespace. |
static Element |
getElement(Document owner,
String elementName,
String nsURI)
Returns the Element object corresponding to the given element name. |
static String |
getElementText(Document owner,
String elementName,
String nsURI)
Returns the text value of the given element name in the CyberSource namespace. |
static String |
getStackTrace(Exception e)
Returns the stack trace of the supplied Exception object. |
static String |
mapToString(Map src,
boolean mask,
int type)
Converts the contents of a Map object into a string, one name-value pair to a line and the name and value are separated by an equal sign. |
static DocumentBuilder |
newDocumentBuilder()
Returns a DocumentBuilder object. |
static String |
nodeToString(Node node)
Returns the string representation of the given Node object. |
static String |
nodeToString(Node node,
int type)
Returns the string representation of the given Node object. |
static byte[] |
read(File file)
Reads the content of the given file into a byte array. |
static byte[] |
read(InputStream in)
Reads the content of the given file into a byte array. |
static byte[] |
read(String filename)
Reads the content of the given file into a byte array. |
static Properties |
readProperties(String[] commandLineArgs)
Reads the properties from a file. |
static Document |
readRequest(Properties props,
String filename)
Read the request xml file |
static HashMap |
stringToMap(String src)
Converts a name-value pair string into a Map object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VERSION
public static final String ENVIRONMENT
| Method Detail |
|---|
public static String nodeToString(Node node,
int type)
node - the Node object whose string representation is wanted.type - either PCI.REQUEST or PCI.REPLY. Used for masking.
public static String nodeToString(Node node)
node - the Node object whose string representation is wanted.
public static Properties readProperties(String[] commandLineArgs)
commandLineArgs - the command-line arguments.
public static byte[] read(String filename)
throws IOException
filename - name of the file to read.
IOException - if there was an error reading the file.
public static byte[] read(File file)
throws IOException
file - File object to read.
IOException - if there was an error reading the file.
public static byte[] read(InputStream in)
throws IOException
in - InputStream object to read.
IOException - if there was an error reading the file.
public static DocumentBuilder newDocumentBuilder()
throws ParserConfigurationException
ParserConfigurationException - if no suitable parser
implementation is found.
public static Element getElement(Document owner,
String elementName,
String nsURI)
owner - Document object to search.elementName - local name to search for.nsURI - namespaceURI to used (may be null).
null if none is found.
public static String getElementText(Document owner,
String elementName,
String nsURI)
owner - Document object to search.elementName - local name to search for.nsURI - namespaceURI to used (may be null).
null if none is found.public static String getStackTrace(Exception e)
e - Exception object.
public static HashMap stringToMap(String src)
src - String containing name-value pairs.
public static String mapToString(Map src,
boolean mask,
int type)
src - Map object whose contents are being converted.mask - Flag whether or not to mask "unsafe" fields.type - Relevant only when mask is true, indicates whether this
is the request or the reply map. Pass either
PCI.REQUEST or PCI.REPLY.
public static Document readRequest(Properties props,
String filename)
props - Properties object to lookup properties infilename - Filename of file containing XML request
public static Element createElement(Document owner,
String nsURI,
String elementName,
String textValue)
owner - Document object to own the Element object.nsURI - Namespace URI to use.elementName - local name of Element object to create.textValue - text value of the new Element object.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||