|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.attachment.DualAttachmentStore
public class DualAttachmentStore
AttachmentStore implementation that wraps around two AttachmentStores (a file system implementation, and a remote Blobstore implementation), and handles delegating to them appropriately given dark feature flags.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.atlassian.jira.issue.attachment.AttachmentStore |
---|
AttachmentStore.AttachmentAdapter |
Field Summary | |
---|---|
static String |
FS_ONLY
|
static String |
FS_PRIMARY
|
static String |
REMOTE_ONLY
|
static String |
REMOTE_PRIMARY
|
Constructor Summary | |
---|---|
DualAttachmentStore(FileSystemAttachmentStore fileSystem,
RemoteAttachmentStore remote,
FeatureManager featureManager,
AttachmentDirectoryAccessor directoryAccessor,
ThumbnailAccessor thumbnailAccessor)
|
Method Summary | ||
---|---|---|
void |
checkValidAttachmentDirectory(Issue issue)
Checks that the Attachment directory of the given issue is right to go - writable, accessible etc. |
|
void |
checkValidTemporaryAttachmentDirectory()
Checks that the temporary directory for attachment uploads is right to go - writable, accessible etc. |
|
com.atlassian.util.concurrent.Promise<Void> |
deleteAttachment(Attachment attachment)
Delete the specified attachment. |
|
com.atlassian.util.concurrent.Promise<Void> |
deleteAttachmentContainerForIssue(Issue issue)
Delete the container for attachments for a given issue. |
|
com.atlassian.fugue.Option<ErrorCollection> |
errors()
Health status for this component. |
|
|
getAttachment(Attachment metaData,
com.atlassian.util.concurrent.Function<InputStream,A> inputStreamProcessor)
Retrieve data for a given attachment. |
|
File |
getAttachmentDirectory(Issue issue)
Returns the physical directory of the attachments for the given issue. |
|
File |
getAttachmentDirectory(Issue issue,
boolean createDirectory)
Returns the physical directory of the attachments for the given issue. |
|
File |
getAttachmentDirectory(String issueKey)
|
|
File |
getAttachmentDirectory(String attachmentDirectory,
String projectKey,
String issueKey)
Get the attachment directory for the given attachment base directory, project key, and issue key. |
|
File |
getAttachmentFile(Attachment attachment)
Returns the physical File for the given Attachment. |
|
File |
getAttachmentFile(AttachmentStore.AttachmentAdapter adapter,
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. |
|
File |
getAttachmentFile(Issue issue,
Attachment attachment)
Returns the physical File for the given Attachment. |
|
File |
getLegacyThumbnailFile(Attachment attachment)
Returns the old legacy file name for thumbnails. |
|
File |
getTemporaryAttachmentDirectory()
|
|
File |
getThumbnailDirectory(Issue issue)
Returns the physical directory of the thumbnails for the given issue, creating if necessary. |
|
File |
getThumbnailFile(Attachment attachment)
Just like the attachments themselves, thumbnails can succumb to file system encoding problems. |
|
File |
getThumbnailFile(Issue issue,
Attachment attachment)
Returns the file handle for the given attachment's thumbnail. |
|
com.atlassian.util.concurrent.Promise<Void> |
move(Attachment metaData,
String newIssueKey)
Moves an attachment from its current issue under a new one |
|
com.atlassian.util.concurrent.Promise<Attachment> |
putAttachment(Attachment metadata,
File source)
Store attachment data for a given attachment. |
|
com.atlassian.util.concurrent.Promise<Attachment> |
putAttachment(Attachment metadata,
InputStream source)
Store attachment data for a given attachment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FS_ONLY
public static final String REMOTE_ONLY
public static final String FS_PRIMARY
public static final String REMOTE_PRIMARY
Constructor Detail |
---|
public DualAttachmentStore(@Nonnull FileSystemAttachmentStore fileSystem, @Nonnull RemoteAttachmentStore remote, @Nonnull FeatureManager featureManager, @Nonnull AttachmentDirectoryAccessor directoryAccessor, @Nonnull ThumbnailAccessor thumbnailAccessor)
Method Detail |
---|
@Nonnull public File getThumbnailDirectory(@Nonnull Issue issue)
AttachmentStore
getThumbnailDirectory
in interface AttachmentStore
issue
- the issue whose thumbnail directory you want
public File getAttachmentDirectory(@Nonnull String issueKey)
getAttachmentDirectory
in interface AttachmentStore
public File getAttachmentDirectory(@Nonnull Issue issue, boolean createDirectory)
AttachmentStore
getAttachmentDirectory
in interface AttachmentStore
issue
- the issue whose attachment directory you wantcreateDirectory
- If true, and the directory does not currently exist, then the directory is created.
public File getTemporaryAttachmentDirectory()
getTemporaryAttachmentDirectory
in interface AttachmentStore
public File getAttachmentDirectory(@Nonnull Issue issue)
AttachmentStore
getAttachmentDirectory
in interface AttachmentStore
issue
- the issue whose attachment directory you want
public File getAttachmentDirectory(String attachmentDirectory, String projectKey, String issueKey)
AttachmentStore
getAttachmentDirectory
in interface AttachmentStore
attachmentDirectory
- base of attachmentsprojectKey
- the project key the issue belongs toissueKey
- the issue key for the issue
public void checkValidAttachmentDirectory(Issue issue) throws AttachmentException
AttachmentStore
checkValidAttachmentDirectory
in interface AttachmentStore
issue
- the issue whose attachment directory to check.
AttachmentException
- if the directory is not writable or missing and cannot be created.public void checkValidTemporaryAttachmentDirectory() throws AttachmentException
AttachmentStore
checkValidTemporaryAttachmentDirectory
in interface AttachmentStore
AttachmentException
- if the directory is not writable or missing and cannot be created.public File getAttachmentFile(AttachmentStore.AttachmentAdapter adapter, File attachmentDir)
AttachmentStore
getAttachmentFile
in interface AttachmentStore
adapter
- 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 File getThumbnailFile(Attachment attachment)
AttachmentStore
getThumbnailFile
in interface AttachmentStore
attachment
- the attachment for which to get the thumbnail file
AttachmentStore.getThumbnailFile(com.atlassian.jira.issue.Issue, Attachment)
@Nonnull public File getThumbnailFile(@Nonnull Issue issue, Attachment attachment)
AttachmentStore
AttachmentStore.getThumbnailFile(Attachment)
if you already have the issue.
getThumbnailFile
in interface AttachmentStore
issue
- the issue to which the attachment belongsattachment
- the attachment for which to get the thumbnail file
AttachmentStore.getThumbnailFile(Attachment)
public File getLegacyThumbnailFile(Attachment attachment)
AttachmentStore
getLegacyThumbnailFile
in interface AttachmentStore
attachment
- the attachment in play
public File getAttachmentFile(Issue issue, Attachment attachment) throws DataAccessException
AttachmentStore
getAttachmentFile
in interface AttachmentStore
issue
- the issue the attachment belongs to.attachment
- the attachment.
DataAccessException
- on failure getting required attachment info.public File getAttachmentFile(Attachment attachment) throws DataAccessException
AttachmentStore
getAttachmentFile
in interface AttachmentStore
attachment
- the attachment.
DataAccessException
- on failure getting required attachment info.public com.atlassian.util.concurrent.Promise<Attachment> putAttachment(Attachment metadata, InputStream source)
AttachmentStore
putAttachment
in interface AttachmentStore
metadata
- attachment metadata, used to determine the logical key under which to store the attachment datasource
- source data. The attachment store will close this stream when it has completed.
The stream will be closed once the operation is complete.
AttachmentRuntimeException
in case of error.public com.atlassian.util.concurrent.Promise<Attachment> putAttachment(Attachment metadata, File source)
AttachmentStore
putAttachment
in interface AttachmentStore
metadata
- attachment metadata, used to determine the logical key under which to store the attachment datasource
- source data. It is assumed that the file will exist during the attachment process (i.e. relatively
long lived).
public <A> com.atlassian.util.concurrent.Promise<A> getAttachment(Attachment metaData, com.atlassian.util.concurrent.Function<InputStream,A> inputStreamProcessor)
AttachmentStore
getAttachment
in interface AttachmentStore
A
- The class that the inputStreamProcessor returns when run.metaData
- attachment metadata, used to determine the logical key under which to store the attachment datainputStreamProcessor
- Function that processes the attachment data.
AttachmentRuntimeException
in case of error.public com.atlassian.util.concurrent.Promise<Void> move(Attachment metaData, String newIssueKey)
AttachmentStore
move
in interface AttachmentStore
metaData
- attachment metadata, used to determine the logical key of the attachment to be moved.newIssueKey
- the key of the new issue under which the attachment will reside.
AttachmentRuntimeException
in case of error.public com.atlassian.util.concurrent.Promise<Void> deleteAttachment(@Nonnull Attachment attachment)
AttachmentStore
deleteAttachment
in interface AttachmentStore
public com.atlassian.util.concurrent.Promise<Void> deleteAttachmentContainerForIssue(@Nonnull Issue issue)
AttachmentStore
deleteAttachmentContainerForIssue
in interface AttachmentStore
issue
- The issue to delete attachments for.
public com.atlassian.fugue.Option<ErrorCollection> errors()
AttachmentStore
errors
in interface AttachmentStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |