public class SyncingRepository extends DirectRepositoryWrapper
Modifier and Type | Class and Description |
---|---|
static class |
SyncingRepository.ModifiedSinceLastSyncQuery |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INTERNAL_DELETE_LOCAL_AFTER_SYNC |
static java.lang.String |
INTERNAL_SYNC |
static java.lang.String |
LOCAL_CONFIG_HANDLE |
Constructor and Description |
---|
SyncingRepository(Repository remote,
DirectRepository local,
SyncingConfig syncingConfig) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the repository and release all resources.
|
void |
createDataElement(java.lang.String handle,
java.lang.String name)
Creates a new data element with the given name in this digital object.
|
DigitalObject |
createDigitalObject(java.lang.String handle)
Creates a new digital object with the given identifier in this repository.
|
void |
deleteAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name)
Deletes a particular attribute.
|
void |
deleteAttributes(java.lang.String handle,
java.lang.String elementName,
java.util.List<java.lang.String> names)
Deletes multiple attributes.
|
void |
deleteDataElement(java.lang.String handle,
java.lang.String name)
Deletes any data element of the given name.
|
SyncingConfig |
getConfig() |
long |
getGreatestModifiedFromRemote() |
long |
getLastSyncTime() |
long |
getPriorLastSyncTime() |
void |
lock(java.lang.String handle) |
void |
setAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name,
java.lang.String value)
Sets a particular attribute.
|
void |
setAttributes(java.lang.String handle,
java.lang.String elementName,
java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the value of multiple attributes.
|
void |
startSyncing() |
void |
stopSyncing() |
void |
syncNow() |
void |
unlock(java.lang.String handle) |
long |
write(java.lang.String handle,
java.lang.String elementName,
java.io.InputStream data,
boolean append)
Writes new data into the data element.
|
getAttribute, getAttributes, getFile, getSize, listAttributes, listDataElementNames, read, verifyDataElement
deleteDigitalObject, getDigitalObject, getHandle, getOrCreateDigitalObject, listHandles, listObjects, search, search, search, searchHandles, searchHandles, searchHandles, searchMapping, verifyDigitalObject
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteDigitalObject, getDigitalObject, getHandle, getOrCreateDigitalObject, listHandles, listObjects, search, search, search, searchHandles, searchHandles, searchHandles, searchMapping, verifyDigitalObject
public static final java.lang.String LOCAL_CONFIG_HANDLE
public static final java.lang.String INTERNAL_SYNC
public static final java.lang.String INTERNAL_DELETE_LOCAL_AFTER_SYNC
public SyncingRepository(Repository remote, DirectRepository local, SyncingConfig syncingConfig) throws RepositoryException
RepositoryException
public void lock(java.lang.String handle)
public SyncingConfig getConfig()
public long getGreatestModifiedFromRemote()
public long getLastSyncTime()
public long getPriorLastSyncTime()
public void unlock(java.lang.String handle)
public void startSyncing()
public void stopSyncing()
public void syncNow() throws RepositoryException, java.io.IOException
RepositoryException
java.io.IOException
public void close()
Repository
close
in interface Repository
close
in class RepositoryWrapper
public DigitalObject createDigitalObject(java.lang.String handle) throws CreationException, RepositoryException
Repository
null
requests that the repository assign a new unique identifier;
this method will throw UnsupportedOperationException
if the given repository does not support that functionality.createDigitalObject
in interface Repository
createDigitalObject
in class RepositoryWrapper
handle
- the identifier for the new digital object, or null
to request that the repository assign a new unique identifier.CreationException
- if an object with the given identifier already exists within the repositoryRepositoryException
public void setAttributes(java.lang.String handle, java.lang.String elementName, java.util.Map<java.lang.String,java.lang.String> attributes) throws RepositoryException
DirectRepository
setAttributes
in interface DirectRepository
setAttributes
in class DirectRepositoryWrapper
attributes
- the attributes to set, mapped to their new valuesRepositoryException
public void setAttribute(java.lang.String handle, java.lang.String elementName, java.lang.String name, java.lang.String value) throws RepositoryException
DirectRepository
setAttribute
in interface DirectRepository
setAttribute
in class DirectRepositoryWrapper
name
- the attribute namevalue
- the attribute value; if null, the attribute will be deleted.RepositoryException
public void deleteAttributes(java.lang.String handle, java.lang.String elementName, java.util.List<java.lang.String> names) throws RepositoryException
DirectRepository
deleteAttributes
in interface DirectRepository
deleteAttributes
in class DirectRepositoryWrapper
names
- the names of the attributes to deleteRepositoryException
public void deleteAttribute(java.lang.String handle, java.lang.String elementName, java.lang.String name) throws RepositoryException
DirectRepository
deleteAttribute
in interface DirectRepository
deleteAttribute
in class DirectRepositoryWrapper
name
- the name of the attribute to deleteRepositoryException
public void createDataElement(java.lang.String handle, java.lang.String name) throws CreationException, RepositoryException
DirectRepository
createDataElement
in interface DirectRepository
createDataElement
in class DirectRepositoryWrapper
name
- the identifier for the new data elementCreationException
- if a data element with the given name already existsRepositoryException
public void deleteDataElement(java.lang.String handle, java.lang.String name) throws RepositoryException
DirectRepository
deleteDataElement
in interface DirectRepository
deleteDataElement
in class DirectRepositoryWrapper
name
- the identifier for the data elementRepositoryException
public long write(java.lang.String handle, java.lang.String elementName, java.io.InputStream data, boolean append) throws java.io.IOException, RepositoryException
DirectRepository
write
in interface DirectRepository
write
in class DirectRepositoryWrapper
data
- an InputStream streaming the new dataappend
- whether to append the new data to the existing datajava.io.IOException
RepositoryException