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

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

Introduction

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

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

/**
 * We don't need rename, since objects are already were created with real
 * names.//  w ww.  j a  v a  2 s  . c o  m
 */
@Override
public boolean rename(Path src, Path dst) throws IOException {
    LOG.debug("rename from {} to {}", src.toString(), dst.toString());
    return true;
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public boolean delete(Path f, boolean recursive) throws IOException {
    LOG.debug("delete method: {}. recursive {}", f.toString(), recursive);
    String objNameModified = getObjectNameRoot(f, HADOOP_TEMPORARY, true);
    LOG.debug("Modified object name {}", objNameModified);
    if (objNameModified.contains(HADOOP_TEMPORARY)) {
        return true;
    }//from w w w  . java 2 s. co m
    Path pathToObj = new Path(objNameModified);
    if (f.getName().startsWith(HADOOP_ATTEMPT)) {
        FileStatus[] fsList = storageClient.list(hostNameScheme, pathToObj.getParent(), true);
        if (fsList.length > 0) {
            for (FileStatus fs : fsList) {
                if (fs.getPath().getName().endsWith(f.getName())) {
                    storageClient.delete(hostNameScheme, fs.getPath(), recursive);
                }
            }
        }
    } else {
        FileStatus[] fsList = storageClient.list(hostNameScheme, pathToObj, true);
        if (fsList.length > 0) {
            for (FileStatus fs : fsList) {
                storageClient.delete(hostNameScheme, fs.getPath(), recursive);
            }
        }
    }
    return true;
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public FileStatus[] listStatus(Path f, PathFilter filter) throws FileNotFoundException, IOException {
    if (filter != null) {
        LOG.debug("list status: {}, filter: {}", f.toString(), filter.toString());
    } else {//  w  w w  .  jav a2s.  c  o m
        LOG.debug("list status: {}", f.toString());
    }
    FileStatus[] res = {};
    if (f.toString().contains(HADOOP_TEMPORARY)) {
        return res;
    }
    return storageClient.list(hostNameScheme, f, false);
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public FileStatus[] listStatus(Path f) throws FileNotFoundException, IOException {
    LOG.debug("List status of {}", f.toString());
    FileStatus[] res = {};/* w w w.  j  a v  a 2s.  co  m*/
    if (f.toString().contains(HADOOP_TEMPORARY)) {
        return res;
    }
    return storageClient.list(hostNameScheme, f, false);
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public RemoteIterator<LocatedFileStatus> listFiles(Path f, boolean recursive)
        throws FileNotFoundException, IOException {
    LOG.debug("list files: {}", f.toString());
    return super.listFiles(f, recursive);
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public void setWorkingDirectory(Path new_dir) {
    LOG.debug("set working directory: {}", new_dir.toString());

}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

/**
 * {@inheritDoc}/*  w w  w  .  j a  v a2s.  co  m*/
 *
 * When path is of the form schema://dataroot.provider/objectname/_temporary/0
 * it is assumed that new job started to write it's data.
 * In this case we create an empty object schema://dataroot.provider/objectname
 * that will later be used to identify objects that were created by Spark.
 * This is needed for fault tolerance coverage to identify data that was created
 * by failed jobs or tasks.
 * dataroot/object created as a 0 size object with type application/directory
 *
 * @param f path to create
 * @return boolean on success or failure
 * @throws IOException
 */
@Override
public boolean mkdirs(Path f) throws IOException {
    LOG.debug("mkdirs: {}", f.toString());
    if (f.getParent().toString().endsWith(HADOOP_TEMPORARY)) {
        String objNameModified = getObjectNameRoot(f, HADOOP_TEMPORARY, true);
        Path pathToObj = new Path(objNameModified);
        String plainObjName = pathToObj.getParent().toString();
        LOG.debug("Going to create identifier {}", plainObjName);
        Map<String, String> metadata = new HashMap<String, String>();
        metadata.put("Data-Origin", "stocator");
        FSDataOutputStream outStream = storageClient.createObject(plainObjName, "application/directory",
                metadata, statistics);
        outStream.close();
    }
    return true;
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public FileStatus getFileStatus(Path f) throws IOException {
    LOG.debug("get file status: {}", f.toString());
    return storageClient.getObjectMetadata(hostNameScheme, f);
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public Path resolvePath(Path p) throws IOException {
    LOG.debug("resolve path: {}", p.toString());
    return super.resolvePath(p);
}

From source file:com.ibm.stocator.fs.ObjectStoreFileSystem.java

License:Open Source License

@Override
public long getBlockSize(Path f) throws IOException {
    LOG.debug("get block size: {}", f.toString());
    return getFileStatus(f).getBlockSize();
}