Package com.basho.riak.client.http.response

Examples of com.basho.riak.client.http.response.FetchResponse


            meta.setQueryParam(Constants.QP_RETURN_BODY, "true");
        }

        setAcceptHeader(meta);
        HttpResponse r = helper.store(object, meta);
        return new StoreResponse(new FetchResponse(r, this));
    }
View Full Code Here


                return getFetchResponse(resp);
            } else {
                return fetch(bucket, key, meta);
            }
        } catch (RiakResponseRuntimeException e) {
            return new FetchResponse(helper.toss(e), this);
        }
    }
View Full Code Here

        HttpResponse r = helper.fetch(bucket, key, meta, streamResponse);

        try {
            return getFetchResponse(r);
        } catch (RiakResponseRuntimeException e) {
            return new FetchResponse(helper.toss(e), this);
        }

    }
View Full Code Here

    BucketResponse getBucketResponse(HttpResponse r) throws JSONException, IOException {
        return new BucketResponse(r);
    }

    FetchResponse getFetchResponse(HttpResponse r) throws RiakResponseRuntimeException {
        return new FetchResponse(r, this);
    }
View Full Code Here

     * @throws RiakResponseException
     *             If the server does return a valid object
     */
    public RiakObject fetchMeta(String bucket, String key, RequestMeta meta) throws RiakIOException,
            RiakResponseException {
        FetchResponse r = impl.fetchMeta(bucket, key, meta);

        if (r.getStatusCode() == 404)
            return null;

        if (r.getStatusCode() != 200 && r.getStatusCode() != 304)
            throw new RiakResponseException(new RiakResponseRuntimeException(r, r.getBodyAsString()));

        if (r.getStatusCode() == 200 && !r.hasObject())
            throw new RiakResponseException(new RiakResponseRuntimeException(r, "Failed to parse metadata"));

        return r.getObject();
    }
View Full Code Here

     *             If an error occurs during communication with the Riak server.
     * @throws RiakResponseException
     *             If the server does return a valid object
     */
    public RiakObject fetch(String bucket, String key, RequestMeta meta) throws RiakIOException, RiakResponseException {
        FetchResponse r = impl.fetch(bucket, key, meta);

        if (r.getStatusCode() == 404)
            return null;

        if (r.getStatusCode() != 200 && r.getStatusCode() != 304)
            throw new RiakResponseException(new RiakResponseRuntimeException(r, r.getBodyAsString()));

        if (r.getStatusCode() == 200 && !r.hasObject())
            throw new RiakResponseException(new RiakResponseRuntimeException(r, "Failed to parse object"));

        return r.getObject();
    }
View Full Code Here

     */
    public FetchResponse fetch(RequestMeta meta) {
        if (riak == null)
            throw new IllegalStateException("Cannot fetch an object without a RiakClient");

        FetchResponse r = riak.fetch(bucket, key, meta);
        if (r.getObject() != null) {
            RiakObject other = r.getObject();
            shallowCopy(other);
            r.setObject(this);
        }
        return r;
    }
View Full Code Here

     */
    public FetchResponse fetchMeta(RequestMeta meta) {
        if (riak == null)
            throw new IllegalStateException("Cannot fetch meta for an object without a RiakClient");

        FetchResponse r = riak.fetchMeta(bucket, key, meta);
        if (r.isSuccess()) {
            this.updateMeta(r);
        }
        return r;
    }
View Full Code Here

     * @throws RiakResponseException
     *             If the server does return any valid objects
     */
    public Collection<? extends RiakObject> fetchAll(String bucket, String key, RequestMeta meta)
            throws RiakIOException, RiakResponseException {
        FetchResponse r = impl.fetch(bucket, key, meta);

        if (r.getStatusCode() == 404)
            return null;

        if (r.getStatusCode() != 200 && r.getStatusCode() != 304)
            throw new RiakResponseException(new RiakResponseRuntimeException(r, r.getBodyAsString()));

        if (r.getStatusCode() == 200 && !(r.hasObject() || r.hasSiblings()))
            throw new RiakResponseException(new RiakResponseRuntimeException(r, "Failed to parse object"));

        if (r.hasSiblings())
            return r.getSiblings();
        return Arrays.asList(r.getObject());
    }
View Full Code Here

                                      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

TOP

Related Classes of com.basho.riak.client.http.response.FetchResponse

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.