com.atlassian.jira.issue.attachment
Interface AttachmentDirectoryAccessor

All Superinterfaces:
AttachmentHealth
All Known Implementing Classes:
FileSystemAttachmentDirectoryAccessor

public interface AttachmentDirectoryAccessor
extends AttachmentHealth

Interface for a component that provides access to attachment directories. This is typically only useful for file-based attachment stores.

Since:
v6.3

Method Summary
 void checkValidAttachmentDirectory(Issue issue)
          Deprecated. Use AttachmentHealth.errors() instead. This method is here while AttachmentStore is still in jira-api.
 void checkValidTemporaryAttachmentDirectory()
          Deprecated. Use AttachmentHealth.errors() instead. This method is here while AttachmentStore is still in jira-api.
 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 getAttachmentRootPath()
          Returns the path used to store all attachments across the system.
 File getTemporaryAttachmentDirectory()
           
 File getThumbnailDirectory(Issue issue)
          Returns the physical directory of the thumbnails for the given issue, creating if necessary.
 
Methods inherited from interface com.atlassian.jira.issue.attachment.AttachmentHealth
errors
 

Method Detail

getThumbnailDirectory

@Nonnull
File getThumbnailDirectory(@Nonnull
                                   Issue issue)
Returns the physical directory of the thumbnails for the given issue, creating if necessary.

Parameters:
issue - the issue whose thumbnail directory you want
Returns:
The issue's thumbnail directory.

getAttachmentDirectory

@Nullable
File getAttachmentDirectory(@Nonnull
                                     String issueKey)

getAttachmentDirectory

File getAttachmentDirectory(@Nonnull
                            Issue issue,
                            boolean createDirectory)
Returns the physical directory of the attachments for the given issue. This will create it if necessary.

Parameters:
issue - the issue whose attachment directory you want
createDirectory - If true, and the directory does not currently exist, then the directory is created.
Returns:
the issue's attachment directory

getTemporaryAttachmentDirectory

File getTemporaryAttachmentDirectory()

getAttachmentDirectory

File getAttachmentDirectory(@Nonnull
                            Issue issue)
Returns the physical directory of the attachments for the given issue. This will create it if necessary.

Parameters:
issue - the issue whose attachment directory you want
Returns:
The issue's attachment directory.

getAttachmentDirectory

File getAttachmentDirectory(String attachmentDirectory,
                            String projectKey,
                            String issueKey)
Get the attachment directory for the given attachment base directory, project key, and issue key.

The idea is to encapsulate all of the path-joinery magic to make future refactoring easier if we ever decide to move away from attachment-base/project-key/issue-ket

Parameters:
attachmentDirectory - base of attachments
projectKey - the project key the issue belongs to
issueKey - the issue key for the issue
Returns:
the directory attachments for this issue live in

checkValidAttachmentDirectory

void checkValidAttachmentDirectory(Issue issue)
                                   throws AttachmentException
Deprecated. Use AttachmentHealth.errors() instead. This method is here while AttachmentStore is still in jira-api.

Checks that the Attachment directory of the given issue is right to go - writable, accessible etc. Will create it if necessary.

Parameters:
issue - the issue whose attachment directory to check.
Throws:
AttachmentException - if the directory is not writable or missing and cannot be created.

checkValidTemporaryAttachmentDirectory

void checkValidTemporaryAttachmentDirectory()
                                            throws AttachmentException
Deprecated. Use AttachmentHealth.errors() instead. This method is here while AttachmentStore is still in jira-api.

Checks that the temporary directory where attachments can be uploaded is writeable.

Throws:
AttachmentException - if the directory is not writable or missing and cannot be created.

getAttachmentRootPath

File getAttachmentRootPath()
Returns the path used to store all attachments across the system.

Returns:
the path used to store all attachments across the system.


Copyright © 2002-2014 Atlassian. All Rights Reserved.