@Override public boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500) || e instanceof JsonStreamingEOFException; }
private EmoApiKey getApiKeyFromResponse(EmoResponse response) { if (response.getStatus() == Response.Status.OK.getStatusCode()) { return response.getEntity(EmoApiKey.class); } else if (response.getStatus() == Response.Status.NOT_FOUND.getStatusCode()) { return null; } throw convertException(new EmoClientException(response)); }
@Override public Map<StashTimeKey, StashRunTimeInfo> getAllStashTimes() { try { URI uri = _compactionControlSource.clone() .segment("_compcontrol", "stash-time") .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 Iterator<EmoRole> getAllRoles(String apiKey) { try { URI uri = _uac.clone() .segment("role") .build(); return _client.resource(uri) .accept(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) .get(new TypeReference<Iterator<EmoRole>>(){}); } 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); } }
@Override public Map<StashTimeKey, StashRunTimeInfo> getAllStashTimes() { try { URI uri = _compactionControlSource.clone() .segment("_compcontrol", "stash-time") .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 boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500) || e instanceof JsonStreamingEOFException; }
@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 boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500); }
@Override public boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500) || e instanceof JsonStreamingEOFException; }
@Override public boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500) || e instanceof JsonStreamingEOFException; }
@Override public boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500) || e instanceof JsonStreamingEOFException; }
@Override public boolean isRetriableException(Exception e) { return (e instanceof EmoClientException && ((EmoClientException) e).getResponse().getStatus() >= 500); }