public class DualAttachmentDataFileSystemPrimaryLocal extends Object implements AttachmentDataFileSystem
AttachmentDataFileSystem which stores the attachment data in both
local file system using HierarchicalMultiStreamAttachmentDataFileSystem
and remote FileStore using FileStoreAttachmentDataFileSystem.
This strategy ensures local file system is the primary storage: a WRITE operation is only successful if WRITE to local file system is successful.
Operations that require a READ/WRITE/DELETE to FileStore will be run in a background thread with a new hibernate transaction. Other transactions that don't request to FileStore will be run in the same transactional thread.
| Constructor and Description |
|---|
DualAttachmentDataFileSystemPrimaryLocal(AttachmentDataFileSystem localAttachmentDataFileSystem,
AttachmentDataFileSystem cloudAttachmentDataFileSystem,
org.springframework.transaction.PlatformTransactionManager transactionManager,
SynchronizationManager synchronizationManager,
com.atlassian.spring.container.LazyComponentReference<AttachmentManager> attachmentManager) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
dataExistsForAttachment(Attachment attachment)
Indicates whether the filesystem contains data for the given attachment
|
void |
deleteAllAttachmentVersions(Attachment attachment,
ContentEntityObject contentEntity)
Delete all data corresponding to all versions of the given attachment
|
void |
deleteSingleAttachmentVersion(Attachment attachment,
ContentEntityObject contentEntity)
Delete the data corresponding to a single attachment version
|
void |
deleteSingleAttachmentVersion(Attachment attachment,
ContentEntityObject contentEntity,
AttachmentDataStreamType dataStreamType)
Delete the data of the specified stream type corresponding to a single attachment version
|
AttachmentDataStream |
getAttachmentData(Attachment attachment,
AttachmentDataStreamType dataStreamType)
Fetches the data for a given attachment version and data stream type
|
AttachmentDataStream |
getAttachmentData(Attachment attachment,
AttachmentDataStreamType dataStreamType,
Optional<RangeRequest> range)
Fetches the specified range of data for a given attachment version and data stream type
|
void |
moveAttachment(Attachment oldAttachment,
Attachment newAttachment,
ContentEntityObject newContentEntity)
Move all data relating to one attachment to a new directory corresponding to the given new attachment and
content entity.
|
void |
moveAttachments(ContentEntityObject contentEntity,
Space oldSpace,
Space newSpace)
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.
|
void |
moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
Move the data associated with one attachment version, to being associated with a different attachment version
|
void |
prepareForMigrationTo()
Prepare the data store for a migration from another type of data store.
|
boolean |
saveAttachmentData(Attachment attachment,
AttachmentDataStream dataStream,
boolean overwrite)
Save new data corresponding to the given attachment.
|
public DualAttachmentDataFileSystemPrimaryLocal(AttachmentDataFileSystem localAttachmentDataFileSystem, AttachmentDataFileSystem cloudAttachmentDataFileSystem, org.springframework.transaction.PlatformTransactionManager transactionManager, SynchronizationManager synchronizationManager, com.atlassian.spring.container.LazyComponentReference<AttachmentManager> attachmentManager)
public boolean saveAttachmentData(Attachment attachment, AttachmentDataStream dataStream, boolean overwrite)
AttachmentDataFileSystemsaveAttachmentData in interface AttachmentDataFileSystemattachment - The attachment to which the data should be associateddataStream - The new dataoverwrite - If true, any existing data will be overwritten. If false, does nothing if data already exists.public AttachmentDataStream getAttachmentData(Attachment attachment, AttachmentDataStreamType dataStreamType)
AttachmentDataFileSystemgetAttachmentData in interface AttachmentDataFileSystemattachment - The attachment version for which the data is to be fetcheddataStreamType - The type of the data stream to be fetchedAttachmentDataStream containing the resultpublic AttachmentDataStream getAttachmentData(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range)
AttachmentDataFileSystemgetAttachmentData in interface AttachmentDataFileSystemattachment - 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 fetchedAttachmentDataStream containing the resultpublic boolean dataExistsForAttachment(Attachment attachment)
AttachmentDataFileSystemdataExistsForAttachment in interface AttachmentDataFileSystempublic void deleteSingleAttachmentVersion(Attachment attachment, ContentEntityObject contentEntity)
AttachmentDataFileSystemdeleteSingleAttachmentVersion in interface AttachmentDataFileSystemattachment - The attachment whose data should be deletedcontentEntity - The content entity associated with the attachmentpublic void deleteSingleAttachmentVersion(Attachment attachment, ContentEntityObject contentEntity, AttachmentDataStreamType dataStreamType)
AttachmentDataFileSystemdeleteSingleAttachmentVersion in interface AttachmentDataFileSystemattachment - The attachment whose data should be deletedcontentEntity - The content entity associated with the attachmentdataStreamType - The attachment stream typepublic void deleteAllAttachmentVersions(Attachment attachment, ContentEntityObject contentEntity)
AttachmentDataFileSystemdeleteAllAttachmentVersions in interface AttachmentDataFileSystemattachment - the attachment whose data is to be deletedcontentEntity - The content entity associated with the attachmentpublic void moveAttachment(Attachment oldAttachment, Attachment newAttachment, ContentEntityObject newContentEntity)
AttachmentDataFileSystemmoveAttachment in interface AttachmentDataFileSystemoldAttachment - The attachment whose data is to be movednewAttachment - The attachment to which the data should be moved tonewContentEntity - The content entity corresponding to the new attachmentpublic void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)
AttachmentDataFileSystemmoveDataForAttachmentVersion in interface AttachmentDataFileSystemsourceAttachmentVersion - The attachment version containing the datatargetAttachmentVersion - The attachment version to which the data should be movedpublic void moveAttachments(ContentEntityObject contentEntity, Space oldSpace, Space newSpace)
AttachmentDataFileSystemmoveAttachments in interface AttachmentDataFileSystemcontentEntity - The content entity whose attachment data is to be movedoldSpace - The original space of the content entitynewSpace - The new space of the content entitypublic void prepareForMigrationTo()
AttachmentDataFileSystemprepareForMigrationTo in interface AttachmentDataFileSystemCopyright © 2003–2019 Atlassian. All rights reserved.