public class BdbjeRepository extends AbstractRepository implements DirectRepository
Constructor and Description |
---|
BdbjeRepository(java.io.File base) |
BdbjeRepository(java.io.File base,
com.sleepycat.je.Durability durability) |
BdbjeRepository(java.io.File base,
com.sleepycat.je.EnvironmentConfig envConfig) |
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.
|
java.lang.String |
getAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name)
Returns the value for a particular attribute
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes(java.lang.String handle,
java.lang.String elementName)
Returns a Map view of the attributes of the digital object or data element.
|
DigitalObject |
getDigitalObject(java.lang.String handle)
Returns the digital object with the given identifier from this repository.
|
java.io.File |
getFile(java.lang.String handle,
java.lang.String elementName)
Returns a file for the data of the data element.
|
DigitalObject |
getOrCreateDigitalObject(java.lang.String handle)
Returns the digital object with the given identifier from this repository, which is created if it does not exist.
|
long |
getSize(java.lang.String handle,
java.lang.String elementName)
Returns the number of bytes of data in this data element.
|
CloseableIterator<java.util.Map.Entry<java.lang.String,java.lang.String>> |
listAttributes(java.lang.String handle,
java.lang.String elementName)
Returns a CloseableIterator view of the attributes of the digital object or data element.
|
CloseableIterator<java.lang.String> |
listDataElementNames(java.lang.String handle)
Provides a CloseableIterator view of the names of the data elements in this digital object.
|
CloseableIterator<java.lang.String> |
listHandles()
Provides a CloseableIterator view of the identifiers for digital objects accessible through this repository.
|
CloseableIterator<DigitalObject> |
listObjects()
Provides a CloseableIterator view of the digital objects accessible through this repository.
|
java.io.InputStream |
read(java.lang.String handle,
java.lang.String elementName)
Provides access to the data as an InputStream.
|
CloseableIterator<DigitalObject> |
search(Query q)
Provides a CloseableIterator view of the digital objects accessible through this repository under search bounds defined in the Query object with default parameters.
|
CloseableIterator<java.lang.String> |
searchHandles(Query q)
Provides a CloseableIterator view of the digital objects handles accessible through this repository under search bounds defined in the Query object with default parameters.
|
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.
|
java.lang.String |
toString() |
boolean |
verifyDataElement(java.lang.String handle,
java.lang.String name)
Verifies whether a data element with the given name exists within this digital object
|
boolean |
verifyDigitalObject(java.lang.String handle)
Verifies whether a digital object with the given identifier can be accessed via this repository.
|
long |
write(java.lang.String handle,
java.lang.String elementName,
java.io.InputStream data,
boolean append)
Writes new data into the data element.
|
deleteDigitalObject, getHandle, search, search, searchHandles, searchHandles, searchMapping
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
deleteDigitalObject, getHandle, search, search, searchHandles, searchHandles, searchMapping
public BdbjeRepository(java.io.File base) throws InternalException
InternalException
public BdbjeRepository(java.io.File base, com.sleepycat.je.Durability durability) throws InternalException
InternalException
public BdbjeRepository(java.io.File base, com.sleepycat.je.EnvironmentConfig envConfig) throws InternalException
InternalException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean verifyDigitalObject(java.lang.String handle) throws RepositoryException
Repository
verifyDigitalObject
in interface Repository
verifyDigitalObject
in class AbstractRepository
handle
- an identifier for a digital objectRepositoryException
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
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 DigitalObject getOrCreateDigitalObject(java.lang.String handle) throws RepositoryException
Repository
getOrCreateDigitalObject
in interface Repository
getOrCreateDigitalObject
in class AbstractRepository
handle
- the identifier for the digital objectRepositoryException
public DigitalObject getDigitalObject(java.lang.String handle) throws RepositoryException
Repository
getDigitalObject
in interface Repository
handle
- the identifier for the digital objectRepositoryException
public CloseableIterator<java.lang.String> listHandles() throws RepositoryException
Repository
listHandles
in interface Repository
listHandles
in class AbstractRepository
RepositoryException
public CloseableIterator<DigitalObject> listObjects() throws RepositoryException
Repository
listObjects
in interface Repository
listObjects
in class AbstractRepository
RepositoryException
public CloseableIterator<DigitalObject> search(Query q) throws RepositoryException
Repository
search
in interface Repository
search
in class AbstractRepository
q
- the query to performQueryResults
.RepositoryException
public CloseableIterator<java.lang.String> searchHandles(Query q) throws RepositoryException
Repository
searchHandles
in interface Repository
searchHandles
in class AbstractRepository
q
- the query to performQueryResults
.RepositoryException
public void close()
Repository
close
in interface Repository
public java.util.Map<java.lang.String,java.lang.String> getAttributes(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepository
getAttributes
in interface DirectRepository
RepositoryException
public CloseableIterator<java.util.Map.Entry<java.lang.String,java.lang.String>> listAttributes(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepository
listAttributes
in interface DirectRepository
RepositoryException
public java.lang.String getAttribute(java.lang.String handle, java.lang.String elementName, java.lang.String name) throws RepositoryException
DirectRepository
getAttribute
in interface DirectRepository
name
- the attribute nameRepositoryException
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
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
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
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
name
- the name of the attribute to deleteRepositoryException
public boolean verifyDataElement(java.lang.String handle, java.lang.String name) throws RepositoryException
DirectRepository
verifyDataElement
in interface DirectRepository
name
- an identifier for a data elementRepositoryException
public void createDataElement(java.lang.String handle, java.lang.String name) throws CreationException, RepositoryException
DirectRepository
createDataElement
in interface DirectRepository
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
name
- the identifier for the data elementRepositoryException
public CloseableIterator<java.lang.String> listDataElementNames(java.lang.String handle) throws RepositoryException
DirectRepository
listDataElementNames
in interface DirectRepository
RepositoryException
public java.io.InputStream read(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepository
read
in interface DirectRepository
RepositoryException
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
data
- an InputStream streaming the new dataappend
- whether to append the new data to the existing datajava.io.IOException
RepositoryException
public long getSize(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepository
getSize
in interface DirectRepository
RepositoryException
public java.io.File getFile(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepository
getFile
in interface DirectRepository
RepositoryException