/** * 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(workingDirectory, CONFIG_FILE_NAME); timestampFile = new File(workingDirectory, TSTAMP_FILE_NAME); newTimestampFile = new File(workingDirectory, TSTAMP_NEW_FILE_NAME); if (configFile.exists()) { throw new OsmosisRuntimeException("Config file " + CONFIG_FILE_NAME + " already exists."); } resourceFileManager.copyResourceToFile(getClass(), CONFIG_RESOURCE, configFile); if (timestampFile.exists()) { throw new OsmosisRuntimeException("Timestamp file " + TSTAMP_FILE_NAME + " already exists."); } new TimestampTracker(timestampFile, newTimestampFile).setTime(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(workingDirectory, CONFIG_FILE_NAME); timestampFile = new File(workingDirectory, TSTAMP_FILE_NAME); newTimestampFile = new File(workingDirectory, TSTAMP_NEW_FILE_NAME); if (configFile.exists()) { throw new OsmosisRuntimeException("Config file " + CONFIG_FILE_NAME + " already exists."); } resourceFileManager.copyResourceToFile(getClass(), CONFIG_RESOURCE, configFile); if (timestampFile.exists()) { throw new OsmosisRuntimeException("Timestamp file " + TSTAMP_FILE_NAME + " already exists."); } new TimestampTracker(timestampFile, newTimestampFile).setTime(initialDate); }
/** * Initialises the current working directory. * * @param args * The input arguments. * @param initialArgIndex * The current offset into the arguments. */ private void initializeCommand(String[] args, int initialArgIndex) { int currentArgIndex; Date initialExtractDate; ResourceFileManager resourceFileManager; // Get the command line arguments. currentArgIndex = initialArgIndex; initialExtractDate = getDateArgument(args, currentArgIndex++); if (CONFIG_FILE.exists()) { throw new OsmosisRuntimeException("Config file " + CONFIG_FILE + " already exists."); } resourceFileManager = new ResourceFileManager(); resourceFileManager.copyResourceToFile(getClass(), CONFIG_RESOURCE, CONFIG_FILE); if (!DATA_DIR.exists()) { if (!DATA_DIR.mkdir()) { throw new OsmosisRuntimeException("Unable to create directory " + DATA_DIR); } } if (TSTAMP_FILE.exists()) { throw new OsmosisRuntimeException("Extract timestamp file " + TSTAMP_FILE + " already exists."); } getTimestampTracker().setTime(initialExtractDate); }
timestampTracker.setTime(currentTime);
timestampTracker.setTime(currentTime);