/** * Checks if the given object is a data record with the same identifier * as this one. * * @param object other object * @return <code>true</code> if the other object is a data record and has * the same identifier as this one, <code>false</code> otherwise */ public boolean equals(Object object) { return (object instanceof DataRecord) && identifier.equals(((DataRecord) object).getIdentifier()); }
/** * Checks if the given object is a data record with the same identifier * as this one. * * @param object other object * @return <code>true</code> if the other object is a data record and has * the same identifier as this one, <code>false</code> otherwise */ public boolean equals(Object object) { return (object instanceof DataRecord) && identifier.equals(((DataRecord) object).getIdentifier()); }
/** * Checks if the given object is a data record with the same identifier * as this one. * * @param object other object * @return <code>true</code> if the other object is a data record and has * the same identifier as this one, <code>false</code> otherwise */ public boolean equals(Object object) { return (object instanceof DataRecord) && identifier.equals(((DataRecord) object).getIdentifier()); }
/** * Checks if the given object is a data record with the same identifier * as this one. * * @param object other object * @return <code>true</code> if the other object is a data record and has * the same identifier as this one, <code>false</code> otherwise */ public boolean equals(Object object) { return (object instanceof DataRecord) && identifier.equals(((DataRecord) object).getIdentifier()); }
@Override @Nullable public String apply(@Nonnull DataRecord input) { return SharedStoreRecordType.REPOSITORY.getIdFromName(input.getIdentifier().toString()); } }).keySet(),
@Override @Nullable public String apply(@Nonnull DataRecord input) { return SharedStoreRecordType.REFERENCES.getIdFromName(input.getIdentifier().toString()); } }).keySet());
@Override @Nullable public String apply(@NotNull DataRecord input) { return SharedStoreRecordType.REPOSITORY.getIdFromName(input.getIdentifier().toString()); } }).keySet(),
@Override @Nullable public String apply(@NotNull DataRecord input) { return SharedStoreRecordType.REFERENCES.getIdFromName(input.getIdentifier().toString()); } }).keySet());
private void addNewMapping(DataRecord dr) throws DataStoreException { if (dr != null) { newMappings.put(dr.getIdentifier().toString(), dr.getLength()); } }
BlobId(DataRecord dr) { this.blobId = dr.getIdentifier().toString(); long len; try { len = dr.getLength(); } catch (DataStoreException e) { //Cannot determine length len = -1; } this.length = len; }
static BLOBInDataStore getInstance(DataStore store, InputStream in) throws DataStoreException { DataRecord rec = store.addRecord(in); DataIdentifier identifier = rec.getIdentifier(); if (auditLogger.isDebugEnabled()) { auditLogger.debug("{} ({})", identifier, rec.getLength()); } return new BLOBInDataStore(store, identifier); }
BlobId(DataRecord dr) { this.blobId = dr.getIdentifier().toString(); long len; try { len = dr.getLength(); } catch (DataStoreException e) { //Cannot determine length len = -1; } this.length = len; }
static BLOBInDataStore getInstance(DataStore store, InputStream in) throws DataStoreException { DataRecord rec = store.addRecord(in); DataIdentifier identifier = rec.getIdentifier(); if (auditLogger.isDebugEnabled()) { auditLogger.debug("{} ({})", identifier, rec.getLength()); } return new BLOBInDataStore(store, identifier); }
private String getBlobId(DataRecord dr) { if (encodeLengthInId) { return BlobId.of(dr).encodedValue(); } return dr.getIdentifier().toString(); }
private String getBlobId(DataRecord dr) { if (encodeLengthInId) { return BlobId.of(dr).encodedValue(); } return dr.getIdentifier().toString(); }
private String getBlobId(DataRecord dr) { if (encodeLengthInId) { return BlobId.of(dr).encodedValue(); } return dr.getIdentifier().toString(); }
private static void delete(AbstractSharedCachingDataStore s3ds, List<DataRecord> recs) throws DataStoreException { for (DataRecord rec : recs) { if (null != rec) { s3ds.deleteRecord(rec.getIdentifier()); } } }
@Test public void testBackendGetRecord() throws IOException, DataStoreException { String recordData = "testData"; DataRecord record = ds.addRecord(new ByteArrayInputStream(recordData.getBytes())); DataRecord retrievedRecord = backend.getRecord(record.getIdentifier()); validateRecord(record, recordData, retrievedRecord); }
private void validateRecord(final DataRecord record, final String contents, final DataIdentifier identifier, final long length, final long lastModified) throws DataStoreException, IOException { validateRecord(record, contents, identifier, length, lastModified, true); }
@Test public void testCreateAndDeleteBlobHappyPath() throws DataStoreException, IOException { final DataRecord uploadedRecord = ds.addRecord(new ByteArrayInputStream(testBuffer)); DataIdentifier identifier = uploadedRecord.getIdentifier(); assertTrue(backend.exists(identifier)); assertTrue(0 != uploadedRecord.getLastModified()); assertEquals(testBuffer.length, uploadedRecord.getLength()); final DataRecord retrievedRecord = ds.getRecord(identifier); validateRecord(retrievedRecord, new String(testBuffer), uploadedRecord); ds.deleteRecord(identifier); assertFalse(backend.exists(uploadedRecord.getIdentifier())); }