com.ibm.websphere.wim.util
Class Routines

java.lang.Object
  extended by com.ibm.websphere.wim.util.Routines

public class Routines
extends java.lang.Object

Routines class is used to specify functions which can be used for variety of reasons, mostly consists of helper functions.

Version:
1.0

Constructor Summary
Routines()
           
 
Method Summary
static java.lang.Object[] arrayCopy(java.lang.Object[] inArray)
           
static java.util.HashSet convertListToSet(java.util.List list)
           
static void enterMethod(java.util.logging.Logger trcLogger, java.lang.String className, java.lang.String methodName, java.util.logging.Level level)
           
static void enterParamsMethod(java.util.logging.Logger trcLogger, java.lang.String className, java.lang.String methodName, java.util.logging.Level level, java.lang.Object[] params)
           
static void exitMethod(java.util.logging.Logger trcLogger, java.lang.String className, java.lang.String methodName, java.util.logging.Level level)
           
static void exitResultMethod(java.util.logging.Logger trcLogger, java.lang.String className, java.lang.String methodName, java.util.logging.Level level, java.lang.Object result)
           
static java.lang.String getErrorMessage(java.lang.Throwable e)
          Converts an error message with the stack trace into a String format.
static java.lang.String getMSG(java.util.ResourceBundle rb, java.lang.String key)
          Get message from a resource bundle, return null if not found.
static java.lang.String getMSGorKEY(java.util.ResourceBundle rb, java.lang.String key)
          Get message from a resource bundle, return message key if not found.
static int getPropertyIntValue(java.lang.String value, int defaultValue)
          Between a default value and a String value, this function returns a int value.
static long getPropertyLongValue(java.lang.String value, long defaultValue)
          Between a default value and a String value, this function returns a long value.
static java.util.ResourceBundle getResourceBundle(java.lang.String resourceBundleName)
          Get Resource Bundle
static java.util.Locale getServerLocale()
          Returns the server's Locale.
static java.lang.String getUniqueID()
          Returns a Unique Identifier
static void logException(java.util.logging.Logger trcLogger, java.lang.String sourceClass, java.lang.String sourceMethod, java.util.logging.Level level, java.lang.String msg, java.lang.Throwable exception)
           
static void logMessage(java.util.logging.Logger trcLogger, java.lang.String sourceClass, java.lang.String sourceMethod, java.util.logging.Level level, java.lang.String msg)
           
static java.lang.String[] stringArrayCopy(java.lang.String[] inArray)
           
static byte[] toByteArray(java.lang.Object object)
           
static java.lang.Object toObject(byte[] byteArray)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Routines

public Routines()
Method Detail

getResourceBundle

public static java.util.ResourceBundle getResourceBundle(java.lang.String resourceBundleName)
Get Resource Bundle

Parameters:
resourceBundleName - Name of resource bundle
Return:
Resource Bundle (or null if not found)

getMSG

public static java.lang.String getMSG(java.util.ResourceBundle rb,
                                      java.lang.String key)
Get message from a resource bundle, return null if not found.

Parameters:
rb - Resource Boundle
key - Message Key
Return:
String containing message from resource boundle. If the message is not found, then return null.

getMSGorKEY

public static java.lang.String getMSGorKEY(java.util.ResourceBundle rb,
                                           java.lang.String key)
Get message from a resource bundle, return message key if not found.

Parameters:
rb - Resource Boundle
key - Message Key
Return:
String containing message from resource boundle. If the message is not found, then return the message key.

getServerLocale

public static java.util.Locale getServerLocale()
Returns the server's Locale. If we have a language resource bundle for the operating system locale use that Locale, otherwise use the default Locale which is English. It is calculated once per classloader...

Return:
Locale object based upon the current OS Locale

getErrorMessage

public static java.lang.String getErrorMessage(java.lang.Throwable e)
Converts an error message with the stack trace into a String format.

Parameters:
Throwable - Exception that is used to convert to a String
Return:
String stack trace from the exception

getPropertyIntValue

public static int getPropertyIntValue(java.lang.String value,
                                      int defaultValue)
Between a default value and a String value, this function returns a int value.

Parameters:
String - int in string format
int - value that is given
Return:
String stack trace from the exception

getPropertyLongValue

public static long getPropertyLongValue(java.lang.String value,
                                        long defaultValue)
Between a default value and a String value, this function returns a long value.

Parameters:
String - long in string format
long - value that is given
Return:
String stack trace from the exception

getUniqueID

public static java.lang.String getUniqueID()
Returns a Unique Identifier

Return:
String Unique identifier

enterMethod

public static void enterMethod(java.util.logging.Logger trcLogger,
                               java.lang.String className,
                               java.lang.String methodName,
                               java.util.logging.Level level)

exitMethod

public static void exitMethod(java.util.logging.Logger trcLogger,
                              java.lang.String className,
                              java.lang.String methodName,
                              java.util.logging.Level level)

enterParamsMethod

public static void enterParamsMethod(java.util.logging.Logger trcLogger,
                                     java.lang.String className,
                                     java.lang.String methodName,
                                     java.util.logging.Level level,
                                     java.lang.Object[] params)

exitResultMethod

public static void exitResultMethod(java.util.logging.Logger trcLogger,
                                    java.lang.String className,
                                    java.lang.String methodName,
                                    java.util.logging.Level level,
                                    java.lang.Object result)

logMessage

public static void logMessage(java.util.logging.Logger trcLogger,
                              java.lang.String sourceClass,
                              java.lang.String sourceMethod,
                              java.util.logging.Level level,
                              java.lang.String msg)

logException

public static void logException(java.util.logging.Logger trcLogger,
                                java.lang.String sourceClass,
                                java.lang.String sourceMethod,
                                java.util.logging.Level level,
                                java.lang.String msg,
                                java.lang.Throwable exception)

convertListToSet

public static java.util.HashSet convertListToSet(java.util.List list)

toByteArray

public static byte[] toByteArray(java.lang.Object object)
                          throws java.lang.Exception
Throws:
java.lang.Exception

toObject

public static java.lang.Object toObject(byte[] byteArray)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

arrayCopy

public static java.lang.Object[] arrayCopy(java.lang.Object[] inArray)

stringArrayCopy

public static java.lang.String[] stringArrayCopy(java.lang.String[] inArray)