Kieker 1.8

kieker.monitoring.writer.database
Class DBWriterHelper

java.lang.Object
  extended by kieker.monitoring.writer.database.DBWriterHelper

public final class DBWriterHelper
extends Object

Since:
1.5
Author:
Jan Waller

Constructor Summary
DBWriterHelper(Connection connection, String indexTablename, AtomicInteger tableCounter, boolean overwrite)
          Creates a new instance of this class using the given parameters.
DBWriterHelper(Connection connection, String indexTablename, boolean overwrite)
          Creates a new instance of this class using the given parameters.
 
Method Summary
 void createIndexTable()
           
 String createTable(String classname, Class<?>... columns)
          Creates a table using the given parameters.
 boolean set(PreparedStatement preparedStatement, int parameterIndex, Object value)
          This is a simple helper method using automatically the correct setter method for the given value to set a value within the prepared statement.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBWriterHelper

public DBWriterHelper(Connection connection,
                      String indexTablename,
                      boolean overwrite)
               throws SQLException
Creates a new instance of this class using the given parameters.

Parameters:
connection - The connection to the database.
indexTablename - The index table name (The created tables will have this name as a prefix).
overwrite - If set to true, existing tables will be dropped and newly created.
Throws:
SQLException - If something went wrong during the preparation of the connection.

DBWriterHelper

public DBWriterHelper(Connection connection,
                      String indexTablename,
                      AtomicInteger tableCounter,
                      boolean overwrite)
               throws SQLException
Creates a new instance of this class using the given parameters.

Parameters:
connection - The connection to the database.
indexTablename - The index table name (The created tables will have this name as a prefix).
tableCounter - The counter containing the number of tables within the current system.
overwrite - If set to true, existing tables will be dropped and newly created.
Throws:
SQLException - If something went wrong during the preparation of the connection.
Method Detail

createTable

public String createTable(String classname,
                          Class<?>... columns)
                   throws SQLException
Creates a table using the given parameters.

Parameters:
classname - The name of the class which corresponds to the newly created table.
columns - The array of classes determining the columns of this table.
Returns:
The name of the newly created table.
Throws:
SQLException - If something went wrong during the creation.

createIndexTable

public void createIndexTable()
                      throws SQLException
Throws:
SQLException

set

public boolean set(PreparedStatement preparedStatement,
                   int parameterIndex,
                   Object value)
            throws SQLException
This is a simple helper method using automatically the correct setter method for the given value to set a value within the prepared statement.

Parameters:
preparedStatement - The prepared statement to fill.
parameterIndex - The index of the parameter to fill.
value - The value of the parameter to fill.
Returns:
true iff the setting was successful.
Throws:
SQLException - If, for example, the connection has already been closed or the given index is invalid.

toString

public String toString()
Overrides:
toString in class Object

Kieker 1.8

Copyright 2013 Kieker Project, http://kieker-monitoring.net