public class Utility
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ENVIRONMENT
Environment information.
|
static java.lang.String |
VERSION
Version number of this release.
|
| Modifier and Type | Method and Description |
|---|---|
static org.w3c.dom.Element |
createElement(org.w3c.dom.Document owner,
java.lang.String nsURI,
java.lang.String elementName,
java.lang.String textValue)
Creates an Element object in the CyberSource namespace.
|
static org.w3c.dom.Element |
getElement(org.w3c.dom.Document owner,
java.lang.String elementName,
java.lang.String nsURI)
Returns the Element object corresponding to the given element name.
|
static java.lang.String |
getElementText(org.w3c.dom.Document owner,
java.lang.String elementName,
java.lang.String nsURI)
Returns the text value of the given element name in the CyberSource
namespace.
|
static java.lang.String |
getStackTrace(java.lang.Exception e)
Returns the stack trace of the supplied Exception object.
|
static java.lang.String |
mapToString(java.util.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 javax.xml.parsers.DocumentBuilder |
newDocumentBuilder()
Returns a DocumentBuilder object.
|
static java.lang.String |
nodeToString(org.w3c.dom.Node node)
Returns the string representation of the given Node object.
|
static java.lang.String |
nodeToString(org.w3c.dom.Node node,
int type)
Returns the string representation of the given Node object.
|
static byte[] |
read(java.io.File file)
Reads the content of the given file into a byte array.
|
static byte[] |
read(java.io.InputStream in)
Reads the content of the given file into a byte array.
|
static byte[] |
read(java.lang.String filename)
Reads the content of the given file into a byte array.
|
static java.util.Properties |
readProperties(java.lang.String[] commandLineArgs)
Reads the properties from a file.
|
static org.w3c.dom.Document |
readRequest(java.util.Properties props,
java.lang.String filename)
Read the request xml file
|
static java.util.HashMap |
stringToMap(java.lang.String src)
Converts a name-value pair string into a Map object.
|
public static final java.lang.String VERSION
public static final java.lang.String ENVIRONMENT
public static java.lang.String nodeToString(org.w3c.dom.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 java.lang.String nodeToString(org.w3c.dom.Node node)
node - the Node object whose string representation is wanted.public static java.util.Properties readProperties(java.lang.String[] commandLineArgs)
commandLineArgs - the command-line arguments.public static byte[] read(java.lang.String filename)
throws java.io.IOException
filename - name of the file to read.java.io.IOException - if there was an error reading the file.public static byte[] read(java.io.File file)
throws java.io.IOException
file - File object to read.java.io.IOException - if there was an error reading the file.public static byte[] read(java.io.InputStream in)
throws java.io.IOException
in - InputStream object to read.java.io.IOException - if there was an error reading the file.public static javax.xml.parsers.DocumentBuilder newDocumentBuilder()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException - if no suitable parser
implementation is found.public static org.w3c.dom.Element getElement(org.w3c.dom.Document owner,
java.lang.String elementName,
java.lang.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 java.lang.String getElementText(org.w3c.dom.Document owner,
java.lang.String elementName,
java.lang.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 java.lang.String getStackTrace(java.lang.Exception e)
e - Exception object.public static java.util.HashMap stringToMap(java.lang.String src)
src - String containing name-value pairs.public static java.lang.String mapToString(java.util.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 org.w3c.dom.Document readRequest(java.util.Properties props,
java.lang.String filename)
props - Properties object to lookup properties infilename - Filename of file containing XML requestpublic static org.w3c.dom.Element createElement(org.w3c.dom.Document owner,
java.lang.String nsURI,
java.lang.String elementName,
java.lang.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.Copyright © 2018. All Rights Reserved.