Example usage for org.apache.hadoop.fs LocatedFileStatus toString

List of usage examples for org.apache.hadoop.fs LocatedFileStatus toString

Introduction

In this page you can find the example usage for org.apache.hadoop.fs LocatedFileStatus toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.apache.metron.maas.service.callback.LaunchContainer.java

License:Apache License

public String localizeResources(Map<String, LocalResource> resources, Path scriptLocation,
        Path appJarLocation) {/*from www  .  j a v a  2s  .  c  o  m*/
    try {
        LOG.info("Model payload: " + scriptLocation);
        LOG.info("AppJAR Location: " + appJarLocation);
        FileSystem fs = scriptLocation.getFileSystem(conf);
        String script = null;
        Map.Entry<String, LocalResource> kv = localizeResource(fs.getFileStatus(appJarLocation));
        resources.put(kv.getKey(), kv.getValue());
        for (RemoteIterator<LocatedFileStatus> it = fs.listFiles(scriptLocation, true); it.hasNext();) {
            LocatedFileStatus status = it.next();
            kv = localizeResource(status);
            String name = kv.getKey();
            if (name.endsWith(".sh")) {
                script = name;
            }
            LOG.info("Localized " + name + " -> " + status.toString());
            resources.put(name, kv.getValue());
        }
        return script;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        return null;
    }
}

From source file:org.apache.tez.dag.history.ats.acls.TestATSHistoryV15.java

License:Apache License

private int verifyATSDataOnHDFS(Path p, int count, ApplicationId applicationId) throws IOException {
    RemoteIterator<LocatedFileStatus> iter = remoteFs.listFiles(p, true);
    while (iter.hasNext()) {
        LocatedFileStatus f = iter.next();
        LOG.info("Found file " + f.toString());
        if (f.isDirectory()) {
            verifyATSDataOnHDFS(f.getPath(), count, applicationId);
        } else {/*from   w ww .  ja  v  a2s  . c om*/
            if (f.getPath().getName()
                    .contains("" + applicationId.getClusterTimestamp() + "_" + applicationId.getId())) {
                ++count;
            }
        }
    }
    return count;
}