public class SQLiteRepository extends AbstractRepository implements DirectRepository
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String[] |
attColumns |
static java.lang.String |
ATTRIBUTE_NAME |
static java.lang.String |
DATABASE_NAME |
static java.lang.String |
ELEMENT_NAME |
static java.lang.String[] |
elNameOnlyColumns |
static java.lang.String |
HANDLE |
static java.lang.String[] |
handleOnlyColumns |
static java.lang.String |
NULL |
static java.lang.String |
OBJECTS |
static java.lang.String |
VALUE |
static java.lang.String[] |
valueOnlyColumns |
| Constructor and Description |
|---|
SQLiteRepository(android.content.Context context) |
| 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.
|
void |
deleteDigitalObject(java.lang.String handle)
Deletes a digital object from the repository.
|
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.
|
android.database.sqlite.SQLiteDatabase |
getDb() |
DigitalObject |
getDigitalObject(java.lang.String handle)
Returns the digital object with the given identifier from this repository.
|
java.io.File |
getElementFile(java.lang.String handle,
java.lang.String name,
boolean create) |
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 query)
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 query)
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.
|
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.
|
getHandle, search, search, searchHandles, searchHandles, searchMappingequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHandle, search, search, searchHandles, searchHandles, searchMappingpublic static final java.lang.String NULL
public static final java.lang.String DATABASE_NAME
public static final java.lang.String OBJECTS
public static final java.lang.String HANDLE
public static final java.lang.String ELEMENT_NAME
public static final java.lang.String ATTRIBUTE_NAME
public static final java.lang.String VALUE
public static final java.lang.String[] attColumns
public static final java.lang.String[] valueOnlyColumns
public static final java.lang.String[] elNameOnlyColumns
public static final java.lang.String[] handleOnlyColumns
public android.database.sqlite.SQLiteDatabase getDb()
public boolean verifyDigitalObject(java.lang.String handle)
throws RepositoryException
RepositoryverifyDigitalObject in interface RepositoryverifyDigitalObject in class AbstractRepositoryhandle - an identifier for a digital objectRepositoryExceptionpublic DigitalObject createDigitalObject(java.lang.String handle) throws CreationException, RepositoryException
Repositorynull 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 Repositoryhandle - 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 repositoryRepositoryExceptionpublic DigitalObject getDigitalObject(java.lang.String handle) throws RepositoryException
RepositorygetDigitalObject in interface Repositoryhandle - the identifier for the digital objectRepositoryExceptionpublic DigitalObject getOrCreateDigitalObject(java.lang.String handle) throws RepositoryException
RepositorygetOrCreateDigitalObject in interface RepositorygetOrCreateDigitalObject in class AbstractRepositoryhandle - the identifier for the digital objectRepositoryExceptionpublic void close()
Repositoryclose in interface Repositorypublic java.util.Map<java.lang.String,java.lang.String> getAttributes(java.lang.String handle,
java.lang.String elementName)
throws RepositoryException
DirectRepositorygetAttributes in interface DirectRepositoryRepositoryExceptionpublic CloseableIterator<java.util.Map.Entry<java.lang.String,java.lang.String>> listAttributes(java.lang.String handle, java.lang.String elementName) throws RepositoryException
DirectRepositorylistAttributes in interface DirectRepositoryRepositoryExceptionpublic java.lang.String getAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name)
throws RepositoryException
DirectRepositorygetAttribute in interface DirectRepositoryname - the attribute nameRepositoryExceptionpublic void setAttributes(java.lang.String handle,
java.lang.String elementName,
java.util.Map<java.lang.String,java.lang.String> attributes)
throws RepositoryException
DirectRepositorysetAttributes in interface DirectRepositoryattributes - the attributes to set, mapped to their new valuesRepositoryExceptionpublic void setAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name,
java.lang.String value)
throws RepositoryException
DirectRepositorysetAttribute in interface DirectRepositoryname - the attribute namevalue - the attribute value; if null, the attribute will be deleted.RepositoryExceptionpublic void deleteAttributes(java.lang.String handle,
java.lang.String elementName,
java.util.List<java.lang.String> names)
throws RepositoryException
DirectRepositorydeleteAttributes in interface DirectRepositorynames - the names of the attributes to deleteRepositoryExceptionpublic void deleteAttribute(java.lang.String handle,
java.lang.String elementName,
java.lang.String name)
throws RepositoryException
DirectRepositorydeleteAttribute in interface DirectRepositoryname - the name of the attribute to deleteRepositoryExceptionpublic boolean verifyDataElement(java.lang.String handle,
java.lang.String name)
throws RepositoryException
DirectRepositoryverifyDataElement in interface DirectRepositoryname - an identifier for a data elementRepositoryExceptionpublic void createDataElement(java.lang.String handle,
java.lang.String name)
throws CreationException,
RepositoryException
DirectRepositorycreateDataElement in interface DirectRepositoryname - the identifier for the new data elementCreationException - if a data element with the given name already existsRepositoryExceptionpublic void deleteDataElement(java.lang.String handle,
java.lang.String name)
throws RepositoryException
DirectRepositorydeleteDataElement in interface DirectRepositoryname - the identifier for the data elementRepositoryExceptionpublic void deleteDigitalObject(java.lang.String handle)
throws RepositoryException
RepositorydeleteDigitalObject in interface RepositorydeleteDigitalObject in class AbstractRepositoryhandle - the identifier for the digital objectRepositoryExceptionpublic CloseableIterator<java.lang.String> listDataElementNames(java.lang.String handle) throws RepositoryException
DirectRepositorylistDataElementNames in interface DirectRepositoryRepositoryExceptionpublic java.io.File getElementFile(java.lang.String handle,
java.lang.String name,
boolean create)
throws InternalException
InternalExceptionpublic java.io.InputStream read(java.lang.String handle,
java.lang.String elementName)
throws RepositoryException
DirectRepositoryread in interface DirectRepositoryRepositoryExceptionpublic long write(java.lang.String handle,
java.lang.String elementName,
java.io.InputStream data,
boolean append)
throws java.io.IOException,
RepositoryException
DirectRepositorywrite in interface DirectRepositorydata - an InputStream streaming the new dataappend - whether to append the new data to the existing datajava.io.IOExceptionRepositoryExceptionpublic long getSize(java.lang.String handle,
java.lang.String elementName)
throws RepositoryException
DirectRepositorygetSize in interface DirectRepositoryRepositoryExceptionpublic java.io.File getFile(java.lang.String handle,
java.lang.String elementName)
throws RepositoryException
DirectRepositorygetFile in interface DirectRepositoryRepositoryExceptionpublic CloseableIterator<java.lang.String> listHandles() throws RepositoryException
RepositorylistHandles in interface RepositorylistHandles in class AbstractRepositoryRepositoryExceptionpublic CloseableIterator<DigitalObject> listObjects() throws RepositoryException
RepositorylistObjects in interface RepositorylistObjects in class AbstractRepositoryRepositoryExceptionpublic CloseableIterator<DigitalObject> search(Query query) throws RepositoryException
Repositorysearch in interface Repositorysearch in class AbstractRepositoryquery - the query to performQueryResults.RepositoryExceptionpublic CloseableIterator<java.lang.String> searchHandles(Query query) throws RepositoryException
RepositorysearchHandles in interface RepositorysearchHandles in class AbstractRepositoryquery - the query to performQueryResults.RepositoryException