org.apache.flume.channel.jdbc.impl
Class MySQLSchemaHandler

java.lang.Object
  extended by org.apache.flume.channel.jdbc.impl.MySQLSchemaHandler
All Implemented Interfaces:
SchemaHandler

public class MySQLSchemaHandler
extends Object
implements SchemaHandler


Constructor Summary
protected MySQLSchemaHandler(DataSource dataSource)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQLSchemaHandler

protected MySQLSchemaHandler(DataSource dataSource)
Method Detail

schemaExists

public boolean schemaExists()
Specified by:
schemaExists in interface SchemaHandler
Returns:
true if the schema exists. False otherwise.

validateSchema

public void validateSchema()
Description copied from interface: SchemaHandler
Validates the schema.

Specified by:
validateSchema in interface SchemaHandler

storeEvent

public void storeEvent(PersistableEvent pe,
                       Connection connection)
Description copied from interface: SchemaHandler
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.

Specified by:
storeEvent in interface SchemaHandler
Parameters:
pe - the event to persist
connection - the connection to use

fetchAndDeleteEvent

public PersistableEvent fetchAndDeleteEvent(String channel,
                                            Connection connection)
Description copied from interface: SchemaHandler
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.

Specified by:
fetchAndDeleteEvent in interface SchemaHandler
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

public long getChannelSize(Connection connection)
Description copied from interface: SchemaHandler
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.

Specified by:
getChannelSize in interface SchemaHandler
Returns:
the current size of the channel.

createSchemaObjects

public void createSchemaObjects(boolean createForeignKeys,
                                boolean createIndex)
Description copied from interface: SchemaHandler
Creates the schema.

Specified by:
createSchemaObjects in interface SchemaHandler
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.


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