Exemple #1
0
  public static void main(String[] args) throws FileNotFoundException, IOException {
    RawData input = new RawData();
    DataStorage dataStorage = new DataStorage();
    UIoutput output = new UIoutput(); // Open in truncate mode

    output.displayThis("-->> SETUP started");
    output.displayThis("-->> OPENED RawData file");
    output.displayThis("-->> OPENED Backup file");
    output.displayThis("-->> OPENED Log file\n");

    while (input.input1Country()) // loop through the end of the file
    {
      dataStorage.insert(input.getCountryCode(), input.getRestOfData());
      // store to interior storage, which is an array
    }

    output.displayThis("-->> CLOSED Log file");
    output.displayThis("-->> CLOSED Backup file");
    output.displayThis("-->> CLOSED RawData file");
    output.displayThis(
        "-->> SETUP finished" + " - inserted " + input.getN() + " countries into DataStorage\n");

    output.finishUp();
    dataStorage.finishUp();
    input.finishUp();
    System.out.printf("done");
  }
 /** An FSDataset has a directory where it loads its data files. */
 public FSDataset(DataStorage storage, Configuration conf) throws IOException {
   this.maxBlocksPerDir = conf.getInt("dfs.datanode.numblocks", 64);
   FSVolume[] volArray = new FSVolume[storage.getNumStorageDirs()];
   for (int idx = 0; idx < storage.getNumStorageDirs(); idx++) {
     volArray[idx] = new FSVolume(storage.getStorageDir(idx).getCurrentDir(), conf);
   }
   volumes = new FSVolumeSet(volArray);
   volumeMap = new HashMap<Block, DatanodeBlockInfo>();
   volumes.getVolumeMap(volumeMap);
   registerMBean(storage.getStorageID());
 }