Class FileSystemSyncEndpoint

java.lang.Object
org.duracloud.sync.endpoint.FileSystemSyncEndpoint
All Implemented Interfaces:
SyncEndpoint

public class FileSystemSyncEndpoint extends Object implements SyncEndpoint
Allows syncing to be performed to a location on the local file system. This class is primarily for testing purposes, and it not intended for production use. Note that directories that have been deleted at the source are not deleted by this endpoint. The nature of cloud storage is that if no files exist in a given directory, that directory doesn't exist (directories are completely virtual and exist only in the names of the individual files.)
  • Constructor Details

    • FileSystemSyncEndpoint

      public FileSystemSyncEndpoint(File syncToDir, boolean syncDeletes)
      Creates a SyncEnpoint pointing to a directory on the local file system where files will be synced to.
      Parameters:
      syncToDir -
  • Method Details

    • syncFile

      public boolean syncFile(MonitoredFile syncFile, File watchDir)
      Description copied from interface: SyncEndpoint
      Ensures that the endpoint includes a file equivalent to the provided local file: - If the local file exists but no file with the same path exists at the endpoint, the local file will be copied to the endpoint - If the local file exists and is different from a file with the same path at the endpoint, the local file will replace the file at the endpoint. - If the local file does not exist (it has been deleted), a file with the same path will be removed at the endpoint (if it exists)
      Specified by:
      syncFile in interface SyncEndpoint
      Parameters:
      syncFile - local file to sync with the endpoint
      watchDir - the directory under watch in which this file resides
      Returns:
      true if file was successfully synced, false otherwise
    • syncFileAndReturnDetailedResult

      public SyncResultType syncFileAndReturnDetailedResult(MonitoredFile monitoredFile, File watchDir)
      Description copied from interface: SyncEndpoint
      An alternate form of the syncFile method that returns a more nuanced result.
      Specified by:
      syncFileAndReturnDetailedResult in interface SyncEndpoint
      Returns:
    • getSyncToFile

      protected File getSyncToFile(MonitoredFile syncFile, File watchDir)
    • getFilesList

      public Iterator<String> getFilesList()
      Description copied from interface: SyncEndpoint
      Retrieves a listing of all files available at the endpoint. This list is to be used for comparison with the local system.
      Specified by:
      getFilesList in interface SyncEndpoint
      Returns:
      Iterator allowing access to complete file listing
    • addEndPointListener

      public void addEndPointListener(EndPointListener listener)
      Description copied from interface: SyncEndpoint
      Registers a listener
      Specified by:
      addEndPointListener in interface SyncEndpoint
    • removeEndPointListener

      public void removeEndPointListener(EndPointListener listener)
      Description copied from interface: SyncEndpoint
      Unregisters a listener
      Specified by:
      removeEndPointListener in interface SyncEndpoint
    • deleteContent

      public void deleteContent(String spaceId, String contentId)
      Description copied from interface: SyncEndpoint
      Removes content from the endpoint.
      Specified by:
      deleteContent in interface SyncEndpoint