@Override public void delete(Record record) throws RepositoryException, InterruptedException { try { lilyProxy.delete(converter.convert(record.getId()), null, record.getAttributes()); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } }
@Override public Record create(Record record) throws RepositoryException, InterruptedException { try { return converter.convertRecord(lilyProxy.create(converter.convert(record))); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } }
@Override public Set<RecordId> getVariants(RecordId recordId) throws RepositoryException, InterruptedException { try { return converter.convertAvroRecordIds(lilyProxy.getVariants(converter.convert(recordId))); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } }
@Override public Record delete(RecordId recordId, List<MutationCondition> conditions) throws RepositoryException, InterruptedException { try { ByteBuffer record = lilyProxy.delete(converter.convert(recordId), converter.convert(null, conditions), null); return record == null ? null : converter.convertRecord(record); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } }
private RuntimeException handleAvroRemoteException(AvroRemoteException e) throws RecordException { // AvroRemoteException's are exceptions which are not declared in the avro protocol and // which are not RuntimeException's. if (e.getCause() instanceof IOException) { throw new IORecordException(e.getCause()); } else { throw converter.convert(e); } }
@Override public Record update( Record record, boolean updateVersion, boolean useLatestRecordType, List<MutationCondition> conditions) throws RepositoryException, InterruptedException { try { return converter.convertRecord( lilyProxy.update( converter.convert(record), updateVersion, useLatestRecordType, converter.convert(record, conditions))); } catch (AvroRepositoryException e) { throw converter.convert(e); } catch (AvroGenericException e) { throw converter.convert(e); } catch (AvroRemoteException e) { throw handleAvroRemoteException(e); } catch (UndeclaredThrowableException e) { throw handleUndeclaredRecordThrowable(e); } }