com.adventnet.utils.tl1
Class TL1Utils

java.lang.Object
  extended by com.adventnet.utils.tl1.TL1Utils

public class TL1Utils
extends java.lang.Object

This class acts as the Utility class for the intrumentation level of the TL1 Agent.


Field Summary
static int DEBUG
          Constant for "Debug" debug messages
static int DISABLE
          Constant for "Disable" debugging.
static int ERROR
          Constant for "Error" debug messages
static int FATAL
          Constant for "Fatal" debug messages.
static int INFO
          Constant for "Info" debug messages
static int TRACE
          Constant for "Trace" debug messages
static int WARN
          Constant for "Warn" debug messages
 
Constructor Summary
TL1Utils()
          NoArg constructor, currently does nothing.
 
Method Summary
static boolean containsValidAidSeparator(java.lang.String str)
          This method is used to check whether a String contains any one of the valid AID separators.
static java.lang.Object convertStringToObject(java.lang.String type, java.lang.String value)
          Converts the String value to Object of type specified in this methods parameter.
static void debugPrint(int agentDebugLevel, int messageDebugLevel, java.lang.String message)
          This method is used to print the debug messages according to the Debug level.
static java.lang.String findReplace(java.lang.String str, java.lang.String find, java.lang.String replace)
          This method replaces all occurences of the String find in String str with String replace.
static java.util.Vector getAidElements(java.util.Vector aid, java.lang.String[] separators)
          This method is used to seperate the elements in the AID of a TL1 Input message.
static java.lang.String getCurrentDateAndTime()
          This method returns the date and time in a string format.
static long getTotalSeconds(int i)
          This method returns the total number of seconds from January 1970 to the number of days given as parameter from current date.
static boolean isContainsDigit(java.lang.String text)
          This method determines whether any digit is present in a given String.
static boolean isContainsLetter(java.lang.String text)
          This method determines whether any Letter is present in a given String.
static java.util.Hashtable splitNameDefinedObjects(java.util.Vector vec)
          Used to seperate name defined values.
static java.lang.String stringFirstCharToLower(java.lang.String toChange)
          Converts the first character of a string to LowerCase character.
static java.lang.String stringFirstCharToUpper(java.lang.String toChange)
          Converts the first character of a string to UpperCase character.
static boolean validateRequest(java.util.Vector[] values, java.lang.String[][] types)
          This method is used to validate the message payload block.
static boolean validDateTimeCheck(TL1Time time, TL1Date date)
          This method is used to verify wheather the TL1Time and TL1Date are of the correct format.If the condition is satisfied ,returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE

public static final int TRACE
Constant for "Trace" debug messages

See Also:
Constant Field Values

INFO

public static final int INFO
Constant for "Info" debug messages

See Also:
Constant Field Values

DEBUG

public static final int DEBUG
Constant for "Debug" debug messages

See Also:
Constant Field Values

WARN

public static final int WARN
Constant for "Warn" debug messages

See Also:
Constant Field Values

ERROR

public static final int ERROR
Constant for "Error" debug messages

See Also:
Constant Field Values

FATAL

public static final int FATAL
Constant for "Fatal" debug messages.

See Also:
Constant Field Values

DISABLE

public static final int DISABLE
Constant for "Disable" debugging.

See Also:
Constant Field Values
Constructor Detail

TL1Utils

public TL1Utils()
NoArg constructor, currently does nothing.

Method Detail

convertStringToObject

public static java.lang.Object convertStringToObject(java.lang.String type,
                                                     java.lang.String value)
                                              throws java.lang.Exception
Converts the String value to Object of type specified in this methods parameter.

Parameters:
type - the type of the object to be returned.
value - the value from which the returned object is derived.
Throws:
java.lang.Exception - when forming the object with the given value fails.

getAidElements

public static java.util.Vector getAidElements(java.util.Vector aid,
                                              java.lang.String[] separators)
                                       throws java.lang.StringIndexOutOfBoundsException
This method is used to seperate the elements in the AID of a TL1 Input message.

Parameters:
aid - The Vector of TL1Param objects in the AID.
separators - An array of separators used in the AID.
Returns:
A Vector containing the elements alone.
Throws:
java.lang.StringIndexOutOfBoundsException

containsValidAidSeparator

public static boolean containsValidAidSeparator(java.lang.String str)
This method is used to check whether a String contains any one of the valid AID separators.

Parameters:
str - The input String to check
Returns:
true - If it contains a valid AID separator. false - If it doesn't contain.

validateRequest

public static boolean validateRequest(java.util.Vector[] values,
                                      java.lang.String[][] types)
This method is used to validate the message payload block.

Parameters:
values - The request Values as a vector array.
types - The types as a String double-dimension array.

debugPrint

public static void debugPrint(int agentDebugLevel,
                              int messageDebugLevel,
                              java.lang.String message)
This method is used to print the debug messages according to the Debug level.

Parameters:
agentDebugLevel - The debug level set in the agent.
messageDebugLevel - The debug level of the debug message.
message - The debug message.

stringFirstCharToUpper

public static java.lang.String stringFirstCharToUpper(java.lang.String toChange)
Converts the first character of a string to UpperCase character.

Parameters:
toChange - string to convert
Returns:
the converted string.

stringFirstCharToLower

public static java.lang.String stringFirstCharToLower(java.lang.String toChange)
Converts the first character of a string to LowerCase character.

Parameters:
toChange - string to convert
Returns:
the converted string.

isContainsDigit

public static boolean isContainsDigit(java.lang.String text)
This method determines whether any digit is present in a given String. Refer to Character.isDigit() for the digits allowed.

Parameters:
text - The String which has to be checked whether any digit is present.
Returns:
true - The String contains atleast one digit.

isContainsLetter

public static boolean isContainsLetter(java.lang.String text)
This method determines whether any Letter is present in a given String. Refer to Character.isLetter() for the letters allowed.

Parameters:
text - The String which has to be checked whether any letter is present.
Returns:
true - The String contains atleast one letter.

findReplace

public static java.lang.String findReplace(java.lang.String str,
                                           java.lang.String find,
                                           java.lang.String replace)
This method replaces all occurences of the String find in String str with String replace.

Parameters:
str - - original String.
find - - String to find.
replace - - String to replace.
Returns:
the resultant String.

validDateTimeCheck

public static boolean validDateTimeCheck(TL1Time time,
                                         TL1Date date)
This method is used to verify wheather the TL1Time and TL1Date are of the correct format.If the condition is satisfied ,returns true.

Parameters:
time - -TL1Time
date - -TL1Date

getTotalSeconds

public static long getTotalSeconds(int i)
This method returns the total number of seconds from January 1970 to the number of days given as parameter from current date.

Parameters:
days- - the number of days.

getCurrentDateAndTime

public static java.lang.String getCurrentDateAndTime()
This method returns the date and time in a string format.


splitNameDefinedObjects

public static java.util.Hashtable splitNameDefinedObjects(java.util.Vector vec)
Used to seperate name defined values. This method returns a Hashtable with names as keys and the corresponding objects as values.