Package org.duracloud.sync.mgmt
Class ChangedList
- java.lang.Object
-
- org.duracloud.sync.mgmt.ChangedList
-
- All Implemented Interfaces:
Serializable
public class ChangedList extends Object implements Serializable
The list of files which have been changed.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddChangedFile(File changedFile)Adds a changed file to the list of items to be processed.voidaddListener(ChangedListListener listener)voidclear()Removes all files from the changed list.protected voidfireChangedEvent()protected voidfireChangedEventAsync()static ChangedListgetInstance()intgetListSize()Gets the current size of the changed listintgetListSizeIncludingReservedFiles()Gets the current size of the changed list included the files that have been reservedlonggetVersion()List<File>peek(int maxFiles)longpersist(File persistFile)Writes out the current state of the ChangeList to the given file.voidremoveListener(ChangedListListener listener)ChangedFilereserve()Retrieves a changed file for processing and removes it from the list of unreserved files.voidrestore(File persistFile, List<File> contentDirs)Restores the state of the ChangedList using the given backup filevoidsetFileExclusionManager(FileExclusionManager fileExclusionManager)voidshutdown()
-
-
-
Method Detail
-
getInstance
public static ChangedList getInstance()
-
setFileExclusionManager
public void setFileExclusionManager(FileExclusionManager fileExclusionManager)
-
addChangedFile
public boolean addChangedFile(File changedFile)
Adds a changed file to the list of items to be processed. If the file happens to match exclusion rules it will not be added to the list (and the method will return false). Note that only the most current update to any given file is provided to the change processor.- Parameters:
changedFile- a file which has changed on the file system- Returns:
- false if the changedFile is null or matches at least one exclusion rule.
-
getListSize
public int getListSize()
Gets the current size of the changed list- Returns:
- the size of the list
-
getListSizeIncludingReservedFiles
public int getListSizeIncludingReservedFiles()
Gets the current size of the changed list included the files that have been reserved- Returns:
- the size of the list
-
fireChangedEvent
protected void fireChangedEvent()
-
fireChangedEventAsync
protected void fireChangedEventAsync()
-
addListener
public void addListener(ChangedListListener listener)
-
removeListener
public void removeListener(ChangedListListener listener)
-
clear
public void clear()
Removes all files from the changed list.
-
reserve
public ChangedFile reserve()
Retrieves a changed file for processing and removes it from the list of unreserved files. Returns null if there are no changed files in the list.- Returns:
- a file which has changed on the file system
-
getVersion
public long getVersion()
-
persist
public long persist(File persistFile)
Writes out the current state of the ChangeList to the given file.- Parameters:
persistFile- file to write state to- Returns:
- the version ID of the ChangedList which was persisted
-
restore
public void restore(File persistFile, List<File> contentDirs)
Restores the state of the ChangedList using the given backup file- Parameters:
persistFile- file containing previous statecontentDirs- content directories currently configured.
-
shutdown
public void shutdown()
-
-