@Test void addFileTest() throws Exception { FileEntry fileEntry = addFile(TEST_FILE_LOCATION); assertFileExists(true, fileEntry); }
@Override public void addFile(FileEntry fileEntry, File file) throws FileStorageException { String entryName = fileEntry.getId(); long fileSize = fileEntry.getSize() .longValue(); Blob blob = blobStore.blobBuilder(entryName) .payload(file) .contentDisposition(fileEntry.getName()) .contentType(MediaType.OCTET_STREAM.toString()) .userMetadata(createFileEntryMetadata(fileEntry)) .build(); try { putBlobWithRetries(blob, 3); LOGGER.debug(MessageFormat.format(Messages.STORED_FILE_0_WITH_SIZE_1_SUCCESSFULLY_2, fileEntry.getId(), fileSize)); } catch (ContainerNotFoundException e) { throw new FileStorageException(MessageFormat.format(Messages.FILE_UPLOAD_FAILED, fileEntry.getName(), fileEntry.getNamespace())); } }
ObjectStoreFileStorage implements FileStorage { @Override public void addFile(FileEntry fileEntry, File file) throws FileStorageException { String entryName = fileEntry.getId(); long fileSize = fileEntry.getSize() .longValue(); Blob blob = blobStore.blobBuilder(entryName) .payload(file) .contentDisposition(fileEntry.getName()) .contentType(MediaType.OCTET_STREAM.toString()) .userMetadata(createFileEntryMetadata(fileEntry)) .build(); try { putBlobWithRetries(blob, 3); LOGGER.debug(MessageFormat.format(Messages.STORED_FILE_0_WITH_SIZE_1_SUCCESSFULLY_2, fileEntry.getId(), fileSize)); } catch (ContainerNotFoundException e) { throw new FileStorageException(MessageFormat.format(Messages.FILE_UPLOAD_FAILED, fileEntry.getName(), fileEntry.getNamespace())); } } }
ObjectStoreFileStorage implements FileStorage { @Override public void addFile(FileEntry fileEntry, File file) throws FileStorageException { String entryName = fileEntry.getId(); long fileSize = fileEntry.getSize() .longValue(); Blob blob = blobStore.blobBuilder(entryName) .payload(file) .contentDisposition(fileEntry.getName()) .contentType(MediaType.OCTET_STREAM.toString()) .userMetadata(createFileEntryMetadata(fileEntry)) .build(); try { putBlobWithRetries(blob, 3); LOGGER.debug(MessageFormat.format(Messages.STORED_FILE_0_WITH_SIZE_1_SUCCESSFULLY_2, fileEntry.getId(), fileSize)); } catch (ContainerNotFoundException e) { throw new FileStorageException(MessageFormat.format(Messages.FILE_UPLOAD_FAILED, fileEntry.getName(), fileEntry.getNamespace())); } } ObjectStoreFileStorage(BlobStore blobStore, String container); }
ObjectStoreFileStorage implements FileStorage { @Override public void addFile(FileEntry fileEntry, File file) throws FileStorageException { String entryName = fileEntry.getId(); long fileSize = fileEntry.getSize() .longValue(); Blob blob = blobStore.blobBuilder(entryName) .payload(file) .contentDisposition(fileEntry.getName()) .contentType(MediaType.OCTET_STREAM.toString()) .userMetadata(createFileEntryMetadata(fileEntry)) .build(); try { putBlobWithRetries(blob, 3); LOGGER.debug(MessageFormat.format(Messages.STORED_FILE_0_WITH_SIZE_1_SUCCESSFULLY_2, fileEntry.getId(), fileSize)); } catch (ContainerNotFoundException e) { throw new FileStorageException(MessageFormat.format(Messages.FILE_UPLOAD_FAILED, fileEntry.getName(), fileEntry.getNamespace())); } } ObjectStoreFileStorage(BlobStore blobStore, String container); @Override void addFile(FileEntry fileEntry, File file); @Override List<FileEntry> getFileEntriesWithoutContent(List<FileEntry> fileEntries); @Override void deleteFile(String id, String space); @Override void deleteFilesBySpace(String space); @Override void deleteFilesBySpaceAndNamespace(String space, String namespace); @Override int deleteFilesModifiedBefore(Date modificationTime); @Override T processFileContent(String space, String id, FileContentProcessor<T> fileContentProcessor); }
ObjectStoreFileStorage implements FileStorage { @Override public void addFile(FileEntry fileEntry, File file) throws FileStorageException { String entryName = fileEntry.getId(); long fileSize = fileEntry.getSize() .longValue(); Blob blob = blobStore.blobBuilder(entryName) .payload(file) .contentDisposition(fileEntry.getName()) .contentType(MediaType.OCTET_STREAM.toString()) .userMetadata(createFileEntryMetadata(fileEntry)) .build(); try { putBlobWithRetries(blob, 3); LOGGER.debug(MessageFormat.format(Messages.STORED_FILE_0_WITH_SIZE_1_SUCCESSFULLY_2, fileEntry.getId(), fileSize)); } catch (ContainerNotFoundException e) { throw new FileStorageException(MessageFormat.format(Messages.FILE_UPLOAD_FAILED, fileEntry.getName(), fileEntry.getNamespace())); } } ObjectStoreFileStorage(BlobStore blobStore, String container); @Override void addFile(FileEntry fileEntry, File file); @Override List<FileEntry> getFileEntriesWithoutContent(List<FileEntry> fileEntries); @Override void deleteFile(String id, String space); @Override void deleteFilesBySpace(String space); @Override void deleteFilesBySpaceAndNamespace(String space, String namespace); @Override int deleteFilesModifiedBefore(Date modificationTime); @Override T processFileContent(String space, String id, FileContentProcessor<T> fileContentProcessor);  }