org.jboss.security.util
Class Tools

java.lang.Object
  extended by org.jboss.security.util.Tools

public class Tools
extends java.lang.Object

A general utitity class

Author:
Sohil Shah - sohil.shah@jboss.com - May 30, 2006

Constructor Summary
Tools()
           
 
Method Summary
static java.lang.String encodeHex(byte[] bytes)
          Returns a hex encoded String representing the input byte array
static java.lang.String escapeStr(java.lang.String xml)
          cleans up the xml
static byte[] getBytes(java.io.InputStream is)
          Extracts a byte array from an InputStream
static java.lang.String getEncodedPassword(java.lang.String clearPassword, java.lang.String hashAlgorithm)
          Returns a one way hashed password based on the specified algorithm
static boolean isCookieFound(javax.servlet.http.HttpServletRequest request, java.lang.String cookieName)
          Checks if an SSOToken is sent in as a cookie on the http request
static boolean isEmpty(java.util.Collection cour)
          Checks if this is an empty collection
static boolean isEmpty(java.lang.Object[] cour)
          Checks if this is an empty array
static boolean isEmpty(java.lang.String cour)
          Checks if this is an empty string
static org.w3c.dom.Document parseXml(java.io.InputStream is)
          parses an xml file and creates a DOM tree
static java.lang.String replaceStr(java.lang.String source, java.lang.String toBeReplaced, java.lang.String replaceWith)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

getEncodedPassword

public static java.lang.String getEncodedPassword(java.lang.String clearPassword,
                                                  java.lang.String hashAlgorithm)
                                           throws java.lang.Exception
Returns a one way hashed password based on the specified algorithm

Parameters:
clearPassword -
hashAlgorithm -
Returns:
Throws:
java.lang.Exception

encodeHex

public static java.lang.String encodeHex(byte[] bytes)
Returns a hex encoded String representing the input byte array

Parameters:
bytes -
Returns:
a hex encoded String

isCookieFound

public static boolean isCookieFound(javax.servlet.http.HttpServletRequest request,
                                    java.lang.String cookieName)
Checks if an SSOToken is sent in as a cookie on the http request

Parameters:
request -
cookieName -
Returns:

escapeStr

public static java.lang.String escapeStr(java.lang.String xml)
cleans up the xml

Parameters:
xml -
Returns:

isEmpty

public static boolean isEmpty(java.lang.String cour)
Checks if this is an empty string

Parameters:
cour -
Returns:

isEmpty

public static boolean isEmpty(java.lang.Object[] cour)
Checks if this is an empty array

Parameters:
cour -
Returns:

isEmpty

public static boolean isEmpty(java.util.Collection cour)
Checks if this is an empty collection

Parameters:
cour -
Returns:

parseXml

public static org.w3c.dom.Document parseXml(java.io.InputStream is)
                                     throws java.lang.Exception
parses an xml file and creates a DOM tree

Parameters:
is -
Returns:
Throws:
java.lang.Exception

getBytes

public static byte[] getBytes(java.io.InputStream is)
                       throws java.lang.Exception
Extracts a byte array from an InputStream

Parameters:
is -
Returns:
Throws:
java.lang.Exception

replaceStr

public static java.lang.String replaceStr(java.lang.String source,
                                          java.lang.String toBeReplaced,
                                          java.lang.String replaceWith)
Parameters:
source -
tobeReplaced -
replaceWith -
Returns: