org.openstreetmap.osmosis.core.xml.v0_6
Class XmlChangeUploader

java.lang.Object
  extended by org.openstreetmap.osmosis.core.xml.v0_6.XmlChangeUploader
All Implemented Interfaces:
Completable, Releasable, Task, ChangeSink

public class XmlChangeUploader
extends java.lang.Object
implements ChangeSink

An OSM change sink for uploading all data to an OpenStreetMap server.

Author:
Marcus Wolschon Marcus@Wolscon.biz

Constructor Summary
XmlChangeUploader(java.lang.String aBaseURL, java.lang.String aUserName, java.lang.String aPassword, java.lang.String aComment)
          Creates a new instance.
 
Method Summary
 void complete()
          close the changeset on the server.
protected  void initialize()
          Open the changeset if it is not yet open.
 void process(ChangeContainer changeContainer)
          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

XmlChangeUploader

public XmlChangeUploader(java.lang.String aBaseURL,
                         java.lang.String aUserName,
                         java.lang.String aPassword,
                         java.lang.String aComment)
Creates a new instance. The baseURL defaults to the production API.

Parameters:
aBaseURL - may be null
aUserName - the user-name to use
aPassword - the password to use
aComment - the comment to set in the changeset
Method Detail

initialize

protected final void initialize()
                         throws java.io.IOException
Open the changeset if it is not yet open.

Throws:
java.io.IOException - if we cannot contact the server.

process

public final void process(ChangeContainer changeContainer)
Process the change.

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

complete

public final void complete()
close the changeset on the server.

Specified by:
complete in interface Completable

release

public final 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