AbstractJDBCTarget (LogKit API)
Keywords: org.apache.log.output.db.AbstractJDBCTarget,AbstractJDBCTarget class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.log.output.db
Class AbstractJDBCTarget

    java.lang.Object
      |
      +--org.apache.log.output.AbstractTarget
            |
            +--org.apache.log.output.db.AbstractJDBCTarget

All Implemented Interfaces:
  ErrorAware, LogTarget

Direct Known Subclasses:
  DefaultJDBCTarget

public abstract class AbstractJDBCTarget
extends AbstractTarget

Abstract JDBC target.

Author:
  Avalon Development Team, Peter Donald

Constructor Summary
`protected` | `AbstractJDBCTarget(DataSource dataSource)` Creation of a new instance of the AbstractJDBCTarget.

Method Summary
`protected void` | `checkConnection()` Utility method to check connection and bring it back up if necessary.
`void` | `close()` Shutdown target.
`protected void` | `closeConnection()` Close connection to underlying database.
`protected void` | `doProcessEvent(LogEvent event)` Process a log event, via formatting and outputting it.
`protected Connection` | `getConnection()` Utility method for subclasses to access connection.
`protected boolean` | `isStale()` Detect if connection is stale and should be reopened.
`protected void` | `open()` Startup log session.
`protected void` | `openConnection()` Open connection to underlying database.
`protected abstract void` | `output(LogEvent event)` Output a log event to DB.

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

### AbstractJDBCTarget

    protected AbstractJDBCTarget(DataSource dataSource)

  Creation of a new instance of the AbstractJDBCTarget.

Parameters:
  `dataSource` - the JDBC datasource

Method Detail

### doProcessEvent

    protected void doProcessEvent(LogEvent event)
                           throws Exception

  Process a log event, via formatting and outputting it.

  Specified by:
    `doProcessEvent` in class `AbstractTarget`
  Parameters:
    `event` - the log event
  Throws:
    `Exception` - if an event processing error occurs

### output

    protected abstract void output(LogEvent event)

  Output a log event to DB. This must be implemented by subclasses.

  Parameters:
    `event` - the log event.

### open

    protected void open()

  Startup log session.

  Overrides:
    `open` in class `AbstractTarget`

### openConnection

    protected void openConnection()

  Open connection to underlying database.

### getConnection

    protected final Connection getConnection()

  Utility method for subclasses to access connection.

  Returns:
    the Connection

### checkConnection

    protected final void checkConnection()

  Utility method to check connection and bring it back up if necessary.

### isStale

    protected boolean isStale()

  Detect if connection is stale and should be reopened.

  Returns:
    true if connection is stale, false otherwise

### close

    public void close()

  Shutdown target. Attempting to write to target after close() will cause errors to be logged.

  Overrides:
    `close` in class `AbstractTarget`

### closeConnection

    protected void closeConnection()

  Close connection to underlying database.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Apache Jakarta Project. All Rights Reserved.