public class HashDirectoryStorage extends AbstractStorage
Constructor and Description |
---|
HashDirectoryStorage() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static java.lang.String |
convertFromFileName(java.lang.String fileName)
Performs a conversion from the given encoded file name to the string
that was encoded to get the file name.
|
static java.lang.String |
convertToFileName(java.lang.String str)
Performs a conversion from the given string to an encoded version
that can be used as a file/URL name.
|
java.lang.String |
createObject(java.lang.String id,
java.lang.String objectName,
boolean logTxn)
Creates a new digital object with the given ID, if one does not already exist.
|
java.lang.String |
createObject(java.lang.String id,
java.lang.String objectName,
boolean logTxn,
long timestamp)
Creates a new digital object with the given ID, if one does not already exist.
|
static byte |
decodeHex(char b1,
char b2)
Decode the given two hexadecimal characters into the byte that they represent.
|
void |
deleteAttributes(java.lang.String objectID,
java.lang.String elementID,
java.lang.String[] attributeKeys,
boolean logTxn,
long timestamp)
Remove the attributes with the given keys from the object or data element.
|
boolean |
deleteDataElement(java.lang.String objectID,
java.lang.String elementID,
boolean logTxn)
Deletes the specified data element from the given object.
|
boolean |
deleteDataElement(java.lang.String objectID,
java.lang.String elementID,
boolean logTxn,
long timestamp)
Deletes the specified data element from the given object.
|
void |
deleteObject(java.lang.String objectID,
boolean logTxn)
Deletes the given object.
|
void |
deleteObject(java.lang.String objectID,
boolean logTxn,
long timestamp)
Deletes the given object.
|
void |
deserializeObject(java.lang.String objectID,
java.lang.String format,
java.io.InputStream in)
Reset the object's state and re-initialize the object with the data in the
given InputStream in the given format.
|
boolean |
doesDataElementExist(java.lang.String objectID,
java.lang.String elementID)
Returns true if the given data element exists
|
boolean |
doesObjectExist(java.lang.String objectID)
Returns true if the given digital object exists.
|
static void |
encodeHex(byte[] buf,
int offset,
int length,
java.lang.StringBuffer strBuf)
Encode the given byte array into a hexadecimal string.
|
HeaderSet |
getAttributes(java.lang.String objectID,
java.lang.String elementID,
HeaderSet container)
Get the value that has been associated with the given key.
|
java.io.InputStream |
getDataElement(java.lang.String objectID,
java.lang.String elementID)
Returns the identified data element for the given object.
|
java.io.File |
getFileForDataElement(java.lang.String objectID,
java.lang.String elementID)
Returns the File in which the given data element is stored, if any.
|
DOMetadata |
getObjectInfo(java.lang.String objectID,
DOMetadata metadata)
Returns any known metadata for the digital object with the given identifier.
|
void |
initWithDirectory(Main server,
java.io.File baseDirectory)
Initializes the storage for use with server based in the given storage directory.
|
java.util.Enumeration |
listDataElements(java.lang.String objectID)
Returns an Enumeration (so that not all elements have to be loaded at once)
|
java.util.Enumeration |
listObjects()
Returns an Enumeration of all of the objects in the repository.
|
static void |
main(java.lang.String[] argv) |
void |
serializeObject(java.lang.String objectID,
java.lang.String format,
java.io.OutputStream out)
Write the entire object into the given OutputStream in the given format
|
void |
setAttributes(java.lang.String objectID,
java.lang.String elementID,
HeaderSet attributes,
boolean logTxn,
long timestamp)
Add the given key-value attribute to the object, replacing any existing
attribute that has the same key.
|
void |
setObjectInfo(DOMetadata metadata)
Sets the metadata for the given digital object.
|
void |
storeDataElement(java.lang.String objectID,
java.lang.String elementID,
java.io.InputStream input,
boolean logTxn,
boolean append)
Stores the data read from the given InputStream into the given data element for
the object identified by objectID.
|
void |
storeDataElement(java.lang.String objectID,
java.lang.String elementID,
java.io.InputStream input,
boolean logTxn,
boolean append,
long timestamp)
Stores the data read from the given InputStream into the given data element for
the object identified by objectID.
|
java.lang.String |
toString() |
createObject, deleteAttributes, deleteDataElement, deleteObject, getTransactionQueue, initTransactionQueue, isConcatenatedQueueNeeded, setAttributes, setTransactionQueue, storeDataElement
public void initWithDirectory(Main server, java.io.File baseDirectory) throws DOException
DOException
public void close()
public java.lang.String createObject(java.lang.String id, java.lang.String objectName, boolean logTxn) throws DOException
DOException
public java.lang.String createObject(java.lang.String id, java.lang.String objectName, boolean logTxn, long timestamp) throws DOException
DOException
public void deleteObject(java.lang.String objectID, boolean logTxn) throws DOException
DOException
public void deleteObject(java.lang.String objectID, boolean logTxn, long timestamp) throws DOException
DOException
public DOMetadata getObjectInfo(java.lang.String objectID, DOMetadata metadata) throws DOException
DOException
public void setObjectInfo(DOMetadata metadata) throws DOException
DOException
public void deleteAttributes(java.lang.String objectID, java.lang.String elementID, java.lang.String[] attributeKeys, boolean logTxn, long timestamp) throws DOException
DOException
public void setAttributes(java.lang.String objectID, java.lang.String elementID, HeaderSet attributes, boolean logTxn, long timestamp) throws DOException
DOException
public HeaderSet getAttributes(java.lang.String objectID, java.lang.String elementID, HeaderSet container) throws DOException
DOException
public boolean doesObjectExist(java.lang.String objectID) throws DOException
DOException
public boolean doesDataElementExist(java.lang.String objectID, java.lang.String elementID) throws DOException
DOException
public java.io.File getFileForDataElement(java.lang.String objectID, java.lang.String elementID) throws DOException
DOException
public java.util.Enumeration listObjects() throws DOException
DOException
public java.util.Enumeration listDataElements(java.lang.String objectID) throws DOException
DOException
public java.io.InputStream getDataElement(java.lang.String objectID, java.lang.String elementID) throws DOException
DOException
public void storeDataElement(java.lang.String objectID, java.lang.String elementID, java.io.InputStream input, boolean logTxn, boolean append) throws DOException
DOException
public void storeDataElement(java.lang.String objectID, java.lang.String elementID, java.io.InputStream input, boolean logTxn, boolean append, long timestamp) throws DOException
DOException
public boolean deleteDataElement(java.lang.String objectID, java.lang.String elementID, boolean logTxn) throws DOException
DOException
public boolean deleteDataElement(java.lang.String objectID, java.lang.String elementID, boolean logTxn, long timestamp) throws DOException
DOException
public void serializeObject(java.lang.String objectID, java.lang.String format, java.io.OutputStream out) throws DOException
DOException
public void deserializeObject(java.lang.String objectID, java.lang.String format, java.io.InputStream in) throws DOException
DOException
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
public static final void encodeHex(byte[] buf, int offset, int length, java.lang.StringBuffer strBuf)
public static final byte decodeHex(char b1, char b2)
public static final java.lang.String convertFromFileName(java.lang.String fileName)
public static final java.lang.String convertToFileName(java.lang.String str)