com.atlassian.jira.issue.attachment
Interface FileBasedAttachmentStore

All Superinterfaces:
AttachmentHealth, StreamAttachmentStore
All Known Subinterfaces:
FileSystemAttachmentStore
All Known Implementing Classes:
BackwardCompatibleStoreAdapter, DefaultFileSystemAttachmentStore

public interface FileBasedAttachmentStore
extends StreamAttachmentStore

Interface for an attachment store that presents a File-based interface for accessing attachments. TODO - We should be able to remove this once we provide sufficient methods in SimpleAttachmentStore to eliminate access to attachments via files.

Since:
v6.3

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.issue.attachment.StreamAttachmentStore
StreamAttachmentStore.Factory
 
Method Summary
 com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> deleteAttachmentContainerForIssue(Issue issue)
          Delete the container for attachments for a given issue.
 File getAttachmentFile(AttachmentKey attachmentKey)
          Returns the physical File for the given Attachment.
 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.
 
Methods inherited from interface com.atlassian.jira.issue.attachment.StreamAttachmentStore
copyAttachment, deleteAttachment, deleteTemporaryAttachment, exists, getAttachment, getAttachmentData, moveAttachment, moveTemporaryToAttachment, putAttachment, putTemporaryAttachment
 
Methods inherited from interface com.atlassian.jira.issue.attachment.AttachmentHealth
errors
 

Method Detail

getAttachmentFile

File getAttachmentFile(AttachmentKey attachmentKey)
                       throws DataAccessException
Returns the physical File for the given Attachment. If you are calling this on multiple attachments for the same issue, consider using the overriden method that passes in the issue. Else, this goes to the database for each call.

Parameters:
attachmentKey - the the key of the attachment
Returns:
the file.
Throws:
DataAccessException - on failure getting required attachment info.

getAttachmentFile

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.

In practice, this is just used during Project Import

Parameters:
attachment - 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"
Returns:
the actual attachment

deleteAttachmentContainerForIssue

com.atlassian.util.concurrent.Promise<com.atlassian.fugue.Unit> deleteAttachmentContainerForIssue(@Nonnull
                                                                                                  Issue issue)
Delete the container for attachments for a given issue. For file systems, this means the attachment directory for that issue.

Parameters:
issue - The issue to delete attachments for.
Returns:
A promise that will contain a AttachmentCleanupException if there is a problem deleting the attachment directory.


Copyright © 2002-2015 Atlassian. All Rights Reserved.