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

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


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

        StoreResponse r = riak.store(this, meta);
        if (r.isSuccess()) {
            this.updateMeta(r);
        }
        return r;
    }
View Full Code Here


        }
        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 {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNonMatch() && storeMeta.getIfNonMatch()) {
                    throw new MatchFoundException();
                } else if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
                    throw new ModifiedException();
                }
            }
            throw new IOException(resp.getStatusCode() + " " + resp.getBodyAsString());
        }

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            response = handleBodyResponse(resp);
        }
View Full Code Here

        }
        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()) {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
                    throw new MatchFoundException();
                } else if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
                    throw new ModifiedException();
                }
            }
            throw new IOException(resp.getStatusCode() + " " + resp.getBodyAsString());
        }

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            response = handleBodyResponse(resp);
        } else if(storeMeta.hasReturnHead() && storeMeta.getReturnHead()) {
View Full Code Here

            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

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

        StoreResponse r = riak.store(this, meta);
        if (r.isSuccess()) {
            this.updateMeta(r);
        }
        return r;
    }
View Full Code Here

     *             If an error occurs during communication with the Riak server.
     * @throws RiakResponseException
     *             If the server does not succesfully store the object.
     */
    public void store(RiakObject object, RequestMeta meta) throws RiakIOException, RiakResponseException {
        StoreResponse r = impl.store(object, meta);

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

        object.updateMeta(r);
    }
View Full Code Here

        }
        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()) {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
                    throw new MatchFoundException();
                } else if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
                    throw new ModifiedException();
                }
            }
            throw new IOException(resp.getStatusCode() + " " + resp.getBodyAsString());
        }

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            response = handleBodyResponse(resp);
        } else if(storeMeta.hasReturnHead() && storeMeta.getReturnHead()) {
View Full Code Here

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

        StoreResponse r = riak.store(this, meta);
        if (r.isSuccess()) {
            this.updateMeta(r);
        }
        return r;
    }
View Full Code Here

        }
        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()) {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
                    throw new MatchFoundException();
                } else if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
                    throw new ModifiedException();
                }
            }
            throw new IOException(resp.getStatusCode() + " " + resp.getBodyAsString());
        }

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            response = handleBodyResponse(resp);
        } else if(storeMeta.hasReturnHead() && storeMeta.getReturnHead()) {
View Full Code Here

        }
        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()) {
            if (resp.getStatusCode() == HttpStatus.SC_PRECONDITION_FAILED) {
                if (storeMeta.hasIfNoneMatch() && storeMeta.getIfNoneMatch()) {
                    throw new MatchFoundException();
                } else if (storeMeta.hasIfNotModified() && storeMeta.getIfNotModified()) {
                    throw new ModifiedException();
                }
            }
            throw new IOException(resp.getStatusCode() + " " + resp.getBodyAsString());
        }

        if (storeMeta.hasReturnBody() && storeMeta.getReturnBody()) {
            response = handleBodyResponse(resp);
        } else if(storeMeta.hasReturnHead() && storeMeta.getReturnHead()) {
View Full Code Here

TOP

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

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.