|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.novell.nds.dirxml.driver.xds.util.XDSUtil
A utilities library for DirXML driver developers.
| Method Summary | |
static void |
appendNode(Node dest,
Node src)
Appends a DOM source node as a child of a DOM destination node. |
static boolean |
appendStackTrace(Exception e)
Used to determine whether a stack trace should be appended to a status document. |
static XDSStatusElement |
appendStatus(StatusDocument doc,
StatusAttributes attrs,
String description)
Appends a <status> element to a DOM document. |
static XDSStatusElement |
appendStatus(StatusDocument doc,
StatusAttributes attrs,
String description,
Exception exception,
boolean stack,
com.novell.nds.dirxml.driver.XmlDocument xml)
Appends one or more <status> elements to a DOM
document. |
static void |
appendThrowable(Element root,
Throwable t,
boolean appendStackTrace)
Appends a Throwable object to the passed element. |
static void |
appendXML(Element element,
String xml)
Translates an XML string into a DOM and appends it the passed DOM element. |
static void |
checkArg(String argName,
Object argValue,
int position)
Throws an IllegalArgumentException if the passed argument
value is null. |
static void |
checkArg(String argName,
String argValue,
int position)
Throws an IllegalArgumentException if the passed argument
value is null. |
static void |
getChildElements(Element parent,
List elements)
Returns the child elements of the passed element. |
static void |
getChildNodes(Element parent,
int nodeType,
List nodes)
Returns the children of the passed element of the passed type. |
static String |
getChildText(Element someElement)
Returns a string that contains the concatenated child/subordinates text nodes of the passed DOM element. |
static void |
getChildTextNodes(Element parent,
List textNodes)
Returns the child text nodes of the passed element. |
static Node |
getFirst(NodeList list)
Returns the fist Node in a NodeList. |
static String |
getRDN(String slashSrcDN)
Extracts the Relative Distinguished Name (RDN) from a slash-formatted Distinguished Name (DN). |
static String |
getStackTrace(Throwable t)
Returns a Throwable object's stack trace as a string. |
static boolean |
isChildOfInputOrOutput(Element element)
Is the passed element a proper child of input or output. |
static boolean |
isInputOrOutputElement(Element element)
Is the passed element an input or output element? |
static boolean |
isNDSElement(Element element)
Is the passed element an nds? |
static boolean |
isNullOrEmpty(NodeList list)
Is the passed NodeList null or empty? |
static boolean |
isNullOrEmpty(com.novell.nds.dirxml.driver.XmlDocument xml)
Is the passed XmlDocument null or empty? |
static boolean |
isValue(String string)
Is the passed string not null and not just whitespace? |
static boolean |
isWhitespace(String s)
Does the passed string contain only whitespace characters? |
static boolean |
noValue(String string)
Is null or whitespace? |
static long |
toMillis(int seconds)
Converts seconds to milliseconds. |
static String |
toNull(String someValue)
Turns an all whitespace string into null. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static boolean isChildOfInputOrOutput(Element element)
element - may be null
true if it is; false otherwisepublic static final boolean isInputOrOutputElement(Element element)
element - may be null
true if it is; false otherwisepublic static final boolean isNDSElement(Element element)
element - may be null
true if it is; false otherwisepublic static String getStackTrace(Throwable t)
Throwable object's stack trace as a string.
t - may be null
t's stack trace; "" if t
is null; will not return nullpublic static long toMillis(int seconds)
seconds - the number of seconds
public static XDSStatusElement appendStatus(StatusDocument doc,
StatusAttributes attrs,
String description)
<status> element to a DOM document.
doc - the doc to append to; must not be nullattrs - status attribute values; may be nulldescription - text for <description> element; may be
null
null
public static XDSStatusElement appendStatus(StatusDocument doc,
StatusAttributes attrs,
String description,
Exception exception,
boolean stack,
com.novell.nds.dirxml.driver.XmlDocument xml)
<status> elements to a DOM
document.
doc - the doc to append to; may be nullattrs - status attribute values; may be nulldescription - text for <description> element; may be
null; if null, the message from
exception is usedexception - may be nullstack - append a stack trace of exception?xml - the XML document to append; may be null
null
public static void appendXML(Element element,
String xml)
String must not contain
illegal XML characters (i.e., '<' and '?').
element - the parent; may be nullxml - the XML to append; may be null
public static final void appendThrowable(Element root,
Throwable t,
boolean appendStackTrace)
Throwable object to the passed element.
root - the element to append to; may be nullt - may be nullappendStackTrace - should the stack trace be appended?
public static void appendNode(Node dest,
Node src)
dest - the parent node; may be nullsrc - the node to append append under dest;
dest can be from a different document than
srcpublic static boolean appendStackTrace(Exception e)
In general, a stack trace is only useful if an exception runtime exception (e.g., NullPointerException) is thrown.
e - may be null
true:false:public static boolean isWhitespace(String s)
s - the string to test; may be null
true if empty string or s is
whitespace; false if s is
null or contains a non-whitespace characterpublic static final boolean isValue(String string)
null and not just whitespace?
string - the string to evaluate; may be null
true if non-null or contains
characters other than whitespace; false otherwisepublic static final boolean noValue(String string)
null or whitespace?
string - the string to evaluate; may be null
true if null or contains characters
only whitespace characters; false otherwisepublic static String toNull(String someValue)
null.
someValue - may be null
public static String getChildText(Element someElement)
someElement - must not be null
null; will not return empty stringpublic static final boolean isNullOrEmpty(NodeList list)
NodeList null or empty?
list - may be null
true if it is; false otherwisepublic static final Node getFirst(NodeList list)
Node in a NodeList.
list - may be null
null
public static void getChildElements(Element parent,
List elements)
parent - must not be nullelements - must not be null;
will be empty after this method is invoked if there are no
child elements
public static void getChildTextNodes(Element parent,
List textNodes)
parent - must not be nulltextNodes - must not be null;
will be empty after this method is invoked if there are no
child text nodes
public static void getChildNodes(Element parent,
int nodeType,
List nodes)
parent - must not be nullnodeType - should be a standard node typenodes - must not be null;
will be empty after this method is invoked if there are no
matching child node types
public static final void checkArg(String argName,
Object argValue,
int position)
IllegalArgumentException if the passed argument
value is null.
argName - the name of the argumentargValue - the value of the argumentposition - the position of the argument
IllegalArgumentException - when argValue is null
public static final void checkArg(String argName,
String argValue,
int position)
IllegalArgumentException if the passed argument
value is null.
argName - the name of the argumentargValue - the value of the argumentposition - the position of the argument
IllegalArgumentException - when argValue is nullpublic static final String getRDN(String slashSrcDN)
slashSrcDN - a slash-formatted DN
nullpublic static boolean isNullOrEmpty(com.novell.nds.dirxml.driver.XmlDocument xml)
XmlDocument null or empty?
xml - the document; may be null
true if xml is null or there's no
document element; false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||