eparcelDB
Class EParcelDBWrapper
java.lang.Object
eparcelDB.EParcelDBWrapper
public class EParcelDBWrapper
- extends java.lang.Object
|
Method Summary |
long |
addChild(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String elementName,
java.lang.String newValue)
|
void |
addContainer(java.lang.String environmentHome,
java.lang.String containerName)
|
void |
addDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String xmlDoc)
|
boolean |
addHistoryNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String sentbytes)
|
long |
addSibling(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String elementName,
java.lang.String newValue)
|
boolean |
dataRangeExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
boolean |
dataRangeExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
|
int |
deleteDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
int |
deleteDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
|
int |
deleteDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String key)
|
int |
deleteEStub(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
int |
deleteEStubRef(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
boolean |
eStubExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
boolean |
eStubRefExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
protected void |
finalize()
|
java.lang.String |
getData(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
|
java.lang.String |
getDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
java.lang.String |
getDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
|
java.lang.String |
getEStub(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
java.lang.String |
getEStubRef(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
java.lang.String |
getLength(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
java.lang.String |
getOffset(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
|
java.lang.String |
getState(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String recipient)
|
java.lang.String[] |
query(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query)
|
void |
removeContainer(java.lang.String environmentHome,
java.lang.String containerName)
|
long |
removeNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query)
|
boolean |
setState(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String recipient,
java.lang.String state)
|
long |
updateDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String newDocument)
|
long |
updateNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String newValue)
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EParcelDBWrapper
public EParcelDBWrapper()
addContainer
public void addContainer(java.lang.String environmentHome,
java.lang.String containerName)
throws java.lang.Exception
- This will handle the creation and/or addition of a container to the EParcelDBWrapper instance.
- Parameters:
environmentHome - A path to an existing directory to create an environment in if one does not already exist there.containerName - The name of the container to create and/or add to the EParcelDBWrapper instance.
- Throws:
java.lang.Exception - This method can fail with a FileNotFoundException, XmlException, or DatabaseException.
removeContainer
public void removeContainer(java.lang.String environmentHome,
java.lang.String containerName)
throws java.lang.Exception
- This will close and remove a container, cleaning up after it. If this was the last container in an environment, the environment will also be removed as well as the XmlManager for it. The container to be removed must exist or an exception will be thrown.
- Parameters:
environmentHome - The name of the environment this container is in.
containerName - The name of the container to be removed.
- Throws:
java.lang.Exception - This may be an XmlException.
addDocument
public void addDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String xmlDoc)
throws java.lang.Exception
- This will add an XML document to the specified container.
- Parameters:
environmentHome - The location of the environment that the container resides in.
containerName - The name of the container into which the XML document will be inserted.xmlDoc - The string representation of the XML document to be inserted into the database.
- Throws:
java.lang.Exception - This can return XmlException and DataBaseException.
query
public java.lang.String[] query(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query)
throws java.lang.Exception
- This will return the results of a query on a particular container.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The string representation of an XPath query.
- Returns:
- An array of Strings containing the results of the query.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
eStubExists
public boolean eStubExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return whether or not an eStub exists in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the eStub.
- Returns:
- Returns true if the indicated eStub exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getEStub
public java.lang.String getEStub(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return the first E-Stub in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the eStub.
- Returns:
- Returns the first E-Stub found with the given sender and etag or NULL if no such E-Stub exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
eStubRefExists
public boolean eStubRefExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return whether or not an eStubRef exists in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the eStubRef.
- Returns:
- Returns true if the indicated eStubRef exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
dataRangeExists
public boolean dataRangeExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return whether or not a DataRange exists in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.
- Returns:
- Returns true if the indicated DataRange exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
dataRangeExists
public boolean dataRangeExists(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
throws java.lang.Exception
- This will return whether or not a DataRange exists in the indicated container with the indicated sender, etag, and offset.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.offset - The number of bytes from the beginning of the file where the data in this DataRange starts.
- Returns:
- Returns true if the indicated DataRange exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getEStubRef
public java.lang.String getEStubRef(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return the first E-StubRef in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the eStubRef.
- Returns:
- Returns the first E-StubRef found with the given sender and etag or NULL if no such E-StubRef exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getDataRange
public java.lang.String getDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return the first DataRange in the indicated container with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.
- Returns:
- Returns the first DataRange found with the given sender and etag or NULL if no such DataRange exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getDataRange
public java.lang.String getDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
throws java.lang.Exception
- This will return the first DataRange in the indicated container with the indicated sender, etag, and offset.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.offset - The hex representation of the number of bytes offset from the beginning of the file the data in this object represents.
- Returns:
- Returns the first DataRange found with the given sender, etag, and offset or NULL if no such DataRange exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getState
public java.lang.String getState(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String recipient)
throws java.lang.Exception
- This will return the state associated with the indicated recipient in the E-Stub indicated by the given sender and e-tag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the E-Stub.recipient - The mailbox of the recipient.
- Returns:
- Returns the state associated with the indicated recipient in the E-Stub indicated by the sender and etag or NULL if no such recipient or e-stub exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getOffset
public java.lang.String getOffset(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return the offset in the first DataRange document with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.
- Returns:
- Returns the offset in the DataRange indicated by the sender and etag or NULL if no such DataRange exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getLength
public java.lang.String getLength(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will return the length in the first DataRange document with the indicated sender and etag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.
- Returns:
- Returns the length in the DataRange indicated by the sender and etag or NULL if no such DataRange exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
getData
public java.lang.String getData(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
throws java.lang.Exception
- This will return the data in the first DataRange document with the indicated sender, etag, and offset.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.offset - The offset associated with the DataRange.
- Returns:
- Returns the data in the DataRange indicated by the sender and etag or NULL if no such DataRange exists in the specified container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
deleteEStub
public int deleteEStub(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will delete the E-Stubs with a given sender and e-tag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the EStub.
- Returns:
- The number of deleted E-Stubs.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
deleteEStubRef
public int deleteEStubRef(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will delete the E-StubRefs with a given sender and e-tag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the EStubRef.
- Returns:
- The number of deleted E-StubRefs.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
deleteDataRange
public int deleteDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag)
throws java.lang.Exception
- This will delete the DataRanges with a given sender and e-tag.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.
- Returns:
- The number of deleted DataRanges.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
deleteDataRange
public int deleteDataRange(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String offset)
throws java.lang.Exception
- This will delete the DataRanges with a given sender, e-tag, and offset.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag associated with the DataRange.offset - The number of bytes from the beginning of the file that this data represents.
- Returns:
- The number of deleted DataRanges.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
deleteDocument
public int deleteDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String key)
throws java.lang.Exception
- This will delete the documents with an attribute in the root element called key that a value equal to the key value passed in.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.key - The key value to trigger deletion.
- Returns:
- The number of deleted Documents.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
setState
public boolean setState(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String recipient,
java.lang.String state)
throws java.lang.Exception
- This will change the state in the to containing the indicated recipient in the E-Stub with the indicated sender and etag to the indicated state.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag of the desired E-Stub.recipient - The recipient associated with the changing state.state - The new state. This should be one of the accepted states prior to calling this function. This function will not attempt to validate this in any way.
- Returns:
- This function will return true if the state was set successfully and false if no such E-Stub exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
addHistoryNode
public boolean addHistoryNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String sender,
java.lang.String etag,
java.lang.String sentbytes)
throws java.lang.Exception
- This will add a history node in the E-Stub with the indicated sender and etag with the indicated number of sentbytes.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.sender - The mailbox of the sender.etag - The etag of the desired E-Stub.sentbytes - The number of bytes sent.
- Returns:
- This function will return true if the history node was added successfully and false if no such E-Stub exists in the indicated container.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
addSibling
public long addSibling(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String elementName,
java.lang.String newValue)
throws java.lang.Exception
- This will add the indicated node with name elementName and value newValue to every node returned by the XPath query.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The XPath query to return nodes.elementName - The name of the new sibling node(s) to be added.newValue - The value of the text to be part of the added node.
- Returns:
- This will return the number of new nodes added.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
addChild
public long addChild(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String elementName,
java.lang.String newValue)
throws java.lang.Exception
- This will add the indicated node with name elementName and value newValue as a child to every node returned by the XPath query.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The XPath query to return nodes.elementName - The name of the new child node(s) to be added.newValue - The value of the text to be part of the added node.
- Returns:
- This will return the number of new nodes added.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
updateNode
public long updateNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String newValue)
throws java.lang.Exception
- This will change the text to newValue for every node returned by the XPath query.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The XPath query to return nodes.newValue - The value of the new text.
- Returns:
- This will return the number of nodes changed.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
removeNode
public long removeNode(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query)
throws java.lang.Exception
- This will remove every node returned by the XPath query.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The XPath query to return nodes.
- Returns:
- This will return the number of nodes removed.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
updateDocument
public long updateDocument(java.lang.String environmentHome,
java.lang.String containerName,
java.lang.String query,
java.lang.String newDocument)
throws java.lang.Exception
- This will replace every document returned by the XPath query with the new document.
- Parameters:
environmentHome - The location of the directory containing the container.
containerName - The name of the container.query - The XPath query to return nodes.newDocument - The new value of the document.
- Returns:
- This will return the number of nodes changed.
- Throws:
java.lang.Exception - This can throw XmlExceptions.
finalize
protected void finalize()
- Overrides:
finalize in class java.lang.Object