Package org.duracloud.sync.endpoint
Class DuraStoreSyncEndpoint
- java.lang.Object
-
- org.duracloud.sync.endpoint.DuraStoreSyncEndpoint
-
- All Implemented Interfaces:
SyncEndpoint
- Direct Known Subclasses:
DuraStoreChunkSyncEndpoint
public class DuraStoreSyncEndpoint extends Object implements SyncEndpoint
Endpoint which pushes files to DuraCloud.
-
-
Constructor Summary
Constructors Constructor Description DuraStoreSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, boolean jumpStart)DuraStoreSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, boolean syncUpdates, boolean renameUpdates, boolean jumpStart, String updateSuffix, String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEndPointListener(EndPointListener listener)Registers a listenerprotected voidaddUpdateContent(String contentId, MonitoredFile syncFile)protected Map<String,String>createProps(String absolutePath, String username)voiddeleteContent(String spaceId, String contentId)Removes content from the endpoint.protected voiddoAddContent(MonitoredFile syncFile, String contentId, String absPath)protected Map<String,String>getContentProperties(String spaceId, String contentId)protected ContentStoregetContentStore()Iterator<String>getFilesList()Retrieves a listing of all files available at the endpoint.protected StringgetSpaceId()protected StringgetUsername()voidremoveEndPointListener(EndPointListener listener)Unregisters a listenerbooleansyncFile(MonitoredFile syncFile, File watchDir)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.SyncResultTypesyncFileAndReturnDetailedResult(MonitoredFile syncFile, File watchDir)An alternate form of the syncFile method that returns a more nuanced result.
-
-
-
Constructor Detail
-
DuraStoreSyncEndpoint
public DuraStoreSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, boolean syncUpdates, boolean renameUpdates, boolean jumpStart, String updateSuffix, String prefix)
-
DuraStoreSyncEndpoint
public DuraStoreSyncEndpoint(ContentStore contentStore, String username, String spaceId, boolean syncDeletes, boolean jumpStart)
-
-
Method Detail
-
getUsername
protected String getUsername()
-
syncFile
public boolean syncFile(MonitoredFile syncFile, File watchDir)
Description copied from interface:SyncEndpointEnsures 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:
syncFilein interfaceSyncEndpoint- Parameters:
syncFile- local file to sync with the endpointwatchDir- the directory under watch in which this file resides- Returns:
- true if file was successfully synced, false otherwise
-
syncFileAndReturnDetailedResult
public SyncResultType syncFileAndReturnDetailedResult(MonitoredFile syncFile, File watchDir)
Description copied from interface:SyncEndpointAn alternate form of the syncFile method that returns a more nuanced result.- Specified by:
syncFileAndReturnDetailedResultin interfaceSyncEndpoint- Returns:
-
doAddContent
protected void doAddContent(MonitoredFile syncFile, String contentId, String absPath) throws ContentStoreException
- Throws:
ContentStoreException
-
getContentProperties
protected Map<String,String> getContentProperties(String spaceId, String contentId)
-
deleteContent
public void deleteContent(String spaceId, String contentId) throws ContentStoreException
Description copied from interface:SyncEndpointRemoves content from the endpoint.- Specified by:
deleteContentin interfaceSyncEndpoint- Throws:
ContentStoreException
-
addUpdateContent
protected void addUpdateContent(String contentId, MonitoredFile syncFile) throws ContentStoreException
- Throws:
ContentStoreException
-
getFilesList
public Iterator<String> getFilesList()
Description copied from interface:SyncEndpointRetrieves a listing of all files available at the endpoint. This list is to be used for comparison with the local system.- Specified by:
getFilesListin interfaceSyncEndpoint- Returns:
- Iterator allowing access to complete file listing
-
getContentStore
protected ContentStore getContentStore()
-
getSpaceId
protected String getSpaceId()
-
addEndPointListener
public void addEndPointListener(EndPointListener listener)
Description copied from interface:SyncEndpointRegisters a listener- Specified by:
addEndPointListenerin interfaceSyncEndpoint
-
removeEndPointListener
public void removeEndPointListener(EndPointListener listener)
Description copied from interface:SyncEndpointUnregisters a listener- Specified by:
removeEndPointListenerin interfaceSyncEndpoint
-
-