|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface XNodeStore
Defines a database manager API for XNode content.
The XNode API (the package org.purl.xnode.*, both its source code and documentation), are released under the Apache 2.0 License. For more details, check the LICENSE file contained with the distribution, or see The Ceryle Project for more information. It is distributed with no warranty.
| Field Summary | |
|---|---|
static String |
ALL_COLLECTIONS
A String indicator used to refer to all maintained collections. |
static String |
DATABASE_ROOT
The System property name for the XNode database root URI. |
static String |
FEATURE_COPY_MOVE
A property indicating support for copy and move operations. |
static String |
XNODE_DEFAULT_ROOT
The default value of the URL for the root collection. |
static String |
XNODE_PROTOCOL
The protocol name for XNode. |
| Method Summary | |
|---|---|
XNode |
addXNode(String cid,
String nid,
Node node)
Add a new XNode with ID nid, whose content is the DOM Node node, to the XNodeCollection with ID cid. |
XNode |
addXNode(String cid,
String nid,
String content)
Insert a new XNode with ID nid whose content is the String content, into the XNodeCollection with ID cid, returning the ID value of the added XNode. |
void |
addXNodeStoreListener(XNodeStoreListener listener)
Adds listener as a listener for changes to the XNodeStore. |
boolean |
closeCollection(String cid)
Close an existing XNodeCollection cid. |
void |
connect(String root,
String driver,
int timeout)
Make a database connection to the XNodeCollection root and establish service, using timeout as the maximum number of seconds to wait for the collection manager to open before abandoning. |
void |
copyXNode(String scid,
String snid,
String dcid,
String dnid,
boolean move,
boolean overwrite)
Copy the XNode with ID snid from Collection scid to XNode nid in the Collection ID cid. |
void |
copyXNode(XNodeID xids,
XNodeID xidd,
boolean move,
boolean overwrite)
Copy the XNode with XNodeID xids to XNodeID xidd. |
XNodeCollection |
createCollection(String cid,
boolean overwrite)
Create an new XNodeCollection identified by the ID cid. |
XNode |
createRevision(String cid,
String nid)
Creates a revision of the specified XNode, storing it internal to the XNode. |
XNode |
createRevision(XNode xnode)
Creates a revision of the provided XNode, storing it internal to the XNode. |
XNode |
createRevision(XNodeID xid)
Creates a revision of the specified XNode, storing it internal to the XNode. |
XNode |
createXNode(String nid,
Node node)
Returns an XNode provided a DOM Node node. |
void |
deleteCollection(String cid)
Delete an existing XNodeCollection cid. |
void |
deleteXNode(String cid,
String nid)
Delete the XNode identified by ID nid from the XNodeCollection cid. |
void |
deleteXNode(XNodeID xid)
Delete the XNode identified by the XNodeID xid. |
void |
disconnect()
Disconnect any connection to the root XNodeCollection and close down all services. |
XNodeCollection |
getCollection(String cid)
Return an existing XNodeCollection whose ID is cid, null if it does not exist. |
List |
getCollectionIndex()
Return a List containing the IDs of all available XNodeCollections. |
String |
getCollectionMetadata(String cid,
String name)
Return the value of the XNodeCollection metadata property name for the XNodeCollection whose ID is cid, null if it has not been set. |
String |
getDatabaseURI(String cid,
String nid)
Returns a URI representing the Collection ID cid and Node ID id using the currently available database base URI. |
List |
getIndex(String cid)
Return a List containing the XNode IDs (as Strings) within the XNodeCollection cid. |
XNodeRevisionManager |
getRevisionManager()
Returns the XNodeRevisionManager for this XNodeStore, null if revision control is not active or supported. |
XNodeCollection |
getRootCollection()
Returns the root database XNodeCollection. |
String |
getRootURI()
Return the URI of the root XNodeCollection as a String. |
XNodeState |
getState()
Return the state of this XNodeStore, as according to the processing states enumerated in XNodeState. |
XNode |
getXNode(String cid,
String nid)
Retrieves an XNode with ID nid from XNodeCollection with ID cid, or null if unable to retrieve. |
XNode |
getXNode(XNodeID xid)
Retrieves an XNode specified via the XNodeID xid, or null if unable to retrieve. |
XNodeCollectionFactory |
getXNodeCollectionFactory()
Returns a lazily-instantiated XNodeCollectionFactory. |
Node |
getXNodeContent(XNode xnode)
Returns the DOM Node node envelope provided an XNode. |
XNodeFactory |
getXNodeFactory()
Returns the XNodeFactory associated with this XNodeStore. |
boolean |
hasCollection(String cid)
Returns true if the XNodeCollection whose ID is cid exists. |
boolean |
hasXNode(String cid,
String nid)
Returns true if an XNode with ID nid exists in the XNodeCollection with ID cid. |
boolean |
hasXNode(XNodeID xid)
Returns true if an XNode matching the XNodeID xid exists, false if not. |
boolean |
isConnected()
Returns true if a connection with database has been made and its service is available. |
boolean |
isRevisionControlActive()
Returns true if revision control features are active. |
XNode |
modifyXNode(String cid,
String nid,
Node node)
Modify an XNode with ID nid, whose content is the DOM Node node, in the XNodeCollection with ID cid. |
XNode |
modifyXNode(String cid,
String nid,
String content)
Modify an XNode with ID nid in XNodeCollection cid, replacing its contents with the contents of the String content. |
XNode |
modifyXNode(XNodeID xid,
Node node)
Modify an XNode with XNodeID xid, replacing its content with the DOM Node node, returning the modified XNode. |
void |
removeXNodeStoreListener(XNodeStoreListener listener)
Removes listener from the XNodeStore. |
void |
setCollectionMetadata(String cid,
String name,
String value)
Set a metadata property of XNodeCollection metadata (a name-value pair) for the XNodeCollection whose ID is cid. |
void |
setXNodeProperties(XNode xnode,
Map properties)
For an XNode with ID nid in XNodeCollection cid, set the named properties provided by the key-value pairs found in the Map properties. |
void |
setXNodeProperty(XNode xnode,
String name,
String value)
For an XNode with ID nid in XNodeCollection cid, set the named property name whose value is the String value. |
void |
start()
Start the database service. |
void |
stop()
Stop the database service. |
String |
toURI(XNodeID xid)
Returns a URI representation of the XNodeID xid based on the root database URI, eg., ""xnode://db/cid/nid". |
XNode |
writeXNode(String cid,
XNode xnode)
Write the XNode xnode to the XNodeCollection cid. |
| Field Detail |
|---|
static final String DATABASE_ROOT
static final String XNODE_PROTOCOL
static final String XNODE_DEFAULT_ROOT
static final String ALL_COLLECTIONS
static final String FEATURE_COPY_MOVE
copyXNode(String,String,String,String,boolean,boolean) and
copyXNode(XNodeID,XNodeID,boolean,boolean) methods.
| Method Detail |
|---|
XNodeFactory getXNodeFactory()
XNodeCollectionFactory getXNodeCollectionFactory()
XNodeCollection getRootCollection()
throws XNodeException
XNodeExceptionXNodeState getState()
XNodeState
void start()
throws XNodeException
XNodeException - if an error occurs during starting the database.
void stop()
throws XNodeException
XNodeException - if an error occurs during shutdown.
void connect(String root,
String driver,
int timeout)
throws XNodeException
Note that implementations that are not client-server will not implement this method.
root - the URI of the root XNodeCollection.driver - the driver identifier for the database providertimeout - time in seconds to wait before abandoning.
XNodeException - if unable to make the connection.
void disconnect()
throws XNodeException
Note that implementations that are not client-server will not implement this method.
XNodeException - if an error occurs during this process.boolean isConnected()
boolean isRevisionControlActive()
XNodeCollection createCollection(String cid,
boolean overwrite)
throws XNodeException
cid - the XNodeCollection ID String.overwrite - if true, will overwrite any existing XNodeCollection.
XNodeException - if unable to create the XNodeCollection
XNodeCollection getCollection(String cid)
throws XNodeException
cid - the XNodeCollection ID String.
XNodeException - if unable to locate the XNodeCollectionboolean hasCollection(String cid)
cid - the XNodeCollection ID String.
List getCollectionIndex()
throws XNodeException
XNodeException - if unable to provide the List.
List getIndex(String cid)
throws XNodeException
cid - the XNodeCollection ID String.
XNodeException - if the ID is invalid or the XNodeCollection(s) did not exist.
boolean closeCollection(String cid)
throws XNodeException
ALL_COLLECTIONS, will close all open XNodeCollection.
cid - the XNodeCollection ID String.
XNodeException - if the ID is invalid or the XNodeCollection(s) did not exist.
void deleteCollection(String cid)
throws XNodeException
ALL_COLLECTIONS, will delete all existing XNodeCollection.
cid - the XNodeCollection ID String.
XNodeException - if the XNodeCollection ID is invalid, the XNodeCollection(s)
did not exist, or an error occurred.
void setCollectionMetadata(String cid,
String name,
String value)
throws XNodeException
XNodeException
String getCollectionMetadata(String cid,
String name)
throws XNodeException
XNodeExceptionboolean hasXNode(XNodeID xid)
xid - the XNodeID.
boolean hasXNode(String cid,
String nid)
throws XNodeException
cid - the XNodeCollection ID String.nid - the ID String for the stored XNode.
XNodeException - if either ID is invalid.
XNode getXNode(XNodeID xid)
throws XNodeException
xid - the XNodeID.
XNodeException - if an error occurs retrieving the XNodeCollection or XNode.
XNode getXNode(String cid,
String nid)
throws XNodeException
cid - the XNodeCollection ID String.nid - the XNode ID String.
XNodeException - if the XNodeCollection does not exist or either ID is invalid.
XNode createXNode(String nid,
Node node)
throws XNodeException
nid - the ID String of the stored XNode.node - the DOM Node to be used as the XNode source.
XNodeException - if unable to create the XNode.
XNode addXNode(String cid,
String nid,
String content)
throws XNodeException
This method implies that the supplied content String be well-formed XML, as it will by necessity be parsed into a DOM Node. If not well-formed XML, an exception is thrown and nothing is stored.
cid - the XNodeCollection ID String.nid - the ID String of the stored XNode.content - the String content to be parsed into a DOM Node.
XNodeException - if unable to add the XNode.
XNode addXNode(String cid,
String nid,
Node node)
throws XNodeException
cid - the XNodeCollection ID String.nid - the ID String for the stored XNode.node - the DOM Node content.
XNodeException - if unable to add the XNode.
XNode modifyXNode(String cid,
String nid,
String content)
throws XNodeException
cid - the XNodeCollection ID String.nid - the ID String of the stored XNode.content - the String content to be parsed into a DOM Node.
XNodeException - if unable to modify the XNode.
XNode modifyXNode(String cid,
String nid,
Node node)
throws XNodeException
cid - the XNodeCollection ID String.nid - the ID String for the stored XNode.node - the DOM Node content.
XNodeException - if unable to modify the XNode.
XNode modifyXNode(XNodeID xid,
Node node)
throws XNodeException
xid - the XNode identifier.node - the new DOM Node content.
XNodeException - if unable to add the XNode to the XNodeCollection.
XNode writeXNode(String cid,
XNode xnode)
throws XNodeException
This method is generally used to set metadata on an existing XNode, so document-level metadata (e.g., creation or modification timestamps) are not altered by this method — this just writes the XNode to the XNodeCollection.
cid - the XNodeCollection ID String.xnode - the XNode to be written.
XNodeException - if unable to write the XNode to the XNodeCollection.
void deleteXNode(String cid,
String nid)
throws XNodeException
cid - the XNodeCollection ID String.nid - the XNode ID String.
XNodeException - if unable to delete the XNode.
void deleteXNode(XNodeID xid)
throws XNodeException
xid - the XNodeID identifier for the XNode.
XNodeException - if the XNode does not exist or otherwise unable to delete.
Node getXNodeContent(XNode xnode)
throws XNodeException
xnode - the XNode to be processed
XNodeException - if an error occurs during recreation.
void setXNodeProperty(XNode xnode,
String name,
String value)
throws XNodeException
This only modifies the property of the supplied XNode and does not involve any transactions with the database, which must be performed separately.
xnode - the XNode to which the property is set.name - the name of the property.value - the value of the property.
XNodeException - if the XNode does not exist or the property is invalid.
void setXNodeProperties(XNode xnode,
Map properties)
throws XNodeException
This only modifies the properties of the supplied XNode and does not involve any transactions with the database, which must be performed separately.
xnode - the XNode to which the properties are to be set.properties - the Map containing the properties.
XNodeException - if the XNode does not exist or any of the properties are invalid.String getRootURI()
String getDatabaseURI(String cid,
String nid)
cid - the collection ID.nid - the node ID.
String toURI(XNodeID xid)
xid - the XNodeID to convert to a URI.
void copyXNode(String scid,
String snid,
String dcid,
String dnid,
boolean move,
boolean overwrite)
throws XNodeException
copyXNode(XNodeID,XNodeID,boolean,boolean).
scid - the source Collection ID.snid - the source XNode ID.dcid - the destination Collection ID.dnid - the destination XNode ID.move - when true, deletes the source XNodeoverwrite - when true, will overwrite any existing dcid/dnid
XNodeException - if the copy/move is not successful.
void copyXNode(XNodeID xids,
XNodeID xidd,
boolean move,
boolean overwrite)
throws XNodeException
This is an optional operation. If supported, the System property
"http://purl.org/xnode/1.2/feature/copy-move" (see FEATURE_COPY_MOVE)
of supporting implementations will return a value of "true". If
not supported, will throw an UnsupportedOperationException.
xids - the source XNodeID.xidd - the destination XNodeID.move - when true, deletes the source XNodeoverwrite - when true, will overwrite any existing dcid/dnid
XNodeException - if the copy/move is not successful.
void addXNodeStoreListener(XNodeStoreListener listener)
throws UnsupportedOperationException
XNodeStoreListener extends
ChangeListener as a listener for
changes to the XNodeStore, e.g., connecting or disconnecting
from the database. In contexts where listeners are inappropriate,
implementations should throw an
UnsupportedOperationException upon an attempt
to add a listener.
listener - the XNodeStoreListener to be added
UnsupportedOperationException - if listener support is unavailableXNodeStoreListenervoid removeXNodeStoreListener(XNodeStoreListener listener)
addXNodeStoreListener(XNodeStoreListener)
for details.
listener - the XNodeStoreListener to be removed
UnsupportedOperationException - if listener support is unavailableXNodeStoreListenerXNodeRevisionManager getRevisionManager()
XNode createRevision(String cid,
String nid)
throws XNodeException
cid - the XNodeCollection ID String.nid - the XNode ID String.
XNodeException - if an error occurs in creating the revision.
XNode createRevision(XNodeID xid)
throws XNodeException
xid - the XNodeID specifying the XNode.
XNodeException - if an error occurs in creating the revision.
XNode createRevision(XNode xnode)
throws XNodeException
xnode - the XNode to be processed.
XNodeException - if an error occurs in creating the revision.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||