Top Description Fields Methods
org.osgi.service.dmt

public Interface DmtSession

Imports
java.util.Date

DmtSession provides concurrent access to the DMT. All DMT manipulation commands for management applications are available on the DmtSession interface. The session is associated with a root node which limits the subtree in which the operations can be executed within this session.

Most of the operations take a node URI as parameter, which can be either an absolute URI (starting with "./") or a URI relative to the root node of the session. The empty string as relative URI means the root URI the session was opened with. All segments of a URI must be within the segment length limit of the implementation, and the special characters '/' and '\' must be escaped (preceded by a '\').

See the Uri#encode(String) method for support on escaping invalid characters in a URI.

If the URI specified does not correspond to a legitimate node in the tree an exception is thrown. The only exception is the isNodeUri(String) method which returns false in case of an invalid URI.

Each method of DmtSession that accesses the tree in any way can throw DmtIllegalStateException if the session has been closed or invalidated (due to timeout, fatal exceptions, or unexpectedly unregistered plugins).

Author
$Id: 8a52c7344f465e2cf9fb68f24c5d46c865501f34 $

Field Summary

Modifier and TypeField and Description
public static final int
LOCK_TYPE_ATOMIC

LOCK_TYPE_ATOMIC is an exclusive lock with transactional functionality.

public static final int
LOCK_TYPE_EXCLUSIVE

LOCK_TYPE_EXCLUSIVE lock guarantees full access to the tree, but can not be shared with any other locks.

public static final int
LOCK_TYPE_SHARED

Sessions created with LOCK_TYPE_SHARED lock allows read-only access to the tree, but can be shared between multiple readers.

public static final int
STATE_CLOSED

The session is closed, DMT manipulation operations are not available, they throw DmtIllegalStateException if tried.

public static final int
STATE_INVALID

The session is invalid because a fatal error happened.

public static final int
STATE_OPEN

The session is open, all session operations are available.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Closes a session.

public void
commit()

Commits a series of DMT operations issued in the current atomic session since the last transaction boundary.

public void
copy(String
the node or root of a subtree to be copied
nodeUri
,
String
the URI of the new node or root of a subtree
newNodeUri
,
boolean
false if only a single node is copied, true if the whole subtree is copied
recursive
)

Create a copy of a node or a whole subtree.

public void
createInteriorNode(String
the URI of the node to create
nodeUri
)

Create an interior node.

public void
createInteriorNode(String
the URI of the node to create
nodeUri
,
String
the type URI of the interior node, can be null if no node type is defined
type
)

Create an interior node with a given type.

public void
createLeafNode(String
the URI of the node to create
nodeUri
)

Create a leaf node with default value and MIME type.

public void
createLeafNode(String
the URI of the node to create
nodeUri
,
DmtData
the value to be given to the new node, can be null
value
)

Create a leaf node with a given value and the default MIME type.

public void
createLeafNode(String
the URI of the node to create
nodeUri
,
DmtData
the value to be given to the new node, can be null
value
,
String
the MIME type to be given to the new node, can be null
mimeType
)

Create a leaf node with a given value and MIME type.

public void
deleteNode(String
the URI of the node
nodeUri
)

Delete the given node.

public void
execute(String
the node on which the execute operation is issued
nodeUri
,
String
the parameter of the execute operation, can be null
data
)

Executes a node.

public void
execute(String
the node on which the execute operation is issued
nodeUri
,
String
an identifier to associate this operation with any notifications sent in response to it, can be null if not needed
correlator
,
String
the parameter of the execute operation, can be null
data
)

Executes a node, also specifying a correlation ID for use in response notifications.

public String[]

Returns:

the list of child node names as a string array or an empty string array if the node has no children
getChildNodeNames
(String
the URI of the node
nodeUri
)

Get the list of children names of a node.

public Acl

Returns:

the Access Control List belonging to the node
getEffectiveNodeAcl
(String
the URI of the node
nodeUri
)

Gives the Access Control List in effect for a given node.

public int

Returns:

the lock type of the session, one of LOCK_TYPE_SHARED, LOCK_TYPE_EXCLUSIVE and LOCK_TYPE_ATOMIC
getLockType
()

Gives the type of lock the session has.

public MetaNode

Returns:

a MetaNode which describes meta data information, can be null if there is no meta data available for the given node
getMetaNode
(String
the URI of the node
nodeUri
)

Get the meta data which describes a given node.

public Acl

Returns:

the Access Control List belonging to the node or null if none defined
getNodeAcl
(String
the URI of the node
nodeUri
)

Get the Access Control List associated with a given node.

public int

Returns:

the size of the data in the node
getNodeSize
(String
the URI of the leaf node
nodeUri
)

Get the size of the data in a leaf node.

public Date

Returns:

the timestamp of the last modification
getNodeTimestamp
(String
the URI of the node
nodeUri
)

Get the timestamp when the node was created or last modified.

public String

Returns:

the title of the node, or null if the node has no title
getNodeTitle
(String
the URI of the node
nodeUri
)

Get the title of a node.

public String

Returns:

the type of the node, can be null
getNodeType
(String
the URI of the node
nodeUri
)

Get the type of a node.

public DmtData

Returns:

the data of the node, can not be null
getNodeValue
(String
the URI of the node to retrieve
nodeUri
)

Get the data contained in a leaf or interior node.

public int

Returns:

the version of the node
getNodeVersion
(String
the URI of the node
nodeUri
)

Get the version of a node.

public String

Returns:

the identifier of the remote server that initiated the session, or null for local sessions
getPrincipal
()

Gives the name of the principal on whose behalf the session was created.

public String

Returns:

the root URI
getRootUri
()

Get the root URI associated with this session.

public int

Returns:

the session identification number
getSessionId
()

The unique identifier of the session.

public int

Returns:

the state of the session, one of STATE_OPEN, STATE_CLOSED and STATE_INVALID
getState
()

Get the current state of this session.

public boolean

Returns:

true if the given node is a leaf node
isLeafNode
(String
the URI of the node
nodeUri
)

Tells whether a node is a leaf or an interior node of the DMT.

public boolean

Returns:

true if the given node exists in the DMT
isNodeUri
(String
the URI to check
nodeUri
)

Check whether the specified URI corresponds to a valid node in the DMT.

public void
renameNode(String
the URI of the node to rename
nodeUri
,
String
the new name property of the node
newName
)

Rename a node.

public void
rollback()

Rolls back a series of DMT operations issued in the current atomic session since the last transaction boundary.

public void
setDefaultNodeValue(String
the URI of the node
nodeUri
)

Set the value of a leaf or interior node to its default.

public void
setNodeAcl(String
the URI of the node
nodeUri
,
Acl
the Access Control List to be set on the node, can be null
acl
)

Set the Access Control List associated with a given node.

public void
setNodeTitle(String
the URI of the node
nodeUri
,
String
the title text of the node, can be null
title
)

Set the title property of a node.

public void
setNodeType(String
the URI of the node
nodeUri
,
String
the type of the node, can be null
type
)

Set the type of a node.

public void
setNodeValue(String
the URI of the node
nodeUri
,
DmtData
the data to be set, can be null
data
)

Set the value of a leaf or interior node.