Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileStatus


   * @throws IOException
   */
  private Map<Long, StoreFile> loadStoreFiles()
  throws IOException {
    Map<Long, StoreFile> results = new HashMap<Long, StoreFile>();
    FileStatus files[] = this.fs.listStatus(this.homedir);
    for (int i = 0; files != null && i < files.length; i++) {
      // Skip directories.
      if (files[i].isDir()) {
        continue;
      }
View Full Code Here


      }
      long modif;
      try {
        modif = df.parse(attrs.getValue("modified")).getTime();
      } catch (ParseException e) { throw new SAXException(e); }
      FileStatus fs = "file".equals(qname)
        ? new FileStatus(
              Long.valueOf(attrs.getValue("size")).longValue(), false,
              Short.valueOf(attrs.getValue("replication")).shortValue(),
              Long.valueOf(attrs.getValue("blocksize")).longValue(),
              modif, FsPermission.valueOf(attrs.getValue("permission")),
              attrs.getValue("owner"), attrs.getValue("group"),
              new Path("hftp", fshostname + ":" + fsport,
                       attrs.getValue("path")))
        : new FileStatus(0L, true, 0, 0L,
              modif, FsPermission.valueOf(attrs.getValue("permission")),
              attrs.getValue("owner"), attrs.getValue("group"),
              new Path("hftp", fshostname + ":" + fsport,
                       attrs.getValue("path")));
      fslist.add(fs);
View Full Code Here

  @Override
  public List<Split> getSplits(Path path) throws IOException {
    List<Split> splits = new ArrayList<Split>();

    FileSystem fs = path.getFileSystem(getConfiguration());
    FileStatus status = fs.getFileStatus(path);

    long length = status.getLen();
    BlockLocation[] blocks = fs.getFileBlockLocations(status, 0, length);

    long blockSize = status.getBlockSize();
    long splitSize = computeSplitSize(blockSize, getMinSplitSize(), getMaxSplitSize());

    long remaining = length;
    while (((double) remaining) / splitSize > slop) {
      int i = getBlockIndex(blocks, length - remaining);
View Full Code Here

    SmartResourceLocalizer localizer = (SmartResourceLocalizer) factory.getObject();
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));
  }
View Full Code Here

    localizer.setStagingDirectory(new Path(dir));
    localizer.setStagingId("foo-id");
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));
  }
View Full Code Here

    Map<String, LocalResource> resources = localizer.getResources();
    assertThat(resources, notNullValue());
    assertThat(resources.size(), is(1));

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path("/tmp/foo/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));

  }
View Full Code Here

    Map<String, LocalResource> resources = localizer.getResources();
    assertThat(resources, notNullValue());
    assertThat(resources.size(), is(1));

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path("/syarn/staging/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));
  }
View Full Code Here

    assertThat(resources, notNullValue());
    assertThat(resources.size(), is(1));


    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));

  }
View Full Code Here

    SmartResourceLocalizer localizer = (SmartResourceLocalizer) factory.getObject();
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/rawContent1"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), is(10l));
  }
View Full Code Here

    localizer.setStagingDirectory(new Path(dir));
    localizer.setStagingId("foo-id");
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/foo-id/rawContent1"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), is(10l));
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.fs.FileStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.