Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // This software is released into the Public Domain.  See copying.txt for details.
  package org.openstreetmap.osmosis.replication.v0_6;
  import java.util.Date;
Downloads a set of change files from a HTTP server, and merges them into a single output stream. It tracks the intervals covered by the current files and stores the current timestamp between invocations forming the basis of a replication mechanism.

Brett Henderson
 public class IntervalDownloaderInitializer implements RunnableTask {
 	private static final String LOCK_FILE_NAME = "download.lock";
 	private static final String CONFIG_FILE_NAME = "configuration.txt";
 	private static final String TSTAMP_FILE_NAME = "timestamp.txt";
 	private static final String TSTAMP_NEW_FILE_NAME = "timestamp-new.txt";
 	private static final String CONFIG_RESOURCE = "impl/intervalConfiguration.txt";
 	private File workingDirectory;
 	private Date initialDate;

Creates a new instance.

workingDirectory The directory containing configuration and tracking files.
initialDate The date to begin changeset downloads from.
 	public IntervalDownloaderInitializer(File workingDirectoryDate initialDate) {
 		this. = workingDirectory;
 		this. = initialDate;

Initializes a working directory.
 	private void initializeDirectory() {
 		File configFile;
 		File timestampFile;
 		File newTimestampFile;
 		ResourceFileManager resourceFileManager;
 		// Instantiate utility objects.
 		resourceFileManager = new ResourceFileManager();
 		// Build file objects from file names.
 		configFile = new File();
 		timestampFile = new File();
 		newTimestampFile = new File();
 		if (configFile.exists()) {
 			throw new OsmosisRuntimeException("Config file " +  + " already exists.");
 		resourceFileManager.copyResourceToFile(getClass(), configFile);
 		if (timestampFile.exists()) {
 			throw new OsmosisRuntimeException("Timestamp file " +  + " already exists.");
 		new TimestampTracker(timestampFilenewTimestampFile).setTime();

 	public void run() {
 		FileBasedLock fileLock;
 		fileLock = new FileBasedLock(new File());
 		try {
 		} finally {
New to GrepCode? Check out our FAQ X