public class

HierarchicalFileSystemAttachmentDataDao

extends FileSystemAttachmentDataDao
java.lang.Object
   ↳ com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao
     ↳ com.atlassian.confluence.pages.persistence.dao.HierarchicalFileSystemAttachmentDataDao

Class Overview

DAO that stores attachments on the file system in a hierarchical structure. The top of the hierarchy is based on the space the attachments belong to with the remainder of the hierarchy being based on the page id the attachment is attached to.

Summary

Constants
String NEW_ATTACHMENT_SUBDIR The name of the directory beneath the configured attachments directory where attachments will be migrated to.
String NON_SPACED_DIRECTORY_NAME
[Expand]
Inherited Fields
From class com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao
Public Constructors
HierarchicalFileSystemAttachmentDataDao()
Public Methods
File getDirectoryForAttachmentContainer(long contentId, long spaceId)

Return the directory that represents where attachments for the supplied content should be stored based also upon the id of the space that contains the content (if it's spaced content)

This method is only public so it is available to the upgrade task responsible for migrating to this new attachment storage structure.

FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy getNamingStrategy()
This implementation always uses the AttachmentIdNamingStrategy.
void setHashGenerator(IdMultiPartHashGenerator hashGenerator)
Protected Methods
File getConfluenceAttachmentDirectory()
File getDirectoryForAttachment(ContentEntityObject content, Attachment attachment)
Retrieves the location of the containing folder for an Attachment
[Expand]
Inherited Methods
From class com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao
From class java.lang.Object
From interface com.atlassian.confluence.pages.persistence.dao.AttachmentDataDao

Constants

public static final String NEW_ATTACHMENT_SUBDIR

The name of the directory beneath the configured attachments directory where attachments will be migrated to.

Constant Value: "ver003"

public static final String NON_SPACED_DIRECTORY_NAME

Constant Value: "nonspaced"

Public Constructors

public HierarchicalFileSystemAttachmentDataDao ()

Public Methods

public File getDirectoryForAttachmentContainer (long contentId, long spaceId)

Return the directory that represents where attachments for the supplied content should be stored based also upon the id of the space that contains the content (if it's spaced content)

This method is only public so it is available to the upgrade task responsible for migrating to this new attachment storage structure.

Parameters
contentId the id of the content the attachment belongs to
spaceId the id of the space the content belongs to or 0 if it is not spaced content
Returns
  • a directory for storing the attachment.

public FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy getNamingStrategy ()

This implementation always uses the AttachmentIdNamingStrategy.

public void setHashGenerator (IdMultiPartHashGenerator hashGenerator)

Protected Methods

protected File getConfluenceAttachmentDirectory ()

protected File getDirectoryForAttachment (ContentEntityObject content, Attachment attachment)

Retrieves the location of the containing folder for an Attachment

Parameters
content the ContentEntityObject the Attachment belongs to
Returns
  • a File pointing to the location