org.apache.flume.channel.jdbc.impl

## Interface SchemaHandler

- All Known Implementing Classes:
    DerbySchemaHandler, MySQLSchemaHandler

      public interface SchemaHandler

  A handler for creating and validating database schema for use by the JDBC channel implementation.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `createSchemaObjects(boolean createForeignKeys, boolean createIndex)` Creates the schema.
    `PersistableEvent` | `fetchAndDeleteEvent(String channel, Connection connection)` Retrieves the next persistent event from the database.
    `long` | `getChannelSize(Connection connection)` Returns the current size of the channel using the connection specified that must have an active transaction ongoing.
    `boolean` | `schemaExists()`
    `void` | `storeEvent(PersistableEvent pe, Connection connection)` Inserts the given persistent event into the database.
    `void` | `validateSchema()` Validates the schema.

- - ### Method Detail

    - #### schemaExists

          boolean schemaExists()

      Returns:
        true if the schema exists. False otherwise.

    - #### validateSchema

          void validateSchema()

      Validates the schema.

    - #### createSchemaObjects

          void createSchemaObjects(boolean createForeignKeys,
                                 boolean createIndex)

      Creates the schema.
      Parameters:
        `createForeignKeys` - a flag which indicates if the foreign key constraints should be created where necessary.
        `createIndex` - a flag which indicates if indexes must be created during the creation of the schema.

    - #### storeEvent

          void storeEvent(PersistableEvent pe,
                        Connection connection)

      Inserts the given persistent event into the database. The connection that is passed into the handler has an ongoing transaction and therefore the SchemaHandler implementation must not close the connection.
      Parameters:
        `pe` - the event to persist
        `connection` - the connection to use

    - #### fetchAndDeleteEvent

          PersistableEvent fetchAndDeleteEvent(String channel,
                                             Connection connection)

      Retrieves the next persistent event from the database. The connection that is passed into the handler has an ongoing transaction and therefore the SchemaHandler implementation must not close the connection.
      Parameters:
        `channel` - the channel name from which event will be retrieved
        `connection` - the connection to use
      Returns:
        the next persistent event if available or null

    - #### getChannelSize

          long getChannelSize(Connection connection)

      Returns the current size of the channel using the connection specified that must have an active transaction ongoing. This allows the provider impl to enforce channel capacity limits when persisting events.
      Returns:
        the current size of the channel.

Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.