org.apache.log.output.db
Class DefaultJDBCTarget

java.lang.Object
  |
  +--org.apache.log.output.AbstractTarget
        |
        +--org.apache.log.output.db.AbstractJDBCTarget
              |
              +--org.apache.log.output.db.DefaultJDBCTarget
All Implemented Interfaces:
ErrorAware, LogTarget
Direct Known Subclasses:
NormalizedJDBCTarget

public class DefaultJDBCTarget
extends AbstractJDBCTarget

The basic DB target for configurable output formats.

Author:
Peter Donald

Constructor Summary
DefaultJDBCTarget(javax.sql.DataSource dataSource, java.lang.String table, ColumnInfo[] columns)
           
 
Method Summary
protected  void closeConnection()
          Close connection to underlying database.
protected  ColumnInfo getColumn(int index)
           
protected  java.lang.String getStatementSQL()
           
protected  java.lang.String getTable()
           
protected  boolean isStale()
          Detect if connection is stale and should be reopened.
protected  void openConnection()
          Open connection to underlying database.
protected  void output(LogEvent event)
          Output a log event to DB.
protected  void specifyColumn(java.sql.PreparedStatement statement, int index, LogEvent event)
          Adds a single object into statement.
 
Methods inherited from class org.apache.log.output.db.AbstractJDBCTarget
checkConnection, close, doProcessEvent, getConnection, open
 
Methods inherited from class org.apache.log.output.AbstractTarget
error, getErrorHandler, isOpen, processEvent, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJDBCTarget

public DefaultJDBCTarget(javax.sql.DataSource dataSource,
                         java.lang.String table,
                         ColumnInfo[] columns)
Method Detail

output

protected void output(LogEvent event)
Output a log event to DB. This must be implemented by subclasses.
Overrides:
output in class AbstractJDBCTarget
Parameters:
event - the log event.

openConnection

protected void openConnection()
Open connection to underlying database.
Overrides:
openConnection in class AbstractJDBCTarget

getStatementSQL

protected java.lang.String getStatementSQL()

isStale

protected boolean isStale()
Description copied from class: AbstractJDBCTarget
Detect if connection is stale and should be reopened.
Overrides:
isStale in class AbstractJDBCTarget
Following copied from class: org.apache.log.output.db.AbstractJDBCTarget
Returns:
true if connection is stale, false otherwise

closeConnection

protected void closeConnection()
Close connection to underlying database.
Overrides:
closeConnection in class AbstractJDBCTarget

specifyColumn

protected void specifyColumn(java.sql.PreparedStatement statement,
                             int index,
                             LogEvent event)
                      throws java.sql.SQLException
Adds a single object into statement.

getTable

protected final java.lang.String getTable()

getColumn

protected final ColumnInfo getColumn(int index)


"Copyright © 2001 Apache Jakarta Project. All Rights Reserved."