org.openstreetmap.osmosis.core.mysql.v0_5
Class MysqlChangeWriter

java.lang.Object
  extended by org.openstreetmap.osmosis.core.mysql.v0_5.MysqlChangeWriter
All Implemented Interfaces:
Completable, Releasable, Task, ChangeSink

public class MysqlChangeWriter
extends java.lang.Object
implements ChangeSink

A change sink writing to database tables. This aims to be suitable for running at regular intervals with database overhead proportional to changeset size.

Author:
Brett Henderson

Constructor Summary
MysqlChangeWriter(DatabaseLoginCredentials loginCredentials, DatabasePreferences preferences, boolean populateCurrentTables)
          Creates a new instance.
 
Method Summary
 void complete()
          Ensures that all information is fully persisted.
 void process(ChangeContainer change)
          Process the change.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MysqlChangeWriter

public MysqlChangeWriter(DatabaseLoginCredentials loginCredentials,
                         DatabasePreferences preferences,
                         boolean populateCurrentTables)
Creates a new instance.

Parameters:
loginCredentials - Contains all information required to connect to the database.
preferences - Contains preferences configuring database behaviour.
populateCurrentTables - If true, the current tables will be populated as well as history tables.
Method Detail

process

public void process(ChangeContainer change)
Process the change.

Specified by:
process in interface ChangeSink
Parameters:
change - The change to be processed.

complete

public void complete()
Ensures that all information is fully persisted. This includes database commits, file buffer flushes, etc. Implementations must call complete on any nested Completable objects. Where the releasable method of a Releasable class should be called within a finally block, this method should typically be the final statement within the try block.

Specified by:
complete in interface Completable

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable