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 Config
config
protected FileVersion
fileVersion1
protected FileVersion
fileVersion2
protected FileVersionComparator
fileVersionHelper
protected static java.util.logging.Logger
logger
protected MemoryDatabase
winningDatabase
-
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 void
createFolder(NormalizedPath targetDir)
protected void
createSymlink(FileVersion reconstructedFileVersion)
protected void
deleteFile(FileVersion deleteFileVersion)
abstract FileSystemActionResult
execute()
protected boolean
fileAsExpected(FileVersion expectedLocalFileVersion)
protected boolean
fileAsExpected(FileVersion expectedLocalFileVersion, FileVersionComparator.FileChange... allowedFileChanges)
protected FileVersionComparator.FileVersionComparison
fileChanges(FileVersion expectedLocalFileVersion)
protected boolean
fileExists(FileVersion expectedLocalFileVersion)
protected java.io.File
getAbsolutePathFile(java.lang.String relativePath)
FileVersion
getFile1()
FileVersion
getFile2()
FileVersion.FileType
getType()
protected java.io.File
moveFileToFinalLocation(java.io.File reconstructedFileInCache, FileVersion targetFileVersion)
protected void
moveToConflictFile(FileVersion targetFileVersion)
protected void
moveToConflictFile(NormalizedPath conflictingPath)
protected void
setFileAttributes(FileVersion reconstructedFileVersion)
protected void
setFileAttributes(FileVersion reconstructedFileVersion, java.io.File reconstructedFilesAtFinalLocation)
protected void
setLastModified(FileVersion reconstructedFileVersion)
protected void
setLastModified(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
-
-