oracle.cle.util
Class CLEUtil

java.lang.Object
  |
  +--oracle.cle.util.CLEUtil

public class CLEUtil
extends java.lang.Object

Contains a number of frequently used, static utility methods for developers using the MVC Framework.


Field Summary
static java.lang.ThreadLocal sessionId
          Use this for setting session id per current thread.
 
Constructor Summary
CLEUtil()
           
 
Method Summary
static void appendEntryInLog(java.lang.String fileName, java.lang.String entry)
          Write to a log file specified for the file name with an entry passed in as a String
 double calculateStandardDeviation(java.util.Vector dataSet, boolean sample)
          Returns a Standard Deviation as a double value.
 java.lang.Object defaultInstanceForName(java.lang.String className)
          Returns an instance for the specified classname.
static java.lang.String fitString(java.lang.String aString, int totalCells, boolean padBeginning)
          Fit the specified String into the specified number of cells.
static java.lang.String floatArrayToString(float[] array)
          Returns float Array as a String.
static java.lang.String formatHashtable(java.util.Hashtable aTable)
           
static java.lang.Class forName(java.lang.Class scope, java.lang.String className)
          Load a class for the specified name and scope.
static java.net.HttpURLConnection getDefaultURLConnection(java.lang.String strURL)
          Returns the HttpURLConnection for the specified String or null if a connection could not be made.
static java.io.InputStream getInputStream(java.lang.String fileOrUrlString, java.lang.Class aRelativeClass)
          Returns the InputStream for the specified file.
static java.lang.Double getProcessInfoAsDouble(ProcessInfo info)
          Return process info as Double.
static double getProcessInfoAsDoubleValue(ProcessInfo info)
          Return process info as doubleValue()
static java.lang.Integer getProcessInfoAsInteger(ProcessInfo info)
          Return process info as Integer.
static java.lang.String getRandomString(int stringSize)
          This returns a random generated string with the size specified as the lone parameter.
static java.lang.Object getSessionId()
          This method is used ConnectionManager, ConnectionProvider, DeploymentConnector to get a sessionId when a sessionId not specified by the user.
static java.lang.String getUnicodeRepresentation(char charToConvert)
          Converts a character to its unicode representation
static java.lang.String getUniqueId(Service aService)
          Used to name temp images uniquely for a servlet environment
static java.lang.String getUnqualifiedClassName(java.lang.Class aClass)
          Returns the name of a class with the package stripped from the front of the name.
static java.lang.String getUnqualifiedClassName(java.lang.Object anObject)
          Returns the name of an Object's class with the package stripped from the front of the name.
static void main(java.lang.String[] args)
           
static java.util.Hashtable mergeHashtables(java.util.Vector vectorOfHashtables)
          Takes two Hashtables and returns a merged result.
 java.util.Vector mergeVectors(java.util.Vector vectorOne, java.util.Vector vectorTwo)
          Merges the contents of vectorTwo into vectorOne
static java.lang.String parseString(java.lang.String stringToParse, java.lang.String parseString, java.lang.String replaceString)
          Replaces all occurences of a String with a given String.
static java.util.List parseTokens(java.lang.String aString, java.lang.String delimiter)
          Takes a String and and a delimiter and returns the parsed tokens as a List
static java.lang.String parseURLArgValue(java.lang.String stringToParse)
          Transforms a string to be URL safe.
static java.lang.String[] stringArrayForProcessInfo(ProcessInfo aProcessInfo)
          Used for extracting a String array from a ProcessParameter when we are unsure as to whether the value is a String or a String[].
static java.lang.String[] stringArrayForVector(java.util.Vector aVector)
          Make and return a Vector with the contents of the specified array
static java.lang.String stripExtraSpaces(java.lang.String aString)
          Return a string with extra spaces removed from aString
static java.lang.String stripString(java.lang.String aString, char stripChar)
          Strips the given character from the String
static java.lang.String stripString(java.lang.String aString, char[] chars)
          Strips an array of characters from the String
static java.lang.String stripString(java.lang.String aString, java.lang.String stringToRemove)
          Strips the first occurence of the specified String (arg2) from the String specified in arg1.
static java.lang.String toMixedCase(java.lang.String aString)
          Returns the specified String in its mixed case form.
static java.util.Vector vectorForArray(java.lang.Object[] anArray)
          Make and return a Vector with the contents of the specified array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionId

public static final java.lang.ThreadLocal sessionId
Use this for setting session id per current thread. HttpServletController uses this, for example, to set the session id in this variable for each request. As a result the Handler may call this variable to get the sessionId to pass to the ConnectionManager.

 Usage (for setting):
 CLEUtil.sessionId.set(value);

 Usage (for getting):
  Object value = CLEUtil.sessionId.get();
 

Constructor Detail

CLEUtil

public CLEUtil()
Method Detail

getSessionId

public static java.lang.Object getSessionId()
This method is used ConnectionManager, ConnectionProvider, DeploymentConnector to get a sessionId when a sessionId not specified by the user.

getUnqualifiedClassName

public static java.lang.String getUnqualifiedClassName(java.lang.Object anObject)
Returns the name of an Object's class with the package stripped from the front of the name.

getUnqualifiedClassName

public static java.lang.String getUnqualifiedClassName(java.lang.Class aClass)
Returns the name of a class with the package stripped from the front of the name.

stringArrayForProcessInfo

public static java.lang.String[] stringArrayForProcessInfo(ProcessInfo aProcessInfo)
Used for extracting a String array from a ProcessParameter when we are unsure as to whether the value is a String or a String[]. This happens when we have a group in HTML. The value is a String when one group value is selected, but it is an array of Strings when multiple are selected.

vectorForArray

public static java.util.Vector vectorForArray(java.lang.Object[] anArray)
Make and return a Vector with the contents of the specified array

stringArrayForVector

public static java.lang.String[] stringArrayForVector(java.util.Vector aVector)
                                               throws CLERuntimeException
Make and return a Vector with the contents of the specified array

getProcessInfoAsDoubleValue

public static double getProcessInfoAsDoubleValue(ProcessInfo info)
                                          throws CLERuntimeException
Return process info as doubleValue()

getProcessInfoAsInteger

public static java.lang.Integer getProcessInfoAsInteger(ProcessInfo info)
                                                 throws CLERuntimeException
Return process info as Integer.

getProcessInfoAsDouble

public static java.lang.Double getProcessInfoAsDouble(ProcessInfo info)
                                               throws CLERuntimeException
Return process info as Double.

floatArrayToString

public static java.lang.String floatArrayToString(float[] array)
Returns float Array as a String.

parseURLArgValue

public static java.lang.String parseURLArgValue(java.lang.String stringToParse)
Transforms a string to be URL safe. Pass in only the value of the parameter in a URL, not the entire URL
Parameters:
stringToParse - java.lang.String
Returns:
java.lang.String

getUnicodeRepresentation

public static java.lang.String getUnicodeRepresentation(char charToConvert)
Converts a character to its unicode representation
Parameters:
charToConvert - char
Returns:
java.lang.String

parseString

public static java.lang.String parseString(java.lang.String stringToParse,
                                           java.lang.String parseString,
                                           java.lang.String replaceString)
Replaces all occurences of a String with a given String.
Parameters:
stringToParse - java.lang.String (Target String containg the String that gets replaced)
parseStr - java.lang.String (String that gets replaced)
replaceStr - java.lang.String (String that replaces)
Returns:
java.lang.String

stripString

public static java.lang.String stripString(java.lang.String aString,
                                           java.lang.String stringToRemove)
Strips the first occurence of the specified String (arg2) from the String specified in arg1.

stripString

public static java.lang.String stripString(java.lang.String aString,
                                           char stripChar)
Strips the given character from the String
Parameters:
aString - java.lang.String
stripChar - char
Returns:
java.lang.String

stripString

public static java.lang.String stripString(java.lang.String aString,
                                           char[] chars)
Strips an array of characters from the String
Parameters:
aString - java.lang.String
chars - char[]
Returns:
java.lang.String

stripExtraSpaces

public static java.lang.String stripExtraSpaces(java.lang.String aString)
Return a string with extra spaces removed from aString

fitString

public static java.lang.String fitString(java.lang.String aString,
                                         int totalCells,
                                         boolean padBeginning)
Fit the specified String into the specified number of cells. If padBeginning is true, pad at the beginning, otherwise pad at the end.

toMixedCase

public static java.lang.String toMixedCase(java.lang.String aString)
Returns the specified String in its mixed case form. For example: "blah blah" becomes "Blah Blah". Another examples: "BLAH BLAH" becomes "Blah Blah"

getDefaultURLConnection

public static java.net.HttpURLConnection getDefaultURLConnection(java.lang.String strURL)
Returns the HttpURLConnection for the specified String or null if a connection could not be made.

appendEntryInLog

public static void appendEntryInLog(java.lang.String fileName,
                                    java.lang.String entry)
                             throws CLEException
Write to a log file specified for the file name with an entry passed in as a String

getUniqueId

public static java.lang.String getUniqueId(Service aService)
                                    throws CLEException
Used to name temp images uniquely for a servlet environment

mergeHashtables

public static java.util.Hashtable mergeHashtables(java.util.Vector vectorOfHashtables)
                                           throws CLEException
Takes two Hashtables and returns a merged result.

mergeVectors

public java.util.Vector mergeVectors(java.util.Vector vectorOne,
                                     java.util.Vector vectorTwo)
Merges the contents of vectorTwo into vectorOne

formatHashtable

public static java.lang.String formatHashtable(java.util.Hashtable aTable)

defaultInstanceForName

public java.lang.Object defaultInstanceForName(java.lang.String className)
Returns an instance for the specified classname. Returns null if an instance could not be created.

forName

public static java.lang.Class forName(java.lang.Class scope,
                                      java.lang.String className)
                               throws java.lang.ClassNotFoundException
Load a class for the specified name and scope. In the cases when the active ClassLoader is null, we use Class.forName(), otherwise ClassLoader.loadClass() is used

getRandomString

public static java.lang.String getRandomString(int stringSize)
This returns a random generated string with the size specified as the lone parameter. This generates numbers and letters only

parseTokens

public static java.util.List parseTokens(java.lang.String aString,
                                         java.lang.String delimiter)
Takes a String and and a delimiter and returns the parsed tokens as a List

getInputStream

public static java.io.InputStream getInputStream(java.lang.String fileOrUrlString,
                                                 java.lang.Class aRelativeClass)
                                          throws java.lang.Exception
Returns the InputStream for the specified file. The file can be looked up as a resource with file name specified at root of classpath (no protocol) or via a URL if a protocol is given.
Returns:
java.io.InputStream

calculateStandardDeviation

public double calculateStandardDeviation(java.util.Vector dataSet,
                                         boolean sample)
Returns a Standard Deviation as a double value. Expects a Vector and a boolean that indicates sample or population. If boolean true then sample set used else population.

main

public static void main(java.lang.String[] args)


Copyright © 2003 ORACLE Corp. All Rights Reserved.