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.cos.COSAPIClient.java

License:Apache License

/**
 * Checks if container/object contains container/object/_SUCCESS If so, this
 * object was created by successful Hadoop job
 *
 * @param objectKey//from w  w  w.j av  a 2s  .  com
 * @return boolean if job is successful
 */
private boolean isJobSuccessful(String objectKey) {
    LOG.trace("isJobSuccessful: for {}", objectKey);
    if (mCachedSparkJobsStatus.containsKey(objectKey)) {
        LOG.debug("isJobSuccessful: {} found cached", objectKey);
        return mCachedSparkJobsStatus.get(objectKey).booleanValue();
    }
    String key = getRealKey(objectKey);
    Path p = new Path(key, HADOOP_SUCCESS);
    ObjectMetadata statusMetadata = getObjectMetadata(p.toString());
    Boolean isJobOK = Boolean.FALSE;
    if (statusMetadata != null) {
        isJobOK = Boolean.TRUE;
    }
    LOG.debug("isJobSuccessful: not cached {}. Status is {}", objectKey, isJobOK);
    mCachedSparkJobsStatus.put(objectKey, isJobOK);
    return isJobOK.booleanValue();
}

From source file:com.ibm.stocator.fs.cos.COSUtils.java

License:Apache License

/**
 * Translate an exception raised in an operation into an IOException. The
 * specific type of IOException depends on the class of
 * {@link AmazonClientException} passed in, and any status codes included in
 * the operation. That is: HTTP error codes are examined and can be used to
 * build a more specific response.//from   w w w. jav a  2  s .co m
 *
 * @param operation operation
 * @param path path operated on (must not be null)
 * @param exception amazon exception raised
 * @return an IOE which wraps the caught exception
 */
public static IOException translateException(String operation, Path path, AmazonClientException exception) {
    return translateException(operation, path.toString(), exception);
}

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

License:Open Source License

/**
 * Check path should check the validity of the path. Skipped at this point.
 *//* w w w  .  j  a  v  a2 s  . co  m*/
@Override
protected void checkPath(Path path) {
    LOG.trace("Check path: {}", path.toString());
}

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

License:Open Source License

/**
 * Check if the object exists.//from ww  w .  ja va2 s .com
 */
@Override
public boolean exists(Path f) throws IOException {
    LOG.debug("exists {}", f.toString());
    return storageClient.exists(hostNameScheme, f);
}

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

License:Open Source License

/**
 * There is no "directories" in the object store
 * The general structure is "dataroot/object"
 * and "object" may contain nested structure
 *///from   ww w. j a  va 2 s  .  c o m
@Override
public boolean isDirectory(Path f) throws IOException {
    LOG.debug("is directory: {}", f.toString());
    return false;
}

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

License:Open Source License

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

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

License:Open Source License

@Override
protected RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f, PathFilter filter)
        throws FileNotFoundException, IOException {
    LOG.debug("listLocatedStatus with path filter: {}", f.toString());
    return super.listLocatedStatus(f, filter);
}

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

License:Open Source License

@Override
public FSDataInputStream open(Path f) throws IOException {
    LOG.debug("open method: {} without buffer size", f.toString());
    return storageClient.getObject(hostNameScheme, f);
}

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

License:Open Source License

public FSDataInputStream open(Path f, int bufferSize) throws IOException {
    LOG.debug("open method: {} with buffer size {}", f.toString(), bufferSize);
    return storageClient.getObject(hostNameScheme, f);
}

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

License:Open Source License

/**
 * {@inheritDoc}//from  w  w  w . ja va 2s.c  om
 * create path of the form dataroot/objectname
 * Each object name is modified to contain task-id prefix.
 * Thus for example, create
 * dataroot/objectname/_temporary/0/_temporary/attempt_201603131849_0000_m_000019_0/
 * part-r-00019-a08dcbab-8a34-4d80-a51c-368a71db90aa.csv
 * will be transformed to
 * PUT dataroot/object
 * /201603131849_0000_m_000019_0-part-r-00019-a08dcbab-8a34-4d80-a51c-368a71db90aa.csv
 *
 * @param f
 * @param permission
 * @param overwrite
 * @param bufferSize
 * @param replication
 * @param blockSize
 * @param progress
 * @return FSDataOutputStream to write data in
 * @throws IOException
 */
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize,
        short replication, long blockSize, Progressable progress) throws IOException {
    LOG.debug("Create method: {}", f.toString());
    String objNameModified = "";
    // check if request is dataroot/objectname/_SUCCESS
    if (f.getName().equals(Constants.HADOOP_SUCCESS)) {
        objNameModified = getObjectNameRoot(f, HADOOP_TEMPORARY, false);
    } else {
        objNameModified = getObjectNameRoot(f, HADOOP_TEMPORARY, true);
    }
    FSDataOutputStream outStream = storageClient.createObject(objNameModified, "binary/octet-stream", null,
            statistics);
    return outStream;
}