Example usage for org.apache.hadoop.fs ContentSummary ContentSummary

List of usage examples for org.apache.hadoop.fs ContentSummary ContentSummary

Introduction

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

Prototype

@Deprecated
public ContentSummary(long length, long fileCount, long directoryCount, long quota, long spaceConsumed,
        long spaceQuota) 

Source Link

Document

Constructor, deprecated by ContentSummary.Builder

Usage

From source file:com.pigai.hadoop.HttpFSFileSystem.java

License:Apache License

@Override
public ContentSummary getContentSummary(Path f) throws IOException {
    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM, Operation.GETCONTENTSUMMARY.toString());
    HttpURLConnection conn = getConnection(Operation.GETCONTENTSUMMARY.getMethod(), params, f, true);
    validateResponse(conn, HttpURLConnection.HTTP_OK);
    JSONObject json = (JSONObject) ((JSONObject) jsonParse(conn)).get(CONTENT_SUMMARY_JSON);
    return new ContentSummary((Long) json.get(CONTENT_SUMMARY_LENGTH_JSON),
            (Long) json.get(CONTENT_SUMMARY_FILE_COUNT_JSON),
            (Long) json.get(CONTENT_SUMMARY_DIRECTORY_COUNT_JSON), (Long) json.get(CONTENT_SUMMARY_QUOTA_JSON),
            (Long) json.get(CONTENT_SUMMARY_SPACE_CONSUMED_JSON),
            (Long) json.get(CONTENT_SUMMARY_SPACE_QUOTA_JSON));
}

From source file:org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem.java

License:Apache License

/** {@inheritDoc} */
@Override/*  w w w . jav a 2  s .  c om*/
public ContentSummary getContentSummary(Path f) throws IOException {
    A.notNull(f, "f");

    enterBusy();

    try {
        if (mode(f) == PROXY) {
            if (secondaryFs == null) {
                assert mgmt;

                throw new IOException(
                        "Failed to get content summary (secondary file system is not initialized): " + f);
            }

            return secondaryFs.getContentSummary(toSecondary(f));
        } else {
            IgfsPathSummary sum = rmtClient.contentSummary(convert(f));

            return new ContentSummary(sum.totalLength(), sum.filesCount(), sum.directoriesCount(), -1,
                    sum.totalLength(), rmtClient.fsStatus().spaceTotal());
        }
    } finally {
        leaveBusy();
    }
}

From source file:org.gridgain.grid.ggfs.hadoop.v1.GridGgfsHadoopFileSystem.java

License:Open Source License

/** {@inheritDoc} */
@Override//from w  ww .  ja va  2  s .c o m
public ContentSummary getContentSummary(Path f) throws IOException {
    A.notNull(f, "f");

    enterBusy();

    try {
        if (mode(f) == PROXY) {
            if (secondaryFs == null) {
                assert mgmt;

                throw new IOException(
                        "Failed to get content summary (secondary file system is not initialized): " + f);
            }

            return secondaryFs.getContentSummary(toSecondary(f));
        } else {
            GridGgfsPathSummary sum = rmtClient.contentSummary(convert(f));

            return new ContentSummary(sum.totalLength(), sum.filesCount(), sum.directoriesCount(), -1,
                    sum.totalLength(), rmtClient.fsStatus().spaceTotal());
        }
    } finally {
        leaveBusy();
    }
}