@ParametersAreNonnullByDefault public final class DefaultFileSystemAttachmentStore extends Object implements FileSystemAttachmentStore
StreamAttachmentStore.Factory| Constructor and Description |
|---|
DefaultFileSystemAttachmentStore(AttachmentDirectoryAccessor directoryAccessor,
LocalTemporaryFileStore localTemporaryFileStore,
ExecutorServiceWrapper managedExecutor,
com.atlassian.event.api.EventPublisher eventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
copyAttachment(AttachmentKey sourceAttachmentKey,
AttachmentKey newAttachmentKey)
Copies attachment identified by
oldAttachmentKey to be identified also by newAttachmentKey. |
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
deleteAttachment(AttachmentKey attachmentKey)
Delete the attachment identified by provided attachmentKey.
|
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
deleteAttachmentContainerForIssue(Issue issue)
Delete the container for attachments for a given issue.
|
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
deleteTemporaryAttachment(TemporaryAttachmentId temporaryAttachmentId)
Deletes temporary attachment created previously by
StreamAttachmentStore.putTemporaryAttachment(java.io.InputStream, long). |
com.atlassian.fugue.Option<ErrorCollection> |
errors()
Health status for this component.
|
com.atlassian.util.concurrent.Promise<Boolean> |
exists(AttachmentKey attachmentKey)
Checks if attachment exists.
|
<A> com.atlassian.util.concurrent.Promise<A> |
getAttachment(AttachmentKey attachmentKey,
com.atlassian.util.concurrent.Function<InputStream,A> inputStreamProcessor)
Retrieve data for a given attachment.
|
<A> com.atlassian.util.concurrent.Promise<A> |
getAttachmentData(AttachmentKey attachmentKey,
com.atlassian.util.concurrent.Function<AttachmentGetData,A> attachmentGetDataProcessor)
Retrieve data for a given attachment.
|
File |
getAttachmentFile(AttachmentKey attachmentKey)
Returns the physical File for the given attachment key.
|
File |
getAttachmentFile(AttachmentStore.AttachmentAdapter attachment,
File attachmentDir)
This is intended for cases where you want more control over where the attachment actually lives and you just want
something to handle the look up logic for the various possible filenames an attachment can have.
|
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
moveAttachment(AttachmentKey oldAttachmentKey,
AttachmentKey newAttachmentKey)
Move attachment identified by
oldAttachmentKey to be identified by newAttachmentKey and will be not
reachable under oldAttachmentKey anymore. |
com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> |
moveTemporaryToAttachment(TemporaryAttachmentId temporaryAttachmentId,
AttachmentKey destinationKey)
Moving temporary attachment created by
StreamAttachmentStore.putTemporaryAttachment(java.io.InputStream, long) to real attachment. |
com.atlassian.util.concurrent.Promise<StoreAttachmentResult> |
putAttachment(StoreAttachmentBean storeAttachmentBean)
Store attachment data for a given attachment.
|
com.atlassian.util.concurrent.Promise<TemporaryAttachmentId> |
putTemporaryAttachment(InputStream inputStream,
long size)
Creates temporaryAttachment in store which can be later moved to attachment via
StreamAttachmentStore.moveTemporaryToAttachment(TemporaryAttachmentId, AttachmentKey) |
public DefaultFileSystemAttachmentStore(AttachmentDirectoryAccessor directoryAccessor, LocalTemporaryFileStore localTemporaryFileStore, ExecutorServiceWrapper managedExecutor, com.atlassian.event.api.EventPublisher eventPublisher)
public File getAttachmentFile(AttachmentKey attachmentKey) throws DataAccessException
getAttachmentFile in interface FileBasedAttachmentStoreattachmentKey - the key of attachmentDataAccessException - on failure getting required attachment info.public File getAttachmentFile(AttachmentStore.AttachmentAdapter attachment, File attachmentDir)
getAttachmentFile in interface FileBasedAttachmentStoreattachment - it's not an attachment but it acts like one for our purposes.attachmentDir - the directory the attachments live in. This is different that the system-wide attachment
directory. i.e. this would "attachments/MKY/MKY-1" and not just "attachments"@Nonnull public com.atlassian.util.concurrent.Promise<StoreAttachmentResult> putAttachment(@Nonnull StoreAttachmentBean storeAttachmentBean)
StreamAttachmentStoreputAttachment in interface StreamAttachmentStorestoreAttachmentBean - attachment metadata, used to determine the logical key under which to store the
attachment dataAttachmentRuntimeException in case of error.public <A> com.atlassian.util.concurrent.Promise<A> getAttachment(AttachmentKey attachmentKey, com.atlassian.util.concurrent.Function<InputStream,A> inputStreamProcessor)
StreamAttachmentStoregetAttachment in interface StreamAttachmentStoreA - The class that the inputStreamProcessor returns when run.attachmentKey - The key of attachment used to identify attachment datainputStreamProcessor - Function that processes the attachment data.AttachmentRuntimeException in case of error.public <A> com.atlassian.util.concurrent.Promise<A> getAttachmentData(AttachmentKey attachmentKey, com.atlassian.util.concurrent.Function<AttachmentGetData,A> attachmentGetDataProcessor)
StreamAttachmentStoregetAttachmentData in interface StreamAttachmentStoreA - The class that the attachmentGetDataProcessor returns when run.attachmentKey - The key of attachment used to identify attachment dataattachmentGetDataProcessor - Function that processes the attachment data.AttachmentRuntimeException in case of error.public com.atlassian.util.concurrent.Promise<Boolean> exists(AttachmentKey attachmentKey)
StreamAttachmentStoreexists in interface StreamAttachmentStoreattachmentKey - key of attachment to check for existencePromise to boolean result, true if attachment exists and false
otherwisepublic com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> deleteAttachment(AttachmentKey attachmentKey)
StreamAttachmentStoredeleteAttachment in interface StreamAttachmentStorepublic com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> deleteAttachmentContainerForIssue(Issue issue)
FileBasedAttachmentStoredeleteAttachmentContainerForIssue in interface FileBasedAttachmentStoreissue - The issue to delete attachments for.public com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> moveAttachment(AttachmentKey oldAttachmentKey, AttachmentKey newAttachmentKey)
StreamAttachmentStoreoldAttachmentKey to be identified by newAttachmentKey and will be not
reachable under oldAttachmentKey anymore.moveAttachment in interface StreamAttachmentStoreoldAttachmentKey - the old AttachmentKeynewAttachmentKey - the new AttachmentKey@Nonnull public com.atlassian.fugue.Option<ErrorCollection> errors()
AttachmentHealtherrors in interface AttachmentHealthpublic com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> copyAttachment(AttachmentKey sourceAttachmentKey, AttachmentKey newAttachmentKey)
StreamAttachmentStoreoldAttachmentKey to be identified also by newAttachmentKey.copyAttachment in interface StreamAttachmentStoresourceAttachmentKey - attachmentKey of existing attachment which should be copiednewAttachmentKey - attachmentKey under which copiedpublic com.atlassian.util.concurrent.Promise<TemporaryAttachmentId> putTemporaryAttachment(InputStream inputStream, long size)
StreamAttachmentStoreStreamAttachmentStore.moveTemporaryToAttachment(TemporaryAttachmentId, AttachmentKey)putTemporaryAttachment in interface StreamAttachmentStoreinputStream - stream to temporary attachment datasize - the size of provided streampublic com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> moveTemporaryToAttachment(TemporaryAttachmentId temporaryAttachmentId, AttachmentKey destinationKey)
StreamAttachmentStoreStreamAttachmentStore.putTemporaryAttachment(java.io.InputStream, long) to real attachment.moveTemporaryToAttachment in interface StreamAttachmentStoretemporaryAttachmentId - id of temporary attachment, returned by StreamAttachmentStore.putTemporaryAttachment(java.io.InputStream, long)destinationKey - destination key of under which attachment will be identifiedpublic com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> deleteTemporaryAttachment(TemporaryAttachmentId temporaryAttachmentId)
StreamAttachmentStoreStreamAttachmentStore.putTemporaryAttachment(java.io.InputStream, long).deleteTemporaryAttachment in interface StreamAttachmentStoretemporaryAttachmentId - id of temporary attachmentCopyright © 2002-2016 Atlassian. All Rights Reserved.