Class ContentDirectoryStructureAttachmentDataFileSystemV003
- java.lang.Object
-
- com.atlassian.confluence.impl.pages.attachments.filesystem.ContentDirectoryStructureAttachmentDataFileSystemV003
-
- All Implemented Interfaces:
AttachmentDataFileSystem,AttachmentDataFileSystemV003
@Deprecated public class ContentDirectoryStructureAttachmentDataFileSystemV003 extends Object implements AttachmentDataFileSystem, AttachmentDataFileSystemV003
Deprecated.since 8.1.0. UseContentDirectoryStructureAttachmentDataFileSystemV004insteadAn implementation ofAttachmentDataFileSystemwhich stores the attachment data as files on a filesystem, using the standardFileAPI.The files are stored within a hierarchical directory structure that incorporates the IDs of the space, content entity and attachment IDs to which the attachment data belongs to. Data corresponding to each version of the attachment are stored, as are different "streams" of data for each version (see
AttachmentDataStreamType.For attachments belonging to "spaced" content entities (e.g. pages, blogs), the directory structure is described by the following pattern: "h1/h2/spaceId/h3/h4/contentId/attachmentId/attachmentFile"
where h1 and h2 are hashcodes generated from the spaceId, h3 and h4 are hashcodes generated from the contentId, and attachmentFile represents a combination of the attachment version and the data stream type. For backwards compatibility attachment files of type
AttachmentDataStreamType.RAW_BINARYhave a filename of just the numeric attachment version. For other stream types, the filename is "version.streamType" (e.g. "1.extracted_text").For "non-spaced" entity attachments (e.g. user profile pictures), a simpler but similar structure is used: "nonspaced/h3/h4/contentId/attachmentId/attachmentFile"
- Since:
- 7.12
-
-
Field Summary
Fields Modifier and Type Field Description static StringNON_SPACED_DIRECTORY_NAMEDeprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.atlassian.dc.filestore.api.compat.FilesystemPathcontainerPathForAttachmentVersions(long latestVersionAttachmentId, long contentId, Long spaceId)Deprecated.Get theFilerepresenting the directory that contains all the versions of an attachmentstatic ContentDirectoryStructureAttachmentDataFileSystemV003create(AttachmentDataStorageLocationResolver rootDir, DeferredFileDeletionQueue deferredFileDeletionQueue)Deprecated.booleandataExistsForAttachment(AttachmentRef attachment)Deprecated.Indicates whether the filesystem contains data for the given attachmentvoiddeleteAllAttachmentVersions(AttachmentRef attachment, AttachmentRef.Container originalContent)Deprecated.Delete all data corresponding to all versions of the given attachmentvoiddeleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container originalContent)Deprecated.Delete the data corresponding to a single attachment versionvoiddeleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container originalContent, AttachmentDataStreamType dataStreamType)Deprecated.Delete the data of the specified stream type corresponding to a single attachment versionAttachmentDataStreamgetAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType)Deprecated.Fetches the data for a given attachment version and data stream typeAttachmentDataStreamgetAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)Deprecated.Fetches the specified range of data for a given attachment version and data stream typeAttachmentDataFile<com.atlassian.dc.filestore.api.compat.FilesystemPath>getAttachmentDataFile(long attachmentId, Long containerId, Long spaceId, Integer attachmentVersion, AttachmentDataStreamType dataStreamType)Deprecated.This method won't support S3 attachment storage.com.atlassian.dc.filestore.api.compat.FilesystemPathgetPathForSpace(Long spaceId)Deprecated.com.atlassian.dc.filestore.api.compat.FilesystemPathgetRootPath()Deprecated.voidmoveAttachment(AttachmentRef oldAttachment, AttachmentRef newAttachment, AttachmentRef.Container newContent)Deprecated.Move all data relating to one attachment to a new directory corresponding to the given new attachment and content entity.voidmoveAttachments(AttachmentRef.Container contentEntity, AttachmentRef.Space oldSpace, AttachmentRef.Space newSpace)Deprecated.Move all data for all versions of all attachments corresponding to the given content entity in the given space, to the same entity in a different space.voidmoveDataForAttachmentVersion(AttachmentRef sourceAttachmentVersion, AttachmentRef targetAttachmentVersion)Deprecated.Move the data associated with one attachment version, to being associated with a different attachment versionvoidprepareForMigrationTo()Deprecated.In this implementation, we want to make sure the attachments' directory is empty, otherwise we will have attachments or files that don't belong.booleansaveAttachmentData(AttachmentRef attachmentVersion, AttachmentDataStream attachmentDataStream, boolean overwrite, org.springframework.util.unit.DataSize expectedFileSize)Deprecated.Save new data corresponding to the given attachment.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.impl.pages.attachments.filesystem.AttachmentDataFileSystemV003
containerDirectoryForAttachmentVersions, getDirectoryForSpace
-
-
-
-
Field Detail
-
NON_SPACED_DIRECTORY_NAME
public static final String NON_SPACED_DIRECTORY_NAME
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static ContentDirectoryStructureAttachmentDataFileSystemV003 create(AttachmentDataStorageLocationResolver rootDir, DeferredFileDeletionQueue deferredFileDeletionQueue)
Deprecated.
-
dataExistsForAttachment
public boolean dataExistsForAttachment(AttachmentRef attachment)
Deprecated.Description copied from interface:AttachmentDataFileSystemIndicates whether the filesystem contains data for the given attachment- Specified by:
dataExistsForAttachmentin interfaceAttachmentDataFileSystem
-
moveAttachment
public void moveAttachment(AttachmentRef oldAttachment, AttachmentRef newAttachment, AttachmentRef.Container newContent)
Deprecated.Description copied from interface:AttachmentDataFileSystemMove all data relating to one attachment to a new directory corresponding to the given new attachment and content entity.- Specified by:
moveAttachmentin interfaceAttachmentDataFileSystem- Parameters:
oldAttachment- The attachment whose data is to be movednewAttachment- The attachment to which the data should be moved tonewContent- The content entity corresponding to the new attachment
-
saveAttachmentData
public boolean saveAttachmentData(AttachmentRef attachmentVersion, AttachmentDataStream attachmentDataStream, boolean overwrite, org.springframework.util.unit.DataSize expectedFileSize)
Deprecated.Description copied from interface:AttachmentDataFileSystemSave new data corresponding to the given attachment.- Specified by:
saveAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachmentVersion- The attachment to which the data should be associatedattachmentDataStream- The new dataoverwrite- If true, any existing data will be overwritten. If false, does nothing if data already exists.expectedFileSize- The expected size of the data being written- Returns:
- true if the data was written, false otherwise (e.g. no overwrite)
-
containerPathForAttachmentVersions
public com.atlassian.dc.filestore.api.compat.FilesystemPath containerPathForAttachmentVersions(long latestVersionAttachmentId, long contentId, @Nullable Long spaceId)Deprecated.Get theFilerepresenting the directory that contains all the versions of an attachment- Specified by:
containerPathForAttachmentVersionsin interfaceAttachmentDataFileSystemV003- Parameters:
latestVersionAttachmentId- this should be the ID of the latest version or the directory will not existcontentId- the ID of the content containing the attachmentspaceId- the ID of the space the content belongs to- Returns:
- the
Filerepresenting the directory that contains all the versions of an attachment - Since:
- 7.0.1
-
getAttachmentDataFile
public AttachmentDataFile<com.atlassian.dc.filestore.api.compat.FilesystemPath> getAttachmentDataFile(long attachmentId, Long containerId, @Nullable Long spaceId, Integer attachmentVersion, AttachmentDataStreamType dataStreamType)
Deprecated.Description copied from interface:AttachmentDataFileSystemThis method won't support S3 attachment storage. Use at your own risk.- Specified by:
getAttachmentDataFilein interfaceAttachmentDataFileSystem
-
deleteAllAttachmentVersions
public void deleteAllAttachmentVersions(AttachmentRef attachment, AttachmentRef.Container originalContent)
Deprecated.Delete all data corresponding to all versions of the given attachmentThis method will remove any empty folders left after removing the attachment data.
- Specified by:
deleteAllAttachmentVersionsin interfaceAttachmentDataFileSystem- Parameters:
attachment- the attachment for which data should be removedoriginalContent- the content the attachment belongs to
-
moveDataForAttachmentVersion
public void moveDataForAttachmentVersion(AttachmentRef sourceAttachmentVersion, AttachmentRef targetAttachmentVersion)
Deprecated.Description copied from interface:AttachmentDataFileSystemMove the data associated with one attachment version, to being associated with a different attachment version- Specified by:
moveDataForAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
sourceAttachmentVersion- The attachment version containing the datatargetAttachmentVersion- The attachment version to which the data should be moved
-
deleteSingleAttachmentVersion
public void deleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container originalContent)
Deprecated.Delete the data corresponding to a single attachment versionThis method will remove any empty folders left after removing the attachment data.
- Specified by:
deleteSingleAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
attachment- the attachment for which data should be removedoriginalContent- the content the attachment belongs to
-
deleteSingleAttachmentVersion
public void deleteSingleAttachmentVersion(AttachmentRef attachment, AttachmentRef.Container originalContent, AttachmentDataStreamType dataStreamType)
Deprecated.Description copied from interface:AttachmentDataFileSystemDelete the data of the specified stream type corresponding to a single attachment version- Specified by:
deleteSingleAttachmentVersionin interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment whose data should be deletedoriginalContent- The content entity associated with the attachmentdataStreamType- The attachment stream type
-
getPathForSpace
public com.atlassian.dc.filestore.api.compat.FilesystemPath getPathForSpace(@Nullable Long spaceId)Deprecated.- Specified by:
getPathForSpacein interfaceAttachmentDataFileSystemV003
-
getRootPath
public com.atlassian.dc.filestore.api.compat.FilesystemPath getRootPath()
Deprecated.
-
getAttachmentData
public AttachmentDataStream getAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType)
Deprecated.Description copied from interface:AttachmentDataFileSystemFetches the data for a given attachment version and data stream type- Specified by:
getAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment version for which the data is to be fetcheddataStreamType- The type of the data stream to be fetched- Returns:
- The
AttachmentDataStreamcontaining the result
-
getAttachmentData
public AttachmentDataStream getAttachmentData(AttachmentRef attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)
Deprecated.Description copied from interface:AttachmentDataFileSystemFetches the specified range of data for a given attachment version and data stream type- Specified by:
getAttachmentDatain interfaceAttachmentDataFileSystem- Parameters:
attachment- The attachment version for which the data is to be fetcheddataStreamType- The type of the data stream to be fetchedrange- The range of the data stream to be fetched- Returns:
- The
AttachmentDataStreamcontaining the result
-
moveAttachments
public void moveAttachments(AttachmentRef.Container contentEntity, AttachmentRef.Space oldSpace, AttachmentRef.Space newSpace)
Deprecated.Description copied from interface:AttachmentDataFileSystemMove all data for all versions of all attachments corresponding to the given content entity in the given space, to the same entity in a different space.- Specified by:
moveAttachmentsin interfaceAttachmentDataFileSystem- Parameters:
contentEntity- The content entity whose attachment data is to be movedoldSpace- The original space of the content entitynewSpace- The new space of the content entity
-
prepareForMigrationTo
public void prepareForMigrationTo()
Deprecated.In this implementation, we want to make sure the attachments' directory is empty, otherwise we will have attachments or files that don't belong.We also want to make sure the attachments' directory actually exists, prior to moving data across.
It is the responsibility of the action performing the migration to warn the user about this.
- Specified by:
prepareForMigrationToin interfaceAttachmentDataFileSystem
-
-