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

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


    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.RawClient#ping()
     */
    public void ping() throws IOException {
        HttpResponse resp = client.ping();

        if(!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here


   
    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.RawClient#stats()
     */
    public NodeStats stats() throws IOException {
        HttpResponse r = client.stats();
        if (!r.isSuccess()) {
            throw new IOException("stats failed with status code: "
                + r.getStatusCode());
        } else {
            try {
                return new ObjectMapper().readValue(r.getBodyAsString(), NodeStats.class);
            } catch (IOException e) {
                throw new IOException("Could not parse stats JSON response, body: " + r.getBodyAsString(),e);
            }
        }
    }
View Full Code Here

     * @see
     * com.basho.riak.client.raw.RawClient#delete(com.basho.riak.newapi.bucket
     * .Bucket, java.lang.String)
     */
    public void delete(String bucket, String key) throws IOException {
        HttpResponse resp = client.delete(bucket, key);
        if (!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here

     * @see
     * com.basho.riak.client.raw.RawClient#delete(com.basho.riak.newapi.bucket
     * .Bucket, java.lang.String, int)
     */
    public void delete(String bucket, String key, int deleteQuorum) throws IOException {
        HttpResponse resp = client.delete(bucket, key, RequestMeta.deleteParams(deleteQuorum));
        if (!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.RawClient#delete(java.lang.String, java.lang.String, com.basho.riak.client.raw.DeleteMeta)
     */
    public void delete(String bucket, String key, DeleteMeta deleteMeta) throws IOException {
        HttpResponse resp = client.delete(bucket, key, convert(deleteMeta));
        if (!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here

     *
     * @see com.basho.riak.client.raw.RawClient#updateBucket(java.lang.String,
     * com.basho.riak.newapi.bucket.BucketProperties)
     */
    public void updateBucket(String name, BucketProperties bucketProperties) throws IOException {
        HttpResponse response = client.setBucketSchema(name, convert(bucketProperties));
        if (!response.isSuccess()) {
            throw new IOException(response.getBodyAsString());
        }
    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see RawClient#resetBucketProperties(java.lang.String)
     */
    public void resetBucketProperties(String bucketName) throws IOException {
        HttpResponse response = client.resetBucketSchema(bucketName);
        if (!response.isSuccess()) {
            throw new IOException(response.getBodyAsString());
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.RawClient#ping()
     */
    public void ping() throws IOException {
        HttpResponse resp = client.ping();

        if(!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here

   
    /* (non-Javadoc)
     * @see com.basho.riak.client.raw.RawClient#stats()
     */
    public NodeStats stats() throws IOException {
        HttpResponse r = client.stats();
        if (!r.isSuccess()) {
            throw new IOException("stats failed with status code: "
                + r.getStatusCode());
        } else {
            try {
                NodeStats.UndefinedStatDeserializer usd = new NodeStats.UndefinedStatDeserializer();
                SimpleModule module = new SimpleModule("UndefinedStatDeserializer",
                                                       new Version(1,0,0,null,null,null));
                module.addDeserializer(BigInteger.class, usd);
                return new ObjectMapper().registerModule(module).readValue(r.getBodyAsString(), NodeStats.class);
            } catch (IOException e) {
                throw new IOException("Could not parse stats JSON response, body: " + r.getBodyAsString(),e);
            }
        }
    }
View Full Code Here

     * @see
     * com.basho.riak.client.raw.RawClient#delete(com.basho.riak.newapi.bucket
     * .Bucket, java.lang.String)
     */
    public void delete(String bucket, String key) throws IOException {
        HttpResponse resp = client.delete(bucket, key);
        if (!resp.isSuccess()) {
            throw new IOException(resp.getBodyAsString());
        }
    }
View Full Code Here

TOP

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

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.