com.atlassian.confluence.pages.persistence.dao
Class FileSystemAttachmentDataDao

java.lang.Object
  extended by com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao
All Implemented Interfaces:
AttachmentDataDao, NonTransactionalAttachmentDataDao
Direct Known Subclasses:
HierarchicalFileSystemAttachmentDataDao

Deprecated. Since 5.5 Use FileSystemAttachmentDataDao

@Deprecated
public class FileSystemAttachmentDataDao
extends java.lang.Object
implements NonTransactionalAttachmentDataDao


Nested Class Summary
static interface FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy
          Deprecated.  
 
Field Summary
protected  FileLocationResolver attachmentsDirResolver
          Deprecated.  
static FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_FILE_NAME
          Deprecated.  
static FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_ID
          Deprecated.  
 
Constructor Summary
FileSystemAttachmentDataDao()
          Deprecated.  
 
Method Summary
 void afterMigrationFrom()
          Deprecated. In this implementation, we leave the filesystem as is, and don't remove the attachments that have just been moved to another data store.
 FileLocationResolver getAttachmentsDirResolver()
          Deprecated.  
protected  java.io.File getConfluenceAttachmentDirectory()
          Deprecated.  
 java.io.InputStream getDataForAttachment(Attachment attachment)
          Deprecated. Grabs the AttachmentData object for an Attachment
 AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType)
          Deprecated. Grabs the AttachmentData object for an Attachment
protected  java.io.File getDirectoryForAttachment(ContentEntityObject content, Attachment attachment)
          Deprecated. Retrieves the location of the containing folder for an Attachment
protected  java.io.File getDirectoryForContent(ContentEntityObject content)
          Deprecated.  
protected  java.io.File getLatestAttachmentFile(Attachment attachment)
          Deprecated.  
 FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy getNamingStrategy()
          Deprecated.  
 AttachmentDataStorageType getStorageType()
          Deprecated. Returns the storage type.
 boolean isAttachmentPresent(Attachment attachment)
          Deprecated. Check that an attachment exists
 void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
          Deprecated. Moves an attachment to a new file name or content object
 void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)
          Deprecated. Moves the attachment data from one AbstractVersionedEntityObject.getVersion() to the other.
 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.
 void removeDataForAttachment(Attachment attachment, ContentEntityObject originalContent)
          Deprecated. Removes all attachment data for the given attachment.
 void removeDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent)
          Deprecated. Removes the attachment data for the given attachment version.
 void replaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
          Deprecated. Sets the data for attachment This method will overwrite any existing data for the attachment.
 void replaceDataForAttachment(Attachment attachment, java.io.InputStream data)
          Deprecated. Sets the data for attachment This method will overwrite any existing data for the attachment.
 void saveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
          Deprecated. Saves data to the attachment data store
 void saveDataForAttachment(Attachment attachment, java.io.InputStream data)
          Deprecated. Saves data to the attachment data store
protected  void saveDataForAttachment(Attachment attachment, java.io.InputStream data, boolean overwrite)
          Deprecated. Saves data to the file system
 void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)
          Deprecated. Saves data to the attachment data store, for an attachment that has been updated.
 void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream data)
          Deprecated. Saves data to the attachment data store, for an attachment that has been updated.
 void setAttachmentsDirResolver(FileLocationResolver attachmentsDirResolver)
          Deprecated.  
 void setNamingStrategy(FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy namingStrategy)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attachmentsDirResolver

protected FileLocationResolver attachmentsDirResolver
Deprecated. 

NAMING_STRATEGY_ID

public static final FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_ID
Deprecated. 

NAMING_STRATEGY_FILE_NAME

public static final FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_FILE_NAME
Deprecated. 
Constructor Detail

FileSystemAttachmentDataDao

public FileSystemAttachmentDataDao()
Deprecated. 
Method Detail

getNamingStrategy

public FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy getNamingStrategy()
Deprecated. 

setNamingStrategy

public void setNamingStrategy(FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy namingStrategy)
Deprecated. 

getConfluenceAttachmentDirectory

protected java.io.File getConfluenceAttachmentDirectory()
Deprecated. 

getLatestAttachmentFile

protected java.io.File getLatestAttachmentFile(Attachment attachment)
Deprecated. 

getDataForAttachment

public java.io.InputStream getDataForAttachment(Attachment attachment)
                                         throws AttachmentDataNotFoundException
Deprecated. 
Description copied from interface: AttachmentDataDao
Grabs the AttachmentData object for an Attachment

Specified by:
getDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - the Attachment representing the data
Returns:
an AttachmentData object
Throws:
AttachmentDataNotFoundException - if no data was found

removeDataForAttachment

public void removeDataForAttachment(Attachment attachment,
                                    ContentEntityObject originalContent)
Deprecated. 
Removes all attachment data for the given attachment. Since Confluence 4.2 the contract of this method has been clarified. It now removes all versions of the given attachment.

This method will remove any empty folders left after removing the attachment data.

Specified by:
removeDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - the attachment for which data should be removed
originalContent - the content the attachment belongs to

removeDataForAttachmentVersion

public void removeDataForAttachmentVersion(Attachment attachment,
                                           ContentEntityObject originalContent)
Deprecated. 
Removes the attachment data for the given attachment version.

This method will remove any empty folders left after removing the attachment data.

Specified by:
removeDataForAttachmentVersion in interface AttachmentDataDao
Parameters:
attachment - the attachment for which data should be removed
originalContent - the content the attachment belongs to

moveDataForAttachmentVersion

public void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
                                         Attachment targetAttachmentVersion)
Deprecated. 
Description copied from interface: AttachmentDataDao
Moves the attachment data from one AbstractVersionedEntityObject.getVersion() to the other.

This method will overwrite any existing data for the target attachment version.

Specified by:
moveDataForAttachmentVersion in interface AttachmentDataDao
Parameters:
sourceAttachmentVersion - the attachment
See Also:
AttachmentDataDao.moveAttachment(Attachment, Attachment, ContentEntityObject)

saveDataForAttachment

public void saveDataForAttachment(Attachment attachment,
                                  java.io.InputStream data)
Deprecated. 
Description copied from interface: AttachmentDataDao
Saves data to the attachment data store

Specified by:
saveDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - the Attachment the data belongs to
data - the InputStream to be written

getAttachmentsDirResolver

public FileLocationResolver getAttachmentsDirResolver()
Deprecated. 

saveDataForAttachment

protected void saveDataForAttachment(Attachment attachment,
                                     java.io.InputStream data,
                                     boolean overwrite)
Deprecated. 
Saves data to the file system

Parameters:
attachment - the Attachment the data belongs to
data - the InputStream to be written
overwrite -
Throws:
java.lang.IllegalArgumentException - if attachment is null
java.lang.IllegalArgumentException - if data is null

saveDataForAttachmentVersion

public void saveDataForAttachmentVersion(Attachment attachment,
                                         Attachment previousVersion,
                                         java.io.InputStream data)
Deprecated. 
Description copied from interface: AttachmentDataDao
Saves data to the attachment data store, for an attachment that has been updated.

This method assumes that the attachment has already been saved.

Specified by:
saveDataForAttachmentVersion in interface AttachmentDataDao
Parameters:
attachment - the new version of the attachment
previousVersion - the previous version of the attachment
data - the InputStream representing the data

replaceDataForAttachment

public void replaceDataForAttachment(Attachment attachment,
                                     java.io.InputStream data)
Deprecated. 
Description copied from interface: AttachmentDataDao
Sets the data for attachment This method will overwrite any existing data for the attachment.

Specified by:
replaceDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - Attachment the data belongs to
data - the data to be saved

isAttachmentPresent

public boolean isAttachmentPresent(Attachment attachment)
Deprecated. 
Description copied from interface: AttachmentDataDao
Check that an attachment exists

Specified by:
isAttachmentPresent in interface AttachmentDataDao
Parameters:
attachment - the Attachment to be checked

moveAttachment

public void moveAttachment(Attachment attachment,
                           Attachment oldAttachment,
                           ContentEntityObject newContent)
Deprecated. 
Description copied from interface: AttachmentDataDao
Moves an attachment to a new file name or content object

Specified by:
moveAttachment in interface AttachmentDataDao
Parameters:
attachment - the Attachment to be moved
oldAttachment - the original version of the attachment
newContent - the new content the Attachment belongs to

getDirectoryForAttachment

protected java.io.File getDirectoryForAttachment(ContentEntityObject content,
                                                 Attachment attachment)
Deprecated. 
Retrieves the location of the containing folder for an Attachment

Parameters:
content - the ContentEntityObject the Attachment belongs to
attachment -
Returns:
a File pointing to the location

getDirectoryForContent

protected java.io.File getDirectoryForContent(ContentEntityObject content)
Deprecated. 

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:
prepareForMigrationTo in interface AttachmentDataDao

afterMigrationFrom

public void afterMigrationFrom()
Deprecated. 
In this implementation, we leave the filesystem as is, and don't remove the attachments that have just been moved to another data store.

Specified by:
afterMigrationFrom in interface AttachmentDataDao

setAttachmentsDirResolver

public void setAttachmentsDirResolver(FileLocationResolver attachmentsDirResolver)
Deprecated. 

getDataForAttachment

public AttachmentDataStream getDataForAttachment(Attachment attachment,
                                                 AttachmentDataStreamType dataStreamType)
                                          throws AttachmentDataNotFoundException
Deprecated. 
Description copied from interface: AttachmentDataDao
Grabs the AttachmentData object for an Attachment

Specified by:
getDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - the Attachment representing the data
Returns:
an AttachmentData object
Throws:
AttachmentDataNotFoundException - if no data was found

saveDataForAttachment

public void saveDataForAttachment(Attachment attachment,
                                  AttachmentDataStream dataStream)
Deprecated. 
Description copied from interface: AttachmentDataDao
Saves data to the attachment data store

Specified by:
saveDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - the Attachment the data belongs to
dataStream - the data stream to be written

saveDataForAttachmentVersion

public void saveDataForAttachmentVersion(Attachment attachment,
                                         Attachment previousVersion,
                                         AttachmentDataStream dataStream)
Deprecated. 
Description copied from interface: AttachmentDataDao
Saves data to the attachment data store, for an attachment that has been updated.

This method assumes that the attachment has already been saved.

Specified by:
saveDataForAttachmentVersion in interface AttachmentDataDao
Parameters:
attachment - the new version of the attachment
previousVersion - the previous version of the attachment
dataStream - the InputStream representing the data

replaceDataForAttachment

public void replaceDataForAttachment(Attachment attachment,
                                     AttachmentDataStream dataStream)
Deprecated. 
Description copied from interface: AttachmentDataDao
Sets the data for attachment This method will overwrite any existing data for the attachment.

Specified by:
replaceDataForAttachment in interface AttachmentDataDao
Parameters:
attachment - Attachment the data belongs to
dataStream - the data to be saved

getStorageType

public AttachmentDataStorageType getStorageType()
Deprecated. 
Description copied from interface: AttachmentDataDao
Returns the storage type.

The client code should be storage agnostic in general. Thus this method should only be used in rare cases in order to hide operations which are known to be not implemented for the specific type.

Specified by:
getStorageType in interface AttachmentDataDao
Returns:
the storage type


Copyright © 2003-2014 Atlassian. All Rights Reserved.