|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.attachment.DefaultAttachmentStore
public final class DefaultAttachmentStore
Constructor Summary | |
---|---|
DefaultAttachmentStore(AttachmentDirectoryAccessor da,
com.atlassian.event.api.EventPublisher eventPublisher)
|
Method Summary | ||
---|---|---|
com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> |
delete(Attachment attachment)
Delete the specified attachment. |
|
com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> |
deleteAttachmentContainerForIssue(Issue issue)
Delete the container for attachments for a given issue. |
|
com.atlassian.fugue.Option<ErrorCollection> |
errors()
Health status for this component. |
|
com.atlassian.util.concurrent.Promise<Boolean> |
exists(Attachment metaData)
Returns true if the attachment exists in the store. |
|
|
get(Attachment metadata,
com.google.common.base.Function<InputStream,A> inputStreamProcessor)
Retrieve data for a given attachment. |
|
File |
getAttachmentFile(Attachment attachment)
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. |
|
File |
getAttachmentFile(Issue issue,
Attachment attachment)
Returns the physical File for the given Attachment. |
|
com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> |
move(Attachment metaData,
String newIssueKey)
Moves an attachment from its current issue under a new one |
|
com.atlassian.util.concurrent.Promise<Attachment> |
put(Attachment metadata,
File source)
Store attachment data for a given attachment. |
|
com.atlassian.util.concurrent.Promise<Attachment> |
put(Attachment metadata,
InputStream data)
Store attachment data for a given attachment. |
|
void |
stop(ComponentManagerShutdownEvent event)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAttachmentStore(AttachmentDirectoryAccessor da, com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail |
---|
public File getAttachmentFile(Issue issue, Attachment attachment) throws DataAccessException
getAttachmentFile
in interface FileBasedAttachmentStore
issue
- the issue the attachment belongs to.attachment
- the attachment.
DataAccessException
- on failure getting required attachment info.public File getAttachmentFile(Attachment attachment) throws DataAccessException
getAttachmentFile
in interface FileBasedAttachmentStore
attachment
- the attachment.
DataAccessException
- on failure getting required attachment info.public File getAttachmentFile(AttachmentStore.AttachmentAdapter attachment, File attachmentDir)
getAttachmentFile
in interface FileBasedAttachmentStore
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"
public com.atlassian.util.concurrent.Promise<Attachment> put(Attachment metadata, InputStream data)
SimpleAttachmentStore
put
in interface SimpleAttachmentStore
metadata
- attachment metadata, used to determine the logical key under which to store the attachment datadata
- 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> put(Attachment metadata, File source)
SimpleAttachmentStore
put
in interface SimpleAttachmentStore
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> get(Attachment metadata, com.google.common.base.Function<InputStream,A> inputStreamProcessor)
SimpleAttachmentStore
get
in interface SimpleAttachmentStore
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. This function MUST clean up upon failure of reading from
the input stream, and must support being re-executed. e.g. If the function writes out to a temp file, the temp file should be
created by the function.
AttachmentRuntimeException
in case of error.public com.atlassian.util.concurrent.Promise<Boolean> exists(Attachment metaData)
SimpleAttachmentStore
exists
in interface SimpleAttachmentStore
metaData
- attachment metadata, used to determine the logical key under which to store the attachment data
AttachmentRuntimeException
in case of error.public com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> delete(Attachment attachment)
SimpleAttachmentStore
delete
in interface SimpleAttachmentStore
attachment
- The attachment to delete.
public com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> deleteAttachmentContainerForIssue(Issue issue)
FileBasedAttachmentStore
deleteAttachmentContainerForIssue
in interface FileBasedAttachmentStore
issue
- The issue to delete attachments for.
public com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> move(Attachment metaData, String newIssueKey)
SimpleAttachmentStore
move
in interface SimpleAttachmentStore
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.fugue.Option<ErrorCollection> errors()
AttachmentHealth
errors
in interface AttachmentHealth
@EventListener public void stop(ComponentManagerShutdownEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |