private void runImpl() {
try {
ReplicationDownloaderConfiguration configuration;
ReplicationState serverState;
ReplicationState localState;
PropertiesPersister localStatePersistor;
// Instantiate utility objects.
configuration = new ReplicationDownloaderConfiguration(new File(workingDirectory, CONFIG_FILE));
// Obtain the server state.
LOG.fine("Reading current server state.");
serverState = serverStateReader.getServerState(configuration.getBaseUrl());
// Build the local state persister which is used for both loading and storing local state.
localStatePersistor = new PropertiesPersister(new File(workingDirectory, LOCAL_STATE_FILE));
// Begin processing.
processInitialize(Collections.<String, Object>emptyMap());
// If local state isn't available we need to copy server state to be the initial local state
// then exit.
if (localStatePersistor.exists()) {
localState = new ReplicationState(localStatePersistor.loadMap());
// Download and process the replication files.
localState = download(configuration, serverState, localState);
} else {
localState = serverState;
processInitializeState(localState);
}
// Commit downstream changes.
processComplete();
// Persist the local state.
localStatePersistor.store(localState.store());
} finally {
processRelease();
}
}