|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.upgrade.upgradetask.AttachmentFileNameUpgradeTask
public class AttachmentFileNameUpgradeTask
Upgrade confluence file system based attachment storage to use new ID naming strategy for attachments [CONF-2948]
| Field Summary | |
|---|---|
java.lang.String[] |
mangledEncodings
|
static int |
UPDATE_BUILD_NUMBER
|
| Constructor Summary | |
|---|---|
AttachmentFileNameUpgradeTask()
|
|
| Method Summary | |
|---|---|
void |
doUpgrade()
Upgrade the attachment files to use the new naming strategy |
java.lang.String |
getBuildNumber()
|
java.util.Collection |
getErrors()
Return any errors that occur. |
java.lang.String[] |
getMangledEncodings()
|
java.lang.String |
getShortDescription()
A short (<50 chars) description of the upgrade action |
boolean |
isSearchForMissingAttachmentFiles()
|
protected void |
logMissingAttachments(java.util.Collection missingAttachments)
Report any attachments that were not upgraded successfully |
protected void |
processAttachments(java.util.Iterator attachmentIterator,
java.util.Collection missingAttachments)
Update attachment names on disk |
protected void |
processMissingAttachments(java.util.Collection missingAttachments)
Try and fix any attachment files that were not found |
protected void |
processStagedUpdates()
Process all of the staged updates |
void |
setAttachmentDao(AttachmentDao attachmentDao)
|
void |
setBootstrap(BootstrapManager bootstrap)
|
void |
setMangledEncodings(java.lang.String[] mangledEncodings)
Set the list of character encodings to use when looking for missing attachment files on disk |
void |
setSearchForMissingAttachmentFiles(boolean searchForMissingAttachmentFiles)
Sets whether to try and find missing attachment files during upgrade (true by default) |
void |
setSettingsManager(SettingsManager settingsManager)
|
protected void |
stageUpdatedAttachment(java.io.File originalAttachment,
java.io.File updatedFile)
Stage an update for later processing - used for name collision resolution |
protected boolean |
tryToFixFile(java.io.File attachmentDir,
Attachment attachment,
java.lang.String nativeEncoding)
Try and locate and update a file which may have a badly encoded file name This method will run through all the configured mangled encodings |
protected boolean |
tryToFixFile(java.io.File attachmentDir,
Attachment attachment,
java.lang.String nativeEncoding,
java.lang.String fileSystemEncoding)
Try to fix an attachment file by looking for a file name encoded with the specified encoding |
protected boolean |
updateAttachmentFile(Attachment attachment,
java.io.File attachmentFile)
Map an attachment to the new ID based naming scheme |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int UPDATE_BUILD_NUMBER
public java.lang.String[] mangledEncodings
| Constructor Detail |
|---|
public AttachmentFileNameUpgradeTask()
| Method Detail |
|---|
public boolean isSearchForMissingAttachmentFiles()
public void setSearchForMissingAttachmentFiles(boolean searchForMissingAttachmentFiles)
searchForMissingAttachmentFiles - public void setBootstrap(BootstrapManager bootstrap)
public java.lang.String[] getMangledEncodings()
public void setMangledEncodings(java.lang.String[] mangledEncodings)
mangledEncodings - An array of character encoding strings as used by String.getBytes()public java.lang.String getBuildNumber()
getBuildNumber in interface UpgradeTaskpublic java.lang.String getShortDescription()
UpgradeTask
getShortDescription in interface UpgradeTask
public void doUpgrade()
throws java.lang.Exception
doUpgrade in interface UpgradeTaskjava.lang.Exception
protected void processAttachments(java.util.Iterator attachmentIterator,
java.util.Collection missingAttachments)
attachmentIterator - An Iterator over attachments to processmissingAttachments - A collection to hold any attachment objects which could not be matched to a file on diskprotected void processMissingAttachments(java.util.Collection missingAttachments)
missingAttachments - protected void logMissingAttachments(java.util.Collection missingAttachments)
missingAttachments - Collection of missed attachments
protected boolean updateAttachmentFile(Attachment attachment,
java.io.File attachmentFile)
attachment - The attachment to processattachmentFile - The expected location of the attachment
protected void stageUpdatedAttachment(java.io.File originalAttachment,
java.io.File updatedFile)
originalAttachment - The original attachment fileupdatedFile - The file we want to rename it toprotected void processStagedUpdates()
protected boolean tryToFixFile(java.io.File attachmentDir,
Attachment attachment,
java.lang.String nativeEncoding)
attachmentDir - Root attachment directoryattachment - Attachment to fixnativeEncoding - Encoding to use to decode the Attachment object's getFileName()
protected boolean tryToFixFile(java.io.File attachmentDir,
Attachment attachment,
java.lang.String nativeEncoding,
java.lang.String fileSystemEncoding)
throws java.io.UnsupportedEncodingException
attachmentDir - attachment - nativeEncoding - fileSystemEncoding - Encoding to use when looking on disk
java.io.UnsupportedEncodingException - When fileSystemEncoding is not recognisedpublic java.util.Collection getErrors()
UpgradeTask
getErrors in interface UpgradeTaskpublic void setAttachmentDao(AttachmentDao attachmentDao)
public void setSettingsManager(SettingsManager settingsManager)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||