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
 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()
Parameters:
connection - the connection to check for schema.
Returns:
true if the schema exists. False otherwise.

validateSchema

void validateSchema()
Validates the schema.

Parameters:
connection -

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.

Parameters:
connection -
Returns:
the current size of the channel.


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