com.adventnet.services.database
Class DBUtils

java.lang.Object
  extended by com.adventnet.services.database.DBUtils

public class DBUtils
extends java.lang.Object

This class contains utility methods used by the DatabaseAdaptor service.


Constructor Summary
DBUtils()
          Default Constructor for DBUtils
 
Method Summary
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.Object[] getInstanceFromCompositeData(javax.jmx.openmbean.CompositeData data, java.lang.String[] indexNames)
          This method is used to get the object array of indexes from the CompositeData.
static java.lang.String getJavaTypeForDBType(java.lang.String dbColumnType)
          Returns the Java type corresponding to the DataBase type
static javax.jmx.openmbean.CompositeData makeCompositeDataFromRow(java.util.Vector row, java.lang.String[] columnNames, java.lang.String[] columnTypes)
          This method is used to form a CompositeData from a Vector of values.
static java.lang.String[] stringFirstCharToUpper(java.lang.String[] toChange)
          Converts the first character of each element in the string[] to UpperCase character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBUtils

public DBUtils()
Default Constructor for DBUtils

Method Detail

stringFirstCharToUpper

public static java.lang.String[] stringFirstCharToUpper(java.lang.String[] toChange)
Converts the first character of each element in the string[] to UpperCase character.

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

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.

getInstanceFromCompositeData

public static java.lang.Object[] getInstanceFromCompositeData(javax.jmx.openmbean.CompositeData data,
                                                              java.lang.String[] indexNames)
This method is used to get the object array of indexes from the CompositeData.

Parameters:
data - The CompositeData from which the index array should be retreived.
indexNames - The indexNames of the table.
Returns:
The object array of the indexes present in this CompositeData.

makeCompositeDataFromRow

public static javax.jmx.openmbean.CompositeData makeCompositeDataFromRow(java.util.Vector row,
                                                                         java.lang.String[] columnNames,
                                                                         java.lang.String[] columnTypes)
                                                                  throws java.lang.Exception
This method is used to form a CompositeData from a Vector of values.

Parameters:
row - The Vector which contains the column values in the correct order
columnNames - The columnNames of the table.
columnTypes - The columnTypes of the columns in the table
Returns:
A CompositeData formed with the given values.
Throws:
java.lang.Exception - if any exception occurs while forming CompositeData.

getJavaTypeForDBType

public static java.lang.String getJavaTypeForDBType(java.lang.String dbColumnType)
Returns the Java type corresponding to the DataBase type

Parameters:
dbColumnType - The DataBase type for which the corresponding Java type is requested