@Override public void delete(String apiKey, String table, String blobId) { checkNotNull(table, "table"); checkNotNull(blobId, "blobId"); try { _client.resource(toUri(table, blobId)) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .delete(); } catch (EmoClientException e) { throw convertException(e); } }
@Override public void delete(String apiKey, String table, String blobId) { checkNotNull(table, "table"); checkNotNull(blobId, "blobId"); try { _client.resource(toUri(table, blobId)) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .delete(); } catch (EmoClientException e) { throw convertException(e); } }
protected void doUnclaimAll(String apiKey, String queue) { checkNotNull(queue, "queue"); try { URI uri = _queueService.clone() .segment(queue, "unclaimall") .queryParam("partitioned", _partitionSafe) .build(); _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .post(); } catch (EmoClientException e) { throw convertException(e); } }
protected void doPurge(String apiKey, String queue) { checkNotNull(queue, "queue"); try { URI uri = _queueService.clone() .segment(queue) .queryParam("partitioned", _partitionSafe) .build(); _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .delete(); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Map<StashTimeKey, StashRunTimeInfo> getStashTimesForPlacement(String placement) { checkNotNull(placement, "placement"); try { URI uri = _compactionControlSource.clone() .segment("_compcontrol", "stash-time") .queryParam("placement", placement) .build(); return _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, _apiKey) .get(Map.class); } catch (UniformInterfaceException e) { throw convertException(e); } }
@Override public Subscription getSubscription(String apiKey, String subscription) throws UnknownSubscriptionException { checkNotNull(subscription, "subscription"); try { URI uri = _databus.clone() .segment(subscription) .build(); return _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Subscription.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public void unsubscribe(String apiKey, @PartitionKey String subscription) { checkNotNull(subscription, "subscription"); try { URI uri = _databus.clone() .segment(subscription) .queryParam("partitioned", _partitionSafe) .build(); _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .delete(); } catch (EmoClientException e) { throw convertException(e); } }
protected long doGetClaimCount(String apiKey, String queue) { checkNotNull(queue, "queue"); try { URI uri = _queueService.clone() .segment(queue, "claimcount") .queryParam("partitioned", _partitionSafe) .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Long.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Map<StashTimeKey, StashRunTimeInfo> getStashTimesForPlacement(String placement) { checkNotNull(placement, "placement"); try { URI uri = _compactionControlSource.clone() .segment("_compcontrol", "stash-time") .queryParam("placement", placement) .build(); return _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, _apiKey) .get(Map.class); } catch (UniformInterfaceException e) { throw convertException(e); } }
protected List<Message> doPeek(String apiKey, String queue, int limit, boolean partitioned) { checkNotNull(queue, "queue"); try { URI uri = _queueService.clone() .segment(queue, "peek") .queryParam("limit", limit) .queryParam("partitioned", optional(partitioned ? _partitionSafe : null)) .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(new TypeReference<List<Message>>() {}); } catch (EmoClientException e) { throw convertException(e); } }
@Override public void dropTable(String apiKey, String table, Audit audit) throws UnknownTableException { checkNotNull(table, "table"); checkNotNull(audit, "audit"); URI uri = _blobStore.clone() .segment("_table", table) .queryParam("audit", RisonHelper.asORison(audit)) .build(); try { _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .delete(); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Map<String, Object> getTableTemplate(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _dataStore.clone() .segment("_table", table) .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(new TypeReference<Map<String,Object>>(){}); } catch (EmoClientException e) { throw convertException(e); } }
@Override public TableOptions getTableOptions(String apiKey, String table) throws UnknownTableException { checkNotNull(table, "table"); try { URI uri = _blobStore.clone() .segment("_table", table, "options") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(TableOptions.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public TableOptions getTableOptions(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _dataStore.clone() .segment("_table", table, "options") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(TableOptions.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public long getTableApproximateSize(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _dataStore.clone() .segment("_table", table, "size") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Long.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Table getTableMetadata(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _dataStore.clone() .segment("_table", table, "metadata") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Table.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public long getTableApproximateSize(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _blobStore.clone() .segment("_table", table, "size") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Long.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public Table getTableMetadata(String apiKey, String table) { checkNotNull(table, "table"); try { URI uri = _dataStore.clone() .segment("_table", table, "metadata") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(Table.class); } catch (EmoClientException e) { throw convertException(e); } }
@Override public MoveSubscriptionStatus getMoveStatus(String apiKey, String reference) { checkNotNull(reference, "reference"); try { URI uri = _databus.clone() .segment("_move") .segment(reference) .build(); return _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(MoveSubscriptionStatus.class); } catch (EmoClientException e) { throw convertException(e); } }
protected MoveQueueStatus doGetMoveStatus(String apiKey, String reference) { checkNotNull(reference, "reference"); try { URI uri = _queueService.clone() .segment("_move") .segment(reference) .build(); return _client.resource(uri) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(MoveQueueStatus.class); } catch (EmoClientException e) { throw convertException(e); } }