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

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


    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public HttpResponse store(RiakObject object, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getClientId() == null) {
            meta.setClientId(clientId);
        }
        if (meta.getHeader(Constants.HDR_CONNECTION) == null) {
View Full Code Here


    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public HttpResponse fetchMeta(String bucket, String key, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
       
        HttpHead head = new HttpHead(ClientUtils.makeURI(config, bucket, key));
        return executeMethod(bucket, key, head, meta);
    }
View Full Code Here

     *
     * @return Same as {@link RiakClient}
     */
    public HttpResponse fetch(String bucket, String key, RequestMeta meta, boolean streamResponse) {
        if (meta == null) {
            meta = new RequestMeta();
        }
       
        HttpGet get = new HttpGet(ClientUtils.makeURI(config, bucket, key));
        return executeMethod(bucket, key, get, meta, streamResponse);
    }
View Full Code Here

    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException {
        if (meta == null) {
            meta = new RequestMeta();
        }

        HttpGet get = new HttpGet(ClientUtils.makeURI(config, bucket, key));
        try {
            org.apache.http.HttpResponse response = httpClient.execute(get);
View Full Code Here

    /**
     * Same as {@link RiakClient}, except only returning the HTTP response
     */
    public HttpResponse delete(String bucket, String key, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        String url = ClientUtils.makeURI(config, bucket, key);
        HttpDelete delete = new HttpDelete(url);
        return executeMethod(bucket, key, delete, meta);
    }
View Full Code Here

        return executeMethod(bucket, null, get, null);
    }

    public HttpResponse fetchIndex(IndexRequest request) {
       
        RequestMeta meta = new RequestMeta();
        meta.setQueryParam(Constants.QP_INDEX_STREAM, "true");
        if (request.hasMaxResults())
        {
            meta.setQueryParam(Constants.QP_INDEX_MAX_RESULTS, request.getMaxResults().toString());
        }
        if (request.isReturnTerms())
        {
            meta.setQueryParam(Constants.QP_INDEX_RETURN_TERMS, "true");
        }
        if (request.hasContinuation())
        {
            meta.setQueryParam(Constants.QP_INDEX_CONTINUATION, request.getContinuation());
        }
        HttpGet get = new HttpGet(request.makeURIString(config));
       
        return executeMethod(null, null, get, meta, false);
    }
View Full Code Here

        return executeMethod(null, null, get, meta, false);
    }
   
    public HttpResponse incrementCounter(String bucket, String counter, long increment, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getClientId() == null) {
            meta.setClientId(clientId);
        }
       
View Full Code Here

       
    }
   
    public HttpResponse fetchCounter(String bucket, String counter, RequestMeta meta) {
        if (meta == null) {
            meta = new RequestMeta();
        }
        if (meta.getClientId() == null) {
            meta.setClientId(clientId);
        }
       
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) {
            if (fetchMeta.getR().isSymbolic()) {
                rm.setQueryParam(Constants.QP_R, fetchMeta.getR().getName());
            } else {
                rm.setQueryParam(Constants.QP_R,
                                 Integer.toString(fetchMeta.getR().getIntValue()));
            }
           
        }

        if (fetchMeta.getPr() != null) {
            if (fetchMeta.getPr().isSymbolic()) {
                rm.setQueryParam(Constants.QP_PR, fetchMeta.getPr().getName());
            } else {
                rm.setQueryParam(Constants.QP_PR,
                                 Integer.toString(fetchMeta.getPr().getIntValue()));
            }
        }

        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());
        }
       
        if (fetchMeta.hasTimeout()) {
            rm.setTimeout(fetchMeta.getTimeout());
        }

        return rm;
    }
View Full Code Here

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

        if (deleteMeta.hasW()) {
            if (deleteMeta.getW().isSymbolic())
                rm.setQueryParam(Constants.QP_W, deleteMeta.getW().getName());
            else {
                rm.setQueryParam( Constants.QP_W,
                                  String.valueOf(deleteMeta.getW().getIntValue())
                                );
            }
        }

        if (deleteMeta.hasPw()) {
            if (deleteMeta.getPw().isSymbolic()) {
                rm.setQueryParam(Constants.QP_PW, deleteMeta.getPw().getName());
            } else {
                rm.setQueryParam( Constants.QP_PW,
                                  String.valueOf(deleteMeta.getPw().getIntValue())
                                );
            }
        }

        if (deleteMeta.hasDw()) {
            if (deleteMeta.getDw().isSymbolic()) {
                rm.setQueryParam(Constants.QP_DW, deleteMeta.getDw().getName());
            } else {
                rm.setQueryParam( Constants.QP_DW,
                                  String.valueOf(deleteMeta.getDw().getIntValue())
                                );
            }
        }

        if (deleteMeta.hasRw()) {
            if (deleteMeta.getRw().isSymbolic()) {
                rm.setQueryParam(Constants.QP_RW, deleteMeta.getRw().getName());
            } else {
                rm.setQueryParam( Constants.QP_RW,
                                  String.valueOf(deleteMeta.getRw().getIntValue())
                                );
            }
        }

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

        return rm;
    }
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.