Package com.basho.riak.client.http.request

Examples of com.basho.riak.client.http.request.RequestMeta


     *            the {@link StoreMeta} to convert
     * @return a {@link RequestMeta} populated with <code>w/dw/returnBody</code>
     *         params from <code>storeMeta</code>
     */
    static RequestMeta convert(StoreMeta storeMeta) {
        RequestMeta requestMeta = RequestMeta.writeParams(storeMeta.getW(), storeMeta.getDw());

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            requestMeta.setQueryParam(Constants.QP_RETURN_BODY, Boolean.toString(true));
        } else {
            requestMeta.setQueryParam(Constants.QP_RETURN_BODY, Boolean.toString(false));
        }

        if (storeMeta.hasPw()) {
            requestMeta.setQueryParam(Constants.QP_PW, storeMeta.getPw().toString());
        }

        if (storeMeta.hasIfNonMatch() && storeMeta.getIfNonMatch()) {
            requestMeta.setIfNoneMatch(storeMeta.getEtags());
        }

        if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
            requestMeta.setIfUnmodifiedSince(storeMeta.getLastModified());
        }

        return requestMeta;
    }
View Full Code Here


     * @param fetchMeta
     *            the {@link FetchMeta} to convert
     * @return the {@link RequestMeta}
     */
    static RequestMeta convert(FetchMeta fetchMeta) {
        RequestMeta rm = new RequestMeta();

        if (fetchMeta.getR() != null) {
            rm.setQueryParam(Constants.QP_R, fetchMeta.getR().toString());
        }

        if (fetchMeta.getPr() != null) {
            rm.setQueryParam(Constants.QP_PR, fetchMeta.getPr().toString());
        }

        if (fetchMeta.getNotFoundOK() != null) {
            rm.setQueryParam(Constants.QP_NOT_FOUND_OK, fetchMeta.getNotFoundOK().toString());
        }

        if (fetchMeta.getBasicQuorum() != null) {
            rm.setQueryParam(Constants.QP_BASIC_QUORUM, fetchMeta.getBasicQuorum().toString());
        }

        if (fetchMeta.getIfModifiedSince() != null) {
            rm.setIfModifiedSince(fetchMeta.getIfModifiedSince());
        }

        return rm;
    }
View Full Code Here

        return rm;
    }

    static RequestMeta convert(DeleteMeta deleteMeta) {
        RequestMeta rm = convert(new FetchMeta(deleteMeta.getR(), deleteMeta.getPr(), null, null, null, null, null,
                                               null));

        if (deleteMeta.hasW()) {
            rm.setQueryParam(Constants.QP_W, deleteMeta.getW().toString());
        }

        if (deleteMeta.hasPw()) {
            rm.setQueryParam(Constants.QP_PW, deleteMeta.getPw().toString());
        }

        if (deleteMeta.hasDw()) {
            rm.setQueryParam(Constants.QP_DW, deleteMeta.getDw().toString());
        }

        if (deleteMeta.hasRw()) {
            rm.setQueryParam(Constants.QP_RW, deleteMeta.getRw().toString());
        }

        if (deleteMeta.hasVclock()) {
            rm.setHeader(Constants.HDR_VCLOCK, deleteMeta.getVclock().asString());
        }

        return null;
    }
View Full Code Here

        }

        if (key == null || key.trim().equals("")) {
            throw new IllegalArgumentException("Key cannot be null or empty or just whitespace");
        }
        RequestMeta rm = convert(fetchMeta);

        FetchResponse resp = client.fetch(bucket, key, rm);
        return handleBodyResponse(resp);
    }
View Full Code Here

            throw new IllegalArgumentException("cannot store a null RiakObject, or a RiakObject without a bucket");
        }
        RiakResponse response = RiakResponse.empty();

        com.basho.riak.client.http.RiakObject riakObject = convert(object, client);
        RequestMeta requestMeta = convert(storeMeta);
        StoreResponse resp = client.store(riakObject, requestMeta);

        if (resp.isSuccess()) {
            riakObject.updateMeta(resp);
        } else {
View Full Code Here

     *            the {@link StoreMeta} to convert
     * @return a {@link RequestMeta} populated with <code>w/dw/returnBody</code>
     *         params from <code>storeMeta</code>
     */
    static RequestMeta convert(StoreMeta storeMeta) {
        RequestMeta requestMeta = RequestMeta.writeParams(storeMeta.getW(), storeMeta.getDw());

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            requestMeta.setQueryParam(Constants.QP_RETURN_BODY, Boolean.toString(true));
        } else {
            requestMeta.setQueryParam(Constants.QP_RETURN_BODY, Boolean.toString(false));
        }

        if (storeMeta.hasPw()) {
            requestMeta.setQueryParam(Constants.QP_PW, storeMeta.getPw().toString());
        }

        if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
            requestMeta.setIfNoneMatch(storeMeta.getEtags());
        }

        if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
            requestMeta.setIfUnmodifiedSince(storeMeta.getLastModified());
        }

        return requestMeta;
    }
View Full Code Here

     * @param fetchMeta
     *            the {@link FetchMeta} to convert
     * @return the {@link RequestMeta}
     */
    static RequestMeta convert(FetchMeta fetchMeta) {
        RequestMeta rm = new RequestMeta();

        if (fetchMeta.getR() != null) {
            rm.setQueryParam(Constants.QP_R, fetchMeta.getR().toString());
        }

        if (fetchMeta.getPr() != null) {
            rm.setQueryParam(Constants.QP_PR, fetchMeta.getPr().toString());
        }

        if (fetchMeta.getNotFoundOK() != null) {
            rm.setQueryParam(Constants.QP_NOT_FOUND_OK, fetchMeta.getNotFoundOK().toString());
        }

        if (fetchMeta.getBasicQuorum() != null) {
            rm.setQueryParam(Constants.QP_BASIC_QUORUM, fetchMeta.getBasicQuorum().toString());
        }

        if (fetchMeta.getIfModifiedSince() != null) {
            rm.setIfModifiedSince(fetchMeta.getIfModifiedSince());
        }

        return rm;
    }
View Full Code Here

        return rm;
    }

    static RequestMeta convert(DeleteMeta deleteMeta) {
        RequestMeta rm = convert(new FetchMeta(deleteMeta.getR(), deleteMeta.getPr(), null, null, null, null, null,
                                               null));

        if (deleteMeta.hasW()) {
            rm.setQueryParam(Constants.QP_W, deleteMeta.getW().toString());
        }

        if (deleteMeta.hasPw()) {
            rm.setQueryParam(Constants.QP_PW, deleteMeta.getPw().toString());
        }

        if (deleteMeta.hasDw()) {
            rm.setQueryParam(Constants.QP_DW, deleteMeta.getDw().toString());
        }

        if (deleteMeta.hasRw()) {
            rm.setQueryParam(Constants.QP_RW, deleteMeta.getRw().toString());
        }

        if (deleteMeta.hasVclock()) {
            rm.setHeader(Constants.HDR_VCLOCK, deleteMeta.getVclock().asString());
        }

        return null;
    }
View Full Code Here

            fetchMeta = new FetchMeta(fetchMeta.getR(), fetchMeta.getPr(), fetchMeta.getNotFoundOK(),
                                      fetchMeta.getBasicQuorum(), true, fetchMeta.getReturnDeletedVClock(),
                                      fetchMeta.getIfModifiedSince(), fetchMeta.getIfModifiedVClock());
        }

        RequestMeta rm = convert(fetchMeta);
        FetchResponse resp = client.fetchMeta(bucket, key, rm);
        return handleBodyResponse(resp);
    }
View Full Code Here

        }

        if (key == null || key.trim().equals("")) {
            throw new IllegalArgumentException("Key cannot be null or empty or just whitespace");
        }
        RequestMeta rm = convert(fetchMeta);

        FetchResponse resp = client.fetch(bucket, key, rm);
        return handleBodyResponse(resp);
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.http.request.RequestMeta

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.