예제 #1
0
  // TODO [low] This should be in the local RDMS, not in a plain text file
  private void writeAlreadyDownloadedDatabasesListFromFile(List<RemoteFile> unknownRemoteDatabases)
      throws IOException {
    FileWriter fr = new FileWriter(config.getKnownDatabaseListFile(), true);

    for (RemoteFile newlyProcessedRemoteDatabase : unknownRemoteDatabases) {
      fr.write(newlyProcessedRemoteDatabase.getName() + "\n");
    }

    fr.close();
  }
예제 #2
0
  private List<File> downloadUnknownRemoteDatabases(
      TransferManager transferManager, List<RemoteFile> unknownRemoteDatabases)
      throws StorageException {
    logger.log(Level.INFO, "Downloading unknown databases.");
    List<File> unknownRemoteDatabasesInCache = new ArrayList<File>();

    for (RemoteFile remoteFile : unknownRemoteDatabases) {
      File unknownRemoteDatabaseFileInCache =
          config.getCache().getDatabaseFile(remoteFile.getName());

      logger.log(
          Level.INFO,
          "- Downloading {0} to local cache at {1}",
          new Object[] {remoteFile.getName(), unknownRemoteDatabaseFileInCache});
      transferManager.download(
          new DatabaseRemoteFile(remoteFile.getName()), unknownRemoteDatabaseFileInCache);

      unknownRemoteDatabasesInCache.add(unknownRemoteDatabaseFileInCache);
      result.getDownloadedUnknownDatabases().add(remoteFile.getName());
    }

    return unknownRemoteDatabasesInCache;
  }