Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.klopotek.utils.log
Class JDBCLogger  view JDBCLogger download JDBCLogger.java

java.lang.Object
  extended bycom.klopotek.utils.log.JDBCLogger

public class JDBCLogger
extends java.lang.Object

This class encapsulate the logic which is necessary to log into a table. Used by JDBCAppender

Author : Thomas Fenner

Since:
1.0

Field Summary
private  java.lang.String column_list
           
private  java.sql.Connection con
           
private  java.lang.String errormsg
           
private  boolean isconfigured
           
private  java.util.ArrayList logcols
           
private static java.lang.String msg_wildcard
           
private  int msg_wildcard_pos
           
private  java.lang.String new_sql
           
private  java.lang.String new_sql_part1
           
private  java.lang.String new_sql_part2
           
private  int num
           
private  boolean ready
           
private  java.sql.ResultSet rs
           
private  java.lang.String sql
           
private  java.sql.Statement stmt
           
private  java.lang.String table
           
 
Constructor Summary
JDBCLogger()
           
 
Method Summary
 void append(java.lang.String _msg)
          Writes a message into the database table.
 void appendSQL(java.lang.String _msg)
          Writes a message into the database using a given sql-statement.
 void configureSQL(java.lang.String _sql)
          Configures this class, by storing and parsing the given sql-statement.
 void configureTable(java.lang.String _table)
          Configures this class, by reading in the structure of the log-table Throws an exception, if an database-error occurs !
 java.lang.String getErrorMsg()
          Return the internal error message stored in instance variable msg.
 boolean isConfigured()
          Return true, if this class is configured, else false.
 boolean isConnected()
          Return true, if this connection is open, else false.
 boolean ready()
          Return true, if this class is ready to append(), else false.
 void setConnection(java.sql.Connection _con)
          Sets a connection.
 void setLogType(java.lang.String _name, int _logtype, java.lang.Object _value)
          Sets a columns logtype (LogTypes) and value, which depends on that logtype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logcols

private java.util.ArrayList logcols

column_list

private java.lang.String column_list

num

private int num

isconfigured

private boolean isconfigured

ready

private boolean ready

errormsg

private java.lang.String errormsg

con

private java.sql.Connection con

stmt

private java.sql.Statement stmt

rs

private java.sql.ResultSet rs

table

private java.lang.String table

sql

private java.lang.String sql

new_sql

private java.lang.String new_sql

new_sql_part1

private java.lang.String new_sql_part1

new_sql_part2

private java.lang.String new_sql_part2

msg_wildcard

private static final java.lang.String msg_wildcard
See Also:
Constant Field Values

msg_wildcard_pos

private int msg_wildcard_pos
Constructor Detail

JDBCLogger

public JDBCLogger()
Method Detail

append

public void append(java.lang.String _msg)
            throws java.lang.Exception
Writes a message into the database table. Throws an exception, if an database-error occurs !


appendSQL

public void appendSQL(java.lang.String _msg)
               throws java.lang.Exception
Writes a message into the database using a given sql-statement. Throws an exception, if an database-error occurs !


configureTable

public void configureTable(java.lang.String _table)
                    throws java.lang.Exception
Configures this class, by reading in the structure of the log-table Throws an exception, if an database-error occurs !


configureSQL

public void configureSQL(java.lang.String _sql)
                  throws java.lang.Exception
Configures this class, by storing and parsing the given sql-statement. Throws an exception, if somethings wrong !


setConnection

public void setConnection(java.sql.Connection _con)
                   throws java.lang.Exception
Sets a connection. Throws an exception, if the connection is not open !


setLogType

public void setLogType(java.lang.String _name,
                       int _logtype,
                       java.lang.Object _value)
                throws java.lang.Exception
Sets a columns logtype (LogTypes) and value, which depends on that logtype. Throws an exception, if the given arguments arent correct !


ready

public boolean ready()
Return true, if this class is ready to append(), else false. When not ready, a reason-String is stored in the instance-variable msg.


isConfigured

public boolean isConfigured()
Return true, if this class is configured, else false.


isConnected

public boolean isConnected()
Return true, if this connection is open, else false.


getErrorMsg

public java.lang.String getErrorMsg()
Return the internal error message stored in instance variable msg.