本文整理了Java中org.apache.jackrabbit.core.data.DataStore.getRecordFromReference()
方法的一些代码示例,展示了DataStore.getRecordFromReference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.getRecordFromReference()
方法的具体详情如下:
包路径:org.apache.jackrabbit.core.data.DataStore
类名称:DataStore
方法名:getRecordFromReference
[英]Returns the record that matches the given binary reference. Returns null if the reference is invalid, for example if it points to a record that does not exist.
[中]返回与给定二进制引用匹配的记录。如果引用无效(例如,如果它指向不存在的记录),则返回null。
代码示例来源:origin: apache/jackrabbit-oak
@Override
public DataRecord getRecordFromReference(String reference) throws DataStoreException {
return delegate.getRecordFromReference(reference);
}
代码示例来源:origin: apache/jackrabbit
public DataRecord getRecordFromReference(String reference)
throws DataStoreException {
DataRecord record = primaryDataStore.getRecordFromReference(reference);
if (record == null) {
record = archiveDataStore.getRecordFromReference(reference);
}
return record;
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-data
public DataRecord getRecordFromReference(String reference)
throws DataStoreException {
DataRecord record = primaryDataStore.getRecordFromReference(reference);
if (record == null) {
record = archiveDataStore.getRecordFromReference(reference);
}
return record;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
public DataRecord getRecordFromReference(String reference)
throws DataStoreException {
DataRecord record = primaryDataStore.getRecordFromReference(reference);
if (record == null) {
record = archiveDataStore.getRecordFromReference(reference);
}
return record;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public DataRecord getRecordFromReference(String reference) throws DataStoreException {
return delegate.getRecordFromReference(reference);
}
代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins
@Override
public DataRecord getRecordFromReference(String reference) throws DataStoreException {
return delegate.getRecordFromReference(reference);
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public String getBlobId(@NotNull String reference) {
checkNotNull(reference);
DataRecord record;
try {
record = delegate.getRecordFromReference(reference);
if (record != null) {
return getBlobId(record);
}
} catch (DataStoreException e) {
log.warn("Unable to access the blobId for [{}]", reference, e);
}
return null;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public String getBlobId(@Nonnull String reference) {
checkNotNull(reference);
DataRecord record;
try {
record = delegate.getRecordFromReference(reference);
if (record != null) {
return getBlobId(record);
}
} catch (DataStoreException e) {
log.warn("Unable to access the blobId for [{}]", reference, e);
}
return null;
}
代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins
@Override
public String getBlobId(@NotNull String reference) {
checkNotNull(reference);
DataRecord record;
try {
record = delegate.getRecordFromReference(reference);
if (record != null) {
return getBlobId(record);
}
} catch (DataStoreException e) {
log.warn("Unable to access the blobId for [{}]", reference, e);
}
return null;
}
代码示例来源:origin: apache/jackrabbit
private void assertReference(
byte[] expected, String reference, DataStore store)
throws Exception {
DataRecord record = store.getRecordFromReference(reference);
assertNotNull(record);
assertEquals(expected.length, record.getLength());
InputStream stream = record.getStream();
try {
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i] & 0xff, stream.read());
}
assertEquals(-1, stream.read());
} finally {
stream.close();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void assertReferenceKey() throws Exception {
byte[] data = new byte[dataLength];
randomGen.nextBytes(data);
DataRecord rec = ds.addRecord(new ByteArrayInputStream(data));
Assert.assertEquals(data.length, rec.getLength());
assertRecord(data, rec);
DataRecord refRec = ds.getRecordFromReference(rec.getReference());
assertRecord(data, refRec);
// Check bytes retrieved from reference.key file
File refFile = new File(fsBackendPath, "reference.key");
assertTrue(refFile.exists());
byte[] keyRet = FileUtils.readFileToByteArray(refFile);
assertTrue(keyRet.length != 0);
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* Assert inputstream read from reference.
*/
protected void assertReference(byte[] expected, String reference,
DataStore store) throws Exception {
DataRecord record = store.getRecordFromReference(reference);
assertNotNull(record);
Assert.assertEquals(expected.length, record.getLength());
InputStream stream = record.getStream();
try {
assertTrue("binary not equal",
org.apache.commons.io.IOUtils.contentEquals(
new ByteArrayInputStream(expected), stream));
} finally {
stream.close();
}
}
代码示例来源:origin: apache/jackrabbit
/**
* Assert inputstream read from reference.
*/
protected void assertReference(byte[] expected, String reference,
DataStore store) throws Exception {
DataRecord record = store.getRecordFromReference(reference);
assertNotNull(record);
assertEquals(expected.length, record.getLength());
InputStream stream = record.getStream();
try {
assertTrue("binary not equal",
org.apache.commons.io.IOUtils.contentEquals(
new ByteArrayInputStream(expected), stream));
} finally {
stream.close();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testReference() throws DataStoreException, IOException {
String reference = "testReference";
String blobId = "test";
DataIdentifier testDI = new DataIdentifier(blobId);
DataRecord testDR = new ByteArrayDataRecord("foo".getBytes(), testDI, reference);
DataStore mockedDS = mock(DataStore.class);
when(mockedDS.getRecordFromReference(reference)).thenReturn(testDR);
when(mockedDS.getRecord(testDI)).thenReturn(testDR);
when(mockedDS.getRecordIfStored(testDI)).thenReturn(testDR);
DataStoreBlobStore ds = new DataStoreBlobStore(mockedDS);
assertEquals(reference,ds.getReference(blobId));
assertEquals(blobId, BlobId.of(ds.getBlobId(reference)).blobId);
assertEquals(BlobId.of(testDR).encodedValue(),ds.getBlobId(reference));
String inMemBlobId = InMemoryDataRecord.getInstance("foo".getBytes())
.getIdentifier().toString();
//For in memory record the reference should be null
assertNull(ds.getReference(inMemBlobId));
}
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
} else if (binary instanceof ReferenceBinary) {
String reference = ((ReferenceBinary) binary).getReference();
DataRecord record = store.getRecordFromReference(reference);
if (record != null) {
return new BinaryValueImpl(BLOBInDataStore.getInstance(
代码示例来源:origin: apache/jackrabbit
} else if (binary instanceof ReferenceBinary) {
String reference = ((ReferenceBinary) binary).getReference();
DataRecord record = store.getRecordFromReference(reference);
if (record != null) {
return new BinaryValueImpl(BLOBInDataStore.getInstance(
内容来源于网络,如有侵权,请联系作者删除!