|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.utils.agent.utils
This class contains utility routines to be used by other classes.
| Field Summary | |
static AgentErrorListener |
ael
variable having the reference to the user implemented AgentErrorListener. |
static int |
CRITICAL
Deprecated. this will be no longer needed due to logging. Constant for critical debug messages. |
(package private) static boolean |
DEBUG
|
static int |
debugLevel
Deprecated. this will be no longer needed due to logging. variable having debugLevel , by defaullt FATAL. |
static int |
FATAL
Deprecated. this will be no longer needed due to logging. Constant for fatal debug messages. |
static int |
MESSAGE_TRACE
Deprecated. this will be no longer needed due to logging. Constant for message tracing debug messages. API users doesn't need to use this. |
static int |
METHOD_TRACE
Deprecated. this will be no longer needed due to logging. Constant for method tracing debug messages. API users doesn't need to use this. |
static int |
NON_CRITICAL
Deprecated. this will be no longer needed due to logging. Constant for non-critical debug messages. |
(package private) static boolean |
setupStdOutErrDone
|
| Constructor Summary | |
utils()
The Default Constructor. |
|
| Method Summary | |
static long[] |
addArrays(java.lang.Object objArray1,
java.lang.Object objArray2)
Concatenates two long arrays and returns Long Array. |
static int[] |
addIntArrays(java.lang.Object objArray1,
java.lang.Object objArray2)
Concatenates two int arrays into one Int array. |
static int[] |
addLongArraysReturnInt(java.lang.Object objArray1,
java.lang.Object objArray2)
Concatenates two long array to one int array. |
static void |
arraycopy(byte[] from,
int index1,
int[] toCopy,
int index2,
int endIndex)
Copies the contents of the byte[] from from the starting index index1 to the int[] toCopy from the starting index index2 upto a length of endIndex. |
static void |
arraycopy(int[] from,
int index1,
byte[] toCopy,
int index2,
int endIndex)
Copies the contents of the int[] from from the starting index index1 to the byte[] toCopy from the starting index index2 upto a length of endIndex. |
static java.lang.String |
arrayToString(java.lang.Object longarray)
Converts long integer OID array to string OID. |
static java.lang.String |
changeToSystemURL(java.lang.String myString)
Utility method to convert the filePath String with file separators to String with System based File separator |
static boolean |
checkFilePerms(java.lang.String fileName,
java.lang.String access)
checks the file for the appropriate access. |
static int |
compareTo(byte[] byte1,
byte[] byte2)
Compares two byte arrays |
static int |
compareTo(int[] oid1,
int[] oid2)
Compares two Integer arrays |
static int |
compareTo(java.lang.String theString,
java.lang.String toCompare)
The Method compares two Strings. |
static int |
compareToWithMinSize(int[] oid1,
int[] oid2)
This Method Compares Two int Arrays by considering the size of the arrays. |
static void |
debugPrintHigh(java.lang.Object str)
Deprecated. this will be no longer needed due to logging. debugPrint method for FATAL messages. |
static void |
debugPrintLow(java.lang.Object str)
Deprecated. this will be no longer needed due to logging. debugPrint method for NON_CRITICAL messages. |
static void |
debugPrintMedium(java.lang.Object str)
Deprecated. this will be no longer needed due to logging. debugPrint method for CRITICAL messages. |
static long[] |
diffOfArrays(java.lang.Object objLongArray,
java.lang.Object objShortArray)
Difference between two long Arrays useful for getting instance OID etc. |
static int[] |
diffOfIntArrays(java.lang.Object objIntArray,
java.lang.Object objIntSmallArray)
Difference between two int Arrays useful for getting instance OID etc. |
static int |
get_input(java.lang.String mesg)
This method is to get back the input given in the console. |
static java.lang.String[] |
getArray(java.lang.String str,
java.lang.String delim)
Utility method to split a String with a specified delimiter to separate array elements based on the delimiter |
static java.math.BigInteger |
getBigIntegerFromArray(long[] arr)
Converts the long[] to it's equivalent BigInteger value. |
static java.lang.String |
getCalendarDateAndTime()
Gets The Current Day Date Time from the Calendar. |
static boolean |
getDebug()
Deprecated. this will be no longer needed due to logging. Gets the debug flag. |
static int |
getDebugLevel()
Deprecated. this will be no longer needed due to logging. Gets the value of debugLevel whether FATAL(1) or CRITICAL(2) or NON_CRITICAL(3). |
static java.lang.String |
getDebugLevelString()
Deprecated. this will be no longer needed due to logging. Getter for the debugLevel in String. |
static int |
getInt()
Gets integer from the system input. |
static java.lang.String |
getLine()
Gets string from the system input. |
static java.lang.String |
getLine(java.lang.String tmp)
Gets string from the system input. |
static long[] |
getLongArray(long val)
Splits the long value to long array with two elements. |
static long[] |
getLongArray(java.lang.Object toReturn)
Utility method used in handling Counter64 dataType. |
static java.lang.Long |
getLongFromArray(long[] arr)
Converts a long[] array to Long. |
static byte[] |
getMaskBytes(java.lang.String str)
static method to get the byte Array representation of the Mask Type used in V3 Tables. |
static java.lang.String |
getMaskString(byte[] array)
static method to get the String representation of the Mask Type retruned by V3 Tables. |
(package private) static int |
getMinSize(byte[] oid1,
byte[] oid2)
|
(package private) static int |
getMinSize(int[] oid1,
int[] oid2)
|
static int[] |
getNextInstance(java.util.Vector entryVector,
int[] currentInstance)
Returns the next Instance (int[]) from the entryVector. |
static void |
handleError(java.lang.Exception e)
Gives away any errors thrown from the agent to the AgentErrorListener. |
static void |
handleWarning(java.lang.Exception e)
Gives away any harmless exceptions thrown from the agent to the AgentErrorListener. |
static java.lang.String |
intArrayToString(int[] longarray)
converts int array to string OID. |
static java.lang.String |
integerArrayToString(java.lang.Object integerArr)
Converts integer array to String. |
static boolean |
isInSubTree(int[] rootoid,
int[] oid)
Checks whether the OID falls under the rootOID tree. |
(package private) static boolean |
isLessThan(int[] obj1,
int[] obj2)
|
static void |
killAll()
kills all threads in the currently running thread's threadgroup |
static void |
messageTrace(java.lang.Object str)
Deprecated. this will be no longer needed due to logging. debugPrint method for MESSAGE_TRACE messages. API users doesn't need to call this. |
static void |
methodTrace(java.lang.Object str)
Deprecated. this will be no longer needed due to logging. debugPrint method for METHOD_TRACE messages. API users doesn't need to call this. |
static int |
min(int a,
int b,
int c)
Finds minimum of 3 integers. |
static boolean |
OIDequals(int[] OID1,
int[] OID2)
Checks to see if two integer OID's are equal. |
static boolean |
OIDequals(long[] OID1,
long[] OID2)
Checks to see if two long OID's are equal. |
static void |
print(java.lang.Object str)
Method to Print to the standard output. |
static void |
printErr(java.lang.Object str)
Method to Print to standard error. |
static void |
println(java.lang.Object str)
Print line to standard output. |
static void |
printlnErr(java.lang.Object str)
Print line to standard error. |
static void |
printThreads(java.lang.Thread thr)
Prints the argument thread's threadgroup. |
static void |
setAgentErrorListener(AgentErrorListener e)
Setter for the AgentErrorListener. |
static void |
setDebug(boolean val)
Deprecated. this will be no longer needed due to logging. Sets debug ON/OFF. |
static void |
setDebugLevel(int level)
Deprecated. this will be no longer needed due to logging. Sets debugLevel FATAL or CRITICAL or NON_CRITICAL. |
static boolean |
setDebugLevelByString(java.lang.String debugLevel)
Deprecated. this will be no longer needed due to logging. Setter for debugLevel by means of String. |
static void |
setupStdOutErr()
Deprecated. this will be no longer needed due to logging. Makes logs directory for standardoutput and standarderror files. |
static void |
setupStdOutErr(java.io.OutputStream outputStream)
Deprecated. this will be no longer needed due to logging. redirects output to specified output stream |
static void |
setupStdOutErr(java.lang.String dirStr)
Deprecated. this will be no longer needed due to logging. Makes specified directory for standard output and standard error files. |
static void |
setupStdOutErr(java.lang.String dirStr,
java.lang.String oFileName,
java.lang.String eFileName)
Deprecated. this will be no longer needed due to logging. Makes the specified directory and writes the outputs and errors to the specified fileNames. |
static void |
sort(java.util.Vector toSort)
It sorts the elements in the Vector. |
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 long[] |
stringToArray(java.lang.String str)
Converts string OID to array of long data type. |
static int[] |
stringToIntArray(java.lang.String str)
Converts string OID to array of int data type. |
static int[] |
stringToIntegerArray(java.lang.String str)
Converts the given string to integer array. |
(package private) static void |
swap(java.util.Vector x,
int i,
int j)
|
static void |
wait_in()
Waits until any key is pressed. |
static void |
wait_in(java.lang.Object str)
Waits until any key is pressed. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int FATAL
public static final int CRITICAL
public static final int NON_CRITICAL
public static final int METHOD_TRACE
public static final int MESSAGE_TRACE
static boolean setupStdOutErrDone
static boolean DEBUG
public static int debugLevel
public static AgentErrorListener ael
| Constructor Detail |
public utils()
| Method Detail |
public static void setDebug(boolean val)
val - The Value to set (ON/OFF).getDebug().public static boolean getDebug()
setDebug(boolean val).public static void setDebugLevel(int level)
The - DebugLevel to be set (1-FATAL, 2-CRITICAL, 3-NON_CRITICAL).getDebugLevel(),
setDebugLevelByString(String debugLevel)public static int getDebugLevel()
setDebugLevel(int Level)public static boolean setDebugLevelByString(java.lang.String debugLevel)
debugLevel - The debugLevel to be set.setDebugLevel(int level),
getDebugLevelString()public static java.lang.String getDebugLevelString()
setDebugLevel(String debugLevel),
getDebugLevel()public static void debugPrintHigh(java.lang.Object str)
str - The Object that needs to be shown in the console.debugPrintMedium(Object str),
debugPrintLow(Object str)public static void debugPrintMedium(java.lang.Object str)
str - The Object that needs to be shown in the console.debugPrintHigh(Object str),
debugPrintLow(Object str)public static void debugPrintLow(java.lang.Object str)
str - The Object that needs to be shown in the console.debugPrintHigh(Object str),
debugPrintMedium(Object str)public static void methodTrace(java.lang.Object str)
str - The message to be shown on the console.public static void messageTrace(java.lang.Object str)
str - The message to be printed.public static void print(java.lang.Object str)
str - the Object String to be printed.println(Object str),
printErr(Object str),
printlnErr(Object str)public static void println(java.lang.Object str)
str - The Line to be shown in the console.print(Object str),
printErr(Object str),
printlnErr(Object str)public static void printErr(java.lang.Object str)
str - The message to be shown in the console.print(Object str),
println(Object str),
printlnErr(Object str)public static void printlnErr(java.lang.Object str)
str - The message line to be shown in the console.print(Object str),
println(Object str),
printErr(Object str)public static void wait_in()
public static void printThreads(java.lang.Thread thr)
thr - The Thread for which the Thread group is to be printed.public static void killAll()
public static int getInt()
public static java.lang.String getLine()
public static java.lang.String getLine(java.lang.String tmp)
tmp - The system input.
public static boolean checkFilePerms(java.lang.String fileName,
java.lang.String access)
throws FileException
fileName - The fileName for which the access has to be checkedaccess - The access to be checked
public static long[] diffOfArrays(java.lang.Object objLongArray,
java.lang.Object objShortArray)
objLongArray - the Long array.objShortArray - the short array.
public static int[] diffOfIntArrays(java.lang.Object objIntArray,
java.lang.Object objIntSmallArray)
objIntArray - The Integer array.objIntSmallArray - The integer small array.public static java.lang.String arrayToString(java.lang.Object longarray)
longarray - The Long Integer OID array.public static java.lang.String intArrayToString(int[] longarray)
longarray - The integer Array to be converted to String OID.public static long[] stringToArray(java.lang.String str)
str - The String to be converted to long array.public static int[] stringToIntArray(java.lang.String str)
str - The String OID to be transferred to a Int array.public static int[] stringToIntegerArray(java.lang.String str)
str - The String to be converted to integer array.public static java.lang.String integerArrayToString(java.lang.Object integerArr)
integerArr - The Array of integer to be transferred.
public static boolean OIDequals(long[] OID1,
long[] OID2)
OID1 - The First OID.OID2 - The Second OID.
public static boolean OIDequals(int[] OID1,
int[] OID2)
OID1 - The First Integer OID.OID2 - The Second Integer OID.
public static long[] addArrays(java.lang.Object objArray1,
java.lang.Object objArray2)
objArray1 - The First array to be added.objArray2 - The Second array to add.
public static int[] addIntArrays(java.lang.Object objArray1,
java.lang.Object objArray2)
objArray1 - The first Int array.objArray2 - The second Int array.
public static int[] addLongArraysReturnInt(java.lang.Object objArray1,
java.lang.Object objArray2)
objArray1 - The first long Array.objArray2 - The second long Array.public static void wait_in(java.lang.Object str)
str - The String to be shown before pressing a key.
public static int min(int a,
int b,
int c)
a - the First Integer to compare.b - the Second Integer to compare.c - the Third Integer to compare.public static void setupStdOutErr()
setupStdOutErr(String dirStr),
setupStdOutErr(String dirStr, String oFileName, String eFileName),
setupStdOutErr(OutputStream outputStream)public static void setupStdOutErr(java.lang.String dirStr)
dirStr - The directory to which the files are to be createdsetupStdOutErr(),
setupStdOutErr(String dirStr, String oFileName, String eFileName),
setupStdOutErr(OutputStream outputStream)
public static void setupStdOutErr(java.lang.String dirStr,
java.lang.String oFileName,
java.lang.String eFileName)
dirStr - The directory in which to create the filesoFileName - The outputs fileNameeFileName - The errors fileNamesetupStdOutErr(),
setupStdOutErr(String dirStr),
setupStdOutErr(OutputStream outputStream)public static void setupStdOutErr(java.io.OutputStream outputStream)
outputStream - The OutputStream to which the outputs and errors are redirectedsetupStdOutErr(String dirStr),
setupStdOutErr(String dirStr, String oFileName, String eFileName),
setupStdOutErr()public static java.lang.String getCalendarDateAndTime()
public static boolean isInSubTree(int[] rootoid,
int[] oid)
rootoid - The OID of the Root.oid - the OID to be checked.public static long[] getLongArray(java.lang.Object toReturn)
toReturn - The Long object to be splitted into long Array of two elements.getLongFromArray(long[] arr)public static long[] getLongArray(long val)
val - The long value to be splitted.public static java.lang.Long getLongFromArray(long[] arr)
arr - The long array of length 2 to be converted to the corresponding Long ObjectgetLongArray(Object toReturn)public static java.math.BigInteger getBigIntegerFromArray(long[] arr)
arr - the long[] to be converted.public static void setAgentErrorListener(AgentErrorListener e)
e - The AgentError Listener to be set.public static void handleError(java.lang.Exception e)
e - The exception type to be handled.public static void handleWarning(java.lang.Exception e)
e - The exception type to be handled.public static int get_input(java.lang.String mesg)
mesg - The message to be given as the input.public static void sort(java.util.Vector toSort)
toSort - the TableEntry vector which to be sorted in
ascending order according to the instanceOID.
static void swap(java.util.Vector x,
int i,
int j)
static boolean isLessThan(int[] obj1,
int[] obj2)
public static int compareTo(int[] oid1,
int[] oid2)
oid1 - array of integer of oidoid2 - array of integer of oid
public static int compareTo(byte[] byte1,
byte[] byte2)
byte1 - array of bytesbyte2 - array of bytes
static int getMinSize(int[] oid1,
int[] oid2)
static int getMinSize(byte[] oid1,
byte[] oid2)
public static java.lang.String[] getArray(java.lang.String str,
java.lang.String delim)
str - The string to be splitdelim - The delimiter based on which the String is to be splitpublic static java.lang.String changeToSystemURL(java.lang.String myString)
myString - The string to be converted to system based File path
public static void arraycopy(byte[] from,
int index1,
int[] toCopy,
int index2,
int endIndex)
from - the source byte array which needs to
be copied.index1 - the starting index of the source array.toCopy - the int[] to which the contents needs
to be copied.index2 - the starting index of the destination array.endIndex - the length of the bytes to be copied to the
int array.
public static void arraycopy(int[] from,
int index1,
byte[] toCopy,
int index2,
int endIndex)
from - the source byte array which needs to
be copied.index1 - the starting index of the source array.toCopy - the byte[] to which the contents needs
to be copied.index2 - the starting index of the destination array.endIndex - the length of the bytes to be copied to the
int array.
public static int[] getNextInstance(java.util.Vector entryVector,
int[] currentInstance)
entryVector - the vector which contains all
the instances.currentInstance - the currentInstanceOID.public static java.lang.String stringFirstCharToUpper(java.lang.String toChange)
toChange - string to convertpublic static java.lang.String stringFirstCharToLower(java.lang.String toChange)
toChange - string to convert
public static int compareTo(java.lang.String theString,
java.lang.String toCompare)
theString - The First String to Compare.toCompare - The String that is to be compared.
public static int compareToWithMinSize(int[] oid1,
int[] oid2)
oid1 - the first oid int[]oid2 - the second oid int[]public static byte[] getMaskBytes(java.lang.String str)
str - the Mask Type String.getMaskString(byte[] array)public static java.lang.String getMaskString(byte[] array)
array - the Mask Type byte [] representation.getMaskBytes(String str)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||