public interface ReadableDataSession
Since the ReadWriteDataSession
and TransactionalDataSession
interfaces inherit from this interface, some of the method descriptions do
not apply for an instance that is only a ReadableDataSession
. For
example, the close()
method description also contains information
about its behavior when invoked as part of a transactional session.
The nodePath
parameters appearing in this interface always contain an
array of path segments identifying a node in the subtree of this plugin. This
parameter contains an absolute path, so the first segment is always
".". Special characters appear escaped in the segments.
Error handling
When a tree access command is called on the DmtAdmin service, it must perform
an extensive set of checks on the parameters and the authority of the caller
before delegating the call to a plugin. Therefore plugins can take certain
circumstances for granted: that the path is valid and is within the subtree
of the plugin and the session, the command can be applied to the given node
(e.g. the target of getChildNodeNames
is an interior node), etc. All
errors described by the error codes DmtException.INVALID_URI
,
DmtException.URI_TOO_LONG
, DmtException.PERMISSION_DENIED
,
DmtException.COMMAND_NOT_ALLOWED
and
DmtException.TRANSACTION_ERROR
are fully filtered out before control
reaches the plugin.
If the plugin provides meta-data for a node, the DmtAdmin service must also
check the constraints specified by it, as described in MetaNode
. If
the plugin does not provide meta-data, it must perform the necessary checks
for itself and use the DmtException.METADATA_MISMATCH
error code to
indicate such discrepancies.
The DmtAdmin does not check that the targeted node exists before calling the
plugin. It is the responsibility of the plugin to perform this check and to
throw a DmtException.NODE_NOT_FOUND
if needed. In this case the
DmtAdmin must pass through this exception to the caller of the corresponding
DmtSession method.
The plugin can use the remaining error codes as needed. If an error does not
fit into any other category, the DmtException.COMMAND_FAILED
code
should be used.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes a session.
|
java.lang.String[] |
getChildNodeNames(java.lang.String[] nodePath)
Get the list of children names of a node.
|
MetaNode |
getMetaNode(java.lang.String[] nodePath)
Get the meta data which describes a given node.
|
int |
getNodeSize(java.lang.String[] nodePath)
Get the size of the data in a leaf node.
|
java.util.Date |
getNodeTimestamp(java.lang.String[] nodePath)
Get the timestamp when the node was last modified.
|
java.lang.String |
getNodeTitle(java.lang.String[] nodePath)
Get the title of a node.
|
java.lang.String |
getNodeType(java.lang.String[] nodePath)
Get the type of a node.
|
DmtData |
getNodeValue(java.lang.String[] nodePath)
Get the data contained in a leaf or interior node.
|
int |
getNodeVersion(java.lang.String[] nodePath)
Get the version of a node.
|
boolean |
isLeafNode(java.lang.String[] nodePath)
Tells whether a node is a leaf or an interior node of the DMT.
|
boolean |
isNodeUri(java.lang.String[] nodePath)
Check whether the specified path corresponds to a valid node in the DMT.
|
void |
nodeChanged(java.lang.String[] nodePath)
Notifies the plugin that the given node has changed outside the scope of
the plugin, therefore the Version and Timestamp properties must be
updated (if supported).
|
void nodeChanged(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the node that has changedDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandvoid close() throws DmtException
This method should not perform any data manipulation, only cleanup
operations. In non-atomic read-write sessions the data manipulation
should be done instantly during each tree operation, while in atomic
sessions the DmtAdmin
always calls
TransactionalDataSession.commit()
automatically before the
session is actually closed.
DmtException
- with the error code COMMAND_FAILED
if the
plugin failed to close for any reasonjava.lang.String[] getChildNodeNames(java.lang.String[] nodePath) throws DmtException
null
entries, but these are
removed by the DmtAdmin before returning it to the client.nodePath
- the absolute path of the nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationMetaNode getMetaNode(java.lang.String[] nodePath) throws DmtException
Meta data support by plugins is an optional feature. It can be used, for
example, when a data plugin is implemented on top of a data store or
another API that has their own metadata, such as a relational database,
in order to avoid metadata duplication and inconsistency. The meta data
specific to the plugin returned by this method is complemented by meta
data from the DmtAdmin before returning it to the client. If there are
differences in the meta data elements known by the plugin and the
DmtAdmin
then the plugin specific elements take precedence.
Note, that a node does not have to exist for having meta-data associated
with it. This method may provide meta-data for any node that can possibly
exist in the tree (any node defined by the Management Object provided by
the plugin). For nodes that are not defined, a DmtException
may
be thrown with the NODE_NOT_FOUND
error code. To allow easier
implementation of plugins that do not provide meta-data, it is allowed to
return null
for any node, regardless of whether it is defined or
not.
nodePath
- the absolute path of the nodenull
if there is no meta data available for the given
nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodeUri
points to a node
that is not defined in the tree (see above)DATA_STORE_FAILURE
if an error occurred while accessing
the data storeCOMMAND_FAILED
if some unspecified
error is encountered while attempting to complete the command
java.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationint getNodeSize(java.lang.String[] nodePath) throws DmtException
DmtData.getSize()
method for the definition of node size for each
format.nodePath
- the absolute path of the leaf nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsFEATURE_NOT_SUPPORTED
if the Size property is not
supported by the pluginDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationDmtData.getSize()
java.util.Date getNodeTimestamp(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsFEATURE_NOT_SUPPORTED
if the Timestamp property is
not supported by the pluginDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationjava.lang.String getNodeTitle(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the nodenull
if the node has no titleDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsFEATURE_NOT_SUPPORTED
if the Title property is not
supported by the pluginDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationjava.lang.String getNodeType(java.lang.String[] nodePath) throws DmtException
null
type means that there is no DDF document
overriding the tree structure defined by the ancestors.nodePath
- the absolute path of the nodenull
DmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationboolean isNodeUri(java.lang.String[] nodePath)
nodePath
- the absolute path to checkboolean isLeafNode(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationDmtData getNodeValue(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the node to retrievenull
DmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsFEATURE_NOT_SUPPORTED
if the specified node is an
interior node and does not support Java object valuesDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationint getNodeVersion(java.lang.String[] nodePath) throws DmtException
nodePath
- the absolute path of the nodeDmtException
- with the following possible error codes:
NODE_NOT_FOUND
if nodePath
points to a
non-existing nodeMETADATA_MISMATCH
if the information could not be
retrieved because of meta-data restrictionsFEATURE_NOT_SUPPORTED
if the Version property is not
supported by the pluginDATA_STORE_FAILURE
if an error occurred while
accessing the data storeCOMMAND_FAILED
if some unspecified error is
encountered while attempting to complete the commandjava.lang.SecurityException
- if the caller does not have the necessary
permissions to execute the underlying management operationCopyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0