|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.utilities.common.CommonUtils
This class contains the Utility Methods which can be used for both Snmp and JMX agents.
| Field Summary | |
static int |
_CLASS
Constant for CLASS-COMMAND |
static int |
_CORBA
Constant for CORBA-COMMAND |
static int |
_DATABASE
Constant for DATABASE-COMMAND |
static int |
_FILE
Constant for FILE-COMMAND |
static int |
_PROXY
Constant for PROXY-COMMAND |
static int |
_READ
Constant for READ-COMMAND |
static int |
_SIMULATE
Constant for SIMULATE-COMMAND |
static int |
_WRITE
Constant for WRITE-COMMAND |
static byte |
AUTHORIZATIONERROR
SNMP error value for Authorization Failure. |
static byte |
BADVALUE
SNMP error value for Bad Values. |
static byte |
COMMITFAILED
SNMP error value for Commit Failure. |
(package private) static boolean |
DEBUG
|
static byte |
GENERR
SNMP error value for General Errors. |
static byte |
INCONSISTENTNAME
SNMP error value for Inconsistent Names. |
static byte |
INCONSISTENTVALUE
SNMP error value for Inconsistent Values. |
static byte |
INVALIDEXTERNALINDEX
Table error value if the External Index is not Valid. |
static byte |
INVALIDINDEX
Table error value if the Index is not a Valid one. |
static byte |
MODIFYROWNOTEXIST
Table error value if Modiry Row does not exist. |
static byte |
NOACCESS
SNMP error value if it is Not Accessible. |
static byte |
NOCREATION
SNMP error value for NoCreation. |
static byte |
NOERROR
SNMP error value for No Error. |
static byte |
NOSUCHNAME
SNMP error value for No Such Name. |
static byte |
NOTWRITABLE
SNMP error value if it is Not Writable. |
static byte |
READONLY
SNMP error value for Read Only access. |
static byte |
RESOURCEUNAVAILABLE
SNMP error value if the Resource is not available. |
static byte |
ROWCREATIONFAILED
Table error value if Row Creation has been failed. |
(package private) static boolean |
setupStdOutErrDone
variable having debugLevel , by defaullt FATAL. |
static byte |
TOOBIG
SNMP error value for Too Big. |
static byte |
UNDOFAILED
SNMP error value for Undo Failure. |
static byte |
WRONGENCODING
SNMP error value for Wrong Encoding. |
static byte |
WRONGLENGTH
SNMP error value if the value given is of Wrong Length. |
static byte |
WRONGTYPE
SNMP error value if the value given is of Wrong Type. |
static byte |
WRONGVALUE
SNMP error value for Wrong Values given. |
| Constructor Summary | |
CommonUtils()
Default Constructor. |
|
| Method Summary | |
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)
The Method for cheching the access Permission of a specified File. |
static int |
compareToMinSize(int[] oid_1,
int[] oid_2)
|
static byte[] |
convertBinaryIntArrayToByteArray(int[] intArray)
Converting Binary Integer Array to Byte Array. |
static int[] |
convertByteArrayToBinaryIntArray(byte[] byteArray,
int intArrayLength)
Converting Byte Array to Binary Integer Array. |
static java.lang.Byte[] |
convertbyteArrayToByteArray(byte[] byteObj)
|
static byte[] |
convertByteArrayTobyteArray(java.lang.Byte[] byteObj)
Converts the Byte array to byte Array. |
static java.lang.String |
convertCharacterToString(java.lang.Character charIn)
|
static int[] |
convertHexaToIntArray(java.lang.String str,
int len)
Method to convert Hexa to Int Array. |
static java.lang.String |
convertIntegerArrayToHexa(int[] intArr)
To convert Integer Array to Hexa value. |
static int[] |
convertIntToIntArray(int val)
This method Converts Integer to Integer Array. |
static java.lang.Character |
convertStringToCharacter(java.lang.String charIn)
|
static java.lang.String |
dateString(byte[] datearray)
Converts the byte[] values to String representing the Date and Time. |
static byte[] |
dateStringToByteArray(java.lang.String dateStr)
Converts the String representing the date and time value to byte Array. |
static int |
get_input(java.lang.String mesg)
|
static java.lang.Object |
getAgentReference()
Getter for Agent Reference Object . |
static boolean |
getDebug()
gets debug flag. |
static int |
getMinSize(int[] oid_1,
int[] oid_2)
|
static java.lang.String |
getReadCommandString(java.lang.String command_string,
java.lang.String defaultValue)
getter for Read command String. |
static java.lang.String |
intArrayToString(int[] longarray)
converts int array to string OID. |
static void |
print(java.lang.Object str)
Print to stdout |
static void |
println(java.lang.Object str)
Print line to stdout |
static void |
setAgentReference(java.lang.Object obj)
Setter for Agent Reference Object. |
static void |
setDebug(boolean val)
|
static void |
setupStdOutErr()
makes logs directory for stdout and stderr files |
static void |
setupStdOutErr(java.lang.String dirStr)
makes specified directory for stdout and stderr files |
static void |
setupStdOutErr(java.lang.String dirStr,
java.lang.String oFileName,
java.lang.String eFileName)
Makes the specified directory and writes the outputs and errors to the specified fileNames. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final byte NOERROR
public static final byte TOOBIG
public static final byte NOSUCHNAME
public static final byte BADVALUE
public static final byte READONLY
public static final byte GENERR
public static final byte NOACCESS
public static final byte WRONGTYPE
public static final byte WRONGLENGTH
public static final byte WRONGENCODING
public static final byte WRONGVALUE
public static final byte NOCREATION
public static final byte INCONSISTENTVALUE
public static final byte RESOURCEUNAVAILABLE
public static final byte COMMITFAILED
public static final byte UNDOFAILED
public static final byte AUTHORIZATIONERROR
public static final byte NOTWRITABLE
public static final byte INCONSISTENTNAME
public static final byte MODIFYROWNOTEXIST
public static final byte ROWCREATIONFAILED
public static final byte INVALIDEXTERNALINDEX
public static final byte INVALIDINDEX
public static final int _READ
public static final int _WRITE
public static final int _FILE
public static final int _CLASS
public static final int _PROXY
public static final int _SIMULATE
public static final int _DATABASE
public static final int _CORBA
static boolean DEBUG
static boolean setupStdOutErrDone
| Constructor Detail |
public CommonUtils()
| Method Detail |
public static void setDebug(boolean val)
public static boolean getDebug()
setDebug(boolean val).
public static int[] convertByteArrayToBinaryIntArray(byte[] byteArray,
int intArrayLength)
byteArray - The array of bytes to be converted as Binary int arrayintArrayLength - The resultant integer.public static byte[] convertBinaryIntArrayToByteArray(int[] intArray)
intArray - The Binary Integer Array to be converted.public static int[] convertIntToIntArray(int val)
val - The Integer value for conversion.
public static int[] convertHexaToIntArray(java.lang.String str,
int len)
str - The String Value.len - The Length of the string.public static java.lang.String convertIntegerArrayToHexa(int[] intArr)
intArr - The input Integer Array.public static int get_input(java.lang.String mesg)
public static java.lang.String dateString(byte[] datearray)
throws java.lang.Exception
datearray - the array of bytes to be returned as a String representing
the Date and Time.The length of the array should be 8 or 11
public static byte[] convertByteArrayTobyteArray(java.lang.Byte[] byteObj)
throws java.lang.Exception
byteObj - converted to the byte[].
public static java.lang.Byte[] convertbyteArrayToByteArray(byte[] byteObj)
throws java.lang.Exception
public static java.lang.Character convertStringToCharacter(java.lang.String charIn)
throws java.lang.Exception
public static java.lang.String convertCharacterToString(java.lang.Character charIn)
throws java.lang.Exception
public static byte[] dateStringToByteArray(java.lang.String dateStr)
throws java.lang.Exception
dateStr - the String representing the Date and Time that is to be
converted to the byte[].
public static boolean checkFilePerms(java.lang.String fileName,
java.lang.String access)
fileName - The File Name to be checked.access - The access value looking for.
public static java.lang.String getReadCommandString(java.lang.String command_string,
java.lang.String defaultValue)
command_string - the command to be executed eg. netstat $valuedefaultValue - the options for the command eg. -anpublic static void setAgentReference(java.lang.Object obj)
obj - the main file reference.public static java.lang.Object getAgentReference()
public static void print(java.lang.Object str)
println(Object str),
printErr(Object str),
printlnErr(Object str)public static void println(java.lang.Object str)
print(Object str),
printErr(Object str),
printlnErr(Object str)public static java.lang.String changeToSystemURL(java.lang.String myString)
myString - The string to be converted to system based File pathpublic static java.lang.String intArrayToString(int[] longarray)
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 int compareToMinSize(int[] oid_1,
int[] oid_2)
public static int getMinSize(int[] oid_1,
int[] oid_2)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||