Package org.springframework.data.keyvalue.riak

Examples of org.springframework.data.keyvalue.riak.DataStoreOperationException


      restTemplate.put(defaultUri, entity, bucket, keyName);
      if (log.isDebugEnabled()) {
        log.debug(String.format("PUT object: bucket=%s, key=%s, value=%s", bucket, key, value));
      }
    } catch (RestClientException e) {
      throw new DataStoreOperationException(e.getMessage(), e);
    }
    return this;
  }
View Full Code Here


      if (log.isDebugEnabled()) {
        log.debug("New ID: " + id);
      }
      return id;
    } catch (RestClientException e) {
      throw new DataStoreOperationException(e.getMessage(), e);
    }
  }
View Full Code Here

              bucketName,
              key);
          try {
            val = extractValue(result, origType, requiredType);
          } catch (IOException ioe) {
            throw new DataStoreOperationException(ioe.getMessage(), ioe);
          }
          break;
        case NOT_FOUND:
          // IGNORED
          break;
        default:
          throw new DataStoreOperationException(e.getMessage(), e);
      }
      if (e.getStatusCode() != HttpStatus.NOT_FOUND) {
        throw new DataStoreOperationException(e.getMessage(), e);
      }
    } catch (RestClientException rce) {
      if (rce.getMessage().contains("HTTP response code: 406")) {
        // Can't convert using HttpMessageConverter. Try fetching as the original type
        // and using the conversion service to convert.
        ResponseEntity<?> result = restTemplate.getForEntity(defaultUri,
            origType,
            bucketName,
            key);
        try {
          val = extractValue(result, origType, requiredType);
        } catch (IOException ioe) {
          throw new DataStoreOperationException(rce.getMessage(), rce);
        }
      } else {
        // IGNORE
        if (log.isDebugEnabled()) {
          log.debug("RestClientException: " + rce.getMessage());
View Full Code Here

        cache.put(new SimpleBucketKeyPair(bucket, key), bytes);
      }
      return bytes;
    } catch (HttpClientErrorException e) {
      if (e.getStatusCode() != HttpStatus.NOT_FOUND) {
        throw new DataStoreOperationException(e.getMessage(), e);
      }
    } catch (RestClientException e) {
      throw new DataStoreOperationException(e.getMessage(), e);
    }
    return null;
  }
View Full Code Here

          }
        }
        return (T) resp.getBody();
      }
    } catch (RestClientException e) {
      throw new DataStoreOperationException(e.getMessage(), e);
    }
    return null;
  }
View Full Code Here

    RestTemplate restTemplate = getRestTemplate();

    // Skip all conversion on the data since all we care about is the Link header.
    RiakValue<byte[]> fromObj = getAsBytesWithMetaData(sourceBucket, sourceKey);
    if (null == fromObj) {
      throw new DataStoreOperationException(
          "Cannot link from a non-existent source: " + sourceBucket + ":" + sourceKey);
    }
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(fromObj.getMetaData().getContentType());
    headers.set(RIAK_VCLOCK, fromObj.getMetaData().getProperties().get(RIAK_VCLOCK).toString());
View Full Code Here

        bucket,
        (listKeys ? "?keys=true" : ""));
    if (resp.hasBody()) {
      return resp.getBody();
    } else {
      throw new DataStoreOperationException(
          "Error encountered retrieving bucket schema (Status: " + resp.getStatusCode() + ")");
    }
  }
View Full Code Here

          meta.setBucket((null != bucket ? bucket.toString() : null));
          meta.setKey((null != key ? key.toString() : null));
          return callback.completed(meta, entity.getBody());
        }
      } catch (Throwable t) {
        DataStoreOperationException dsoe = new DataStoreOperationException(t.getMessage(), t);
        if (null != callback) {
          return callback.failed(dsoe);
        } else {
          defaultErrorHandler.failed(dsoe);
        }
View Full Code Here

          meta.setBucket((null != bucket ? bucket.toString() : null));
          meta.setKey((null != key ? key.toString() : null));
          return callback.completed(meta, (V) result.getBody());
        }
      } catch (Throwable t) {
        DataStoreOperationException dsoe = new DataStoreOperationException(t.getMessage(), t);
        if (null != callback) {
          return callback.failed(dsoe);
        } else {
          defaultErrorHandler.failed(dsoe);
        }
View Full Code Here

        if (null != callback) {
          RiakMetaData meta = extractMetaData(result.getHeaders());
          return callback.completed(meta, result.getBody());
        }
      } catch (Throwable t) {
        DataStoreOperationException dsoe = new DataStoreOperationException(t.getMessage(), t);
        if (null != callback) {
          return callback.failed(dsoe);
        } else {
          defaultErrorHandler.failed(dsoe);
        }
View Full Code Here

TOP

Related Classes of org.springframework.data.keyvalue.riak.DataStoreOperationException

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.