Class FileSystemAction
- java.lang.Object
-
- org.syncany.operations.down.actions.FileSystemAction
-
- Direct Known Subclasses:
DeleteFileSystemAction,FileCreatingFileSystemAction,NewSymlinkFileSystemAction,RenameFileSystemAction,SetAttributesFileSystemAction
public abstract class FileSystemAction extends java.lang.Object
File system actions perform operations on the local disk -- creating, updating and deleting files. Given an expected and a newFileVersion(namely file1 and file2), the concrete implementation of a file system action performs an action on the file.Implementations of this class treat file1 and file2 differently, depending on what action they implement.
-
-
Field Summary
Fields Modifier and Type Field Description protected Configconfigprotected FileVersionfileVersion1protected FileVersionfileVersion2protected FileVersionComparatorfileVersionHelperprotected static java.util.logging.Loggerloggerprotected MemoryDatabasewinningDatabase
-
Constructor Summary
Constructors Constructor Description FileSystemAction(Config config, MemoryDatabase winningDatabase, FileVersion file1, FileVersion file2)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcreateFolder(NormalizedPath targetDir)protected voidcreateSymlink(FileVersion reconstructedFileVersion)protected voiddeleteFile(FileVersion deleteFileVersion)abstract FileSystemActionResultexecute()protected booleanfileAsExpected(FileVersion expectedLocalFileVersion)protected booleanfileAsExpected(FileVersion expectedLocalFileVersion, FileVersionComparator.FileChange... allowedFileChanges)protected FileVersionComparator.FileVersionComparisonfileChanges(FileVersion expectedLocalFileVersion)protected booleanfileExists(FileVersion expectedLocalFileVersion)protected java.io.FilegetAbsolutePathFile(java.lang.String relativePath)FileVersiongetFile1()FileVersiongetFile2()FileVersion.FileTypegetType()protected java.io.FilemoveFileToFinalLocation(java.io.File reconstructedFileInCache, FileVersion targetFileVersion)protected voidmoveToConflictFile(FileVersion targetFileVersion)protected voidmoveToConflictFile(NormalizedPath conflictingPath)protected voidsetFileAttributes(FileVersion reconstructedFileVersion)protected voidsetFileAttributes(FileVersion reconstructedFileVersion, java.io.File reconstructedFilesAtFinalLocation)protected voidsetLastModified(FileVersion reconstructedFileVersion)protected voidsetLastModified(FileVersion reconstructedFileVersion, java.io.File reconstructedFilesAtFinalLocation)
-
-
-
Field Detail
-
logger
protected static final java.util.logging.Logger logger
-
winningDatabase
protected MemoryDatabase winningDatabase
-
fileVersion1
protected FileVersion fileVersion1
-
fileVersion2
protected FileVersion fileVersion2
-
fileVersionHelper
protected FileVersionComparator fileVersionHelper
-
-
Constructor Detail
-
FileSystemAction
public FileSystemAction(Config config, MemoryDatabase winningDatabase, FileVersion file1, FileVersion file2)
-
-
Method Detail
-
getFile1
public FileVersion getFile1()
-
getFile2
public FileVersion getFile2()
-
getType
public FileVersion.FileType getType()
-
createSymlink
protected void createSymlink(FileVersion reconstructedFileVersion) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setLastModified
protected void setLastModified(FileVersion reconstructedFileVersion)
-
setLastModified
protected void setLastModified(FileVersion reconstructedFileVersion, java.io.File reconstructedFilesAtFinalLocation)
-
moveToConflictFile
protected void moveToConflictFile(FileVersion targetFileVersion) throws java.io.IOException
- Throws:
java.io.IOException
-
moveToConflictFile
protected void moveToConflictFile(NormalizedPath conflictingPath) throws java.io.IOException
- Throws:
java.io.IOException
-
moveFileToFinalLocation
protected java.io.File moveFileToFinalLocation(java.io.File reconstructedFileInCache, FileVersion targetFileVersion) throws java.io.IOException
- Throws:
java.io.IOException
-
createFolder
protected void createFolder(NormalizedPath targetDir) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setFileAttributes
protected void setFileAttributes(FileVersion reconstructedFileVersion) throws java.io.IOException
- Throws:
java.io.IOException
-
setFileAttributes
protected void setFileAttributes(FileVersion reconstructedFileVersion, java.io.File reconstructedFilesAtFinalLocation) throws java.io.IOException
- Throws:
java.io.IOException
-
fileAsExpected
protected boolean fileAsExpected(FileVersion expectedLocalFileVersion)
-
fileAsExpected
protected boolean fileAsExpected(FileVersion expectedLocalFileVersion, FileVersionComparator.FileChange... allowedFileChanges)
-
fileChanges
protected FileVersionComparator.FileVersionComparison fileChanges(FileVersion expectedLocalFileVersion)
-
fileExists
protected boolean fileExists(FileVersion expectedLocalFileVersion)
-
deleteFile
protected void deleteFile(FileVersion deleteFileVersion)
-
getAbsolutePathFile
protected java.io.File getAbsolutePathFile(java.lang.String relativePath)
-
execute
public abstract FileSystemActionResult execute() throws java.lang.Exception
- Throws:
java.lang.Exception
-
-