use of com.enonic.xp.blob.BlobStoreException in project xp by enonic.
the class AbstractDumpBlobStore method addRecord.
@Override
public BlobKey addRecord(final Segment segment, final ByteSource in) throws BlobStoreException {
try {
final BlobKey blobKey = BlobKey.from(in);
writeRecord(segment, blobKey, in);
return blobKey;
} catch (final IOException e) {
throw new BlobStoreException("Failed to add blob", e);
}
}
use of com.enonic.xp.blob.BlobStoreException in project xp by enonic.
the class FileBlobStore method deleteSegment.
@Override
public void deleteSegment(final Segment segment) {
try {
final Path segmentParentDirectory = this.baseDir.resolve(segment.getLevel(0).getValue());
final Path segmentDirectory = segmentParentDirectory.resolve(segment.getLevel(1).getValue());
if (Files.exists(segmentDirectory)) {
MoreFiles.deleteRecursively(segmentDirectory, RecursiveDeleteOption.ALLOW_INSECURE);
}
if (Files.exists(segmentParentDirectory) && nioFilesList(segmentParentDirectory).isEmpty()) {
Files.delete(segmentParentDirectory);
}
} catch (IOException e) {
throw new BlobStoreException("Failed to delete segment", e);
}
}
Aggregations