@Override public Notification createNotification(String bucket, Notification notification) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_CREATE_NOTIFICATION); Scope scope = tracer.withSpan(span); try { return storage.notifications().insert(bucket, notification).execute(); } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } }
@Override public List<Notification> listNotifications(String bucket) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_LIST_NOTIFICATIONS); Scope scope = tracer.withSpan(span); try { return storage.notifications().list(bucket).execute().getItems(); } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } }
@Override public boolean deleteNotification(String bucket, String notification) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_DELETE_NOTIFICATION); Scope scope = tracer.withSpan(span); try { storage.notifications().delete(bucket, notification).execute(); return true; } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); StorageException serviceException = translate(ex); if (serviceException.getCode() == HTTP_NOT_FOUND) { return false; } throw serviceException; } finally { scope.close(); span.end(); } }
@Override public Notification createNotification(String bucket, Notification notification) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_CREATE_NOTIFICATION); Scope scope = tracer.withSpan(span); try { return storage.notifications().insert(bucket, notification).execute(); } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } }
@Override public List<Notification> listNotifications(String bucket) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_LIST_NOTIFICATIONS); Scope scope = tracer.withSpan(span); try { return storage.notifications().list(bucket).execute().getItems(); } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); throw translate(ex); } finally { scope.close(); span.end(); } }
@Override public boolean deleteNotification(String bucket, String notification) { Span span = startSpan(HttpStorageRpcSpans.SPAN_NAME_DELETE_NOTIFICATION); Scope scope = tracer.withSpan(span); try { storage.notifications().delete(bucket, notification).execute(); return true; } catch (IOException ex) { span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage())); StorageException serviceException = translate(ex); if (serviceException.getCode() == HTTP_NOT_FOUND) { return false; } throw serviceException; } finally { scope.close(); span.end(); } }