org.jboss.portal.common.tree
Interface Session

All Known Implementing Classes:
SessionImpl

public interface Session

The tree session is used to group modifications made to the tree.


Method Summary
 Node addChild(Node parent, java.lang.String key, java.util.Map properties)
          Add a child to the current node.
 void commit()
          Make all the change to the tree permanent.
 Node createNode(FQN fqn, java.util.Map properties)
          Create a node and all its ancestors if they dont previously exist.
 Tree getTree()
          Returns the manager this session belongs to.
 void removeChild(Node parent, java.lang.String key)
          Removes a child from a parent node.
 void removeProperty(Node node, java.lang.String key)
          Remove a property on the node.
 void rollback()
          Rollback all changes made to the tree.
 void setProperty(Node node, java.lang.String key, java.lang.Object value)
          Set a property on the node.
 

Method Detail

getTree

Tree getTree()
Returns the manager this session belongs to.


rollback

void rollback()
              throws java.lang.IllegalStateException
Rollback all changes made to the tree.

Throws:
java.lang.IllegalStateException - if the session is already terminated

commit

void commit()
            throws TreeException,
                   java.lang.IllegalStateException
Make all the change to the tree permanent.

Throws:
TreeException - signals the operation failed
java.lang.IllegalStateException - if the session is already terminated

setProperty

void setProperty(Node node,
                 java.lang.String key,
                 java.lang.Object value)
                 throws TreeException,
                        java.lang.IllegalArgumentException,
                        java.lang.IllegalStateException
Set a property on the node.

Parameters:
node - the target node
key - the property key
value - the new property value
Throws:
TreeException - signals the operation failed
java.lang.IllegalArgumentException - if one of the argument is null
java.lang.IllegalStateException - if the session is already terminated

removeProperty

void removeProperty(Node node,
                    java.lang.String key)
                    throws TreeException,
                           java.lang.IllegalArgumentException,
                           java.lang.IllegalStateException
Remove a property on the node.

Parameters:
node - the target node
key - the property key
Throws:
TreeException - signals the operation failed
java.lang.IllegalArgumentException - if one of the argument is null
java.lang.IllegalStateException - if the session is already terminated

addChild

Node addChild(Node parent,
              java.lang.String key,
              java.util.Map properties)
              throws TreeException,
                     java.lang.IllegalArgumentException,
                     java.lang.IllegalStateException
Add a child to the current node.

Parameters:
parent - the node that will be the parent of the newly created node
key - the node name for the parent
properties - the initial properties contained in this node
Returns:
the newly created node
Throws:
TreeException - signals the operation failed
java.lang.IllegalArgumentException - if one of the argument is null
java.lang.IllegalStateException - if the session is already terminated

removeChild

void removeChild(Node parent,
                 java.lang.String key)
                 throws TreeException,
                        java.lang.IllegalArgumentException,
                        java.lang.IllegalStateException
Removes a child from a parent node.

Parameters:
parent - the parent node
key - the child key
Throws:
TreeException - signals the operation failed
java.lang.IllegalArgumentException - if one of the argument is null
java.lang.IllegalStateException - if the session is already terminated

createNode

Node createNode(FQN fqn,
                java.util.Map properties)
                throws TreeException,
                       java.lang.IllegalArgumentException,
                       java.lang.IllegalStateException
Create a node and all its ancestors if they dont previously exist.

Parameters:
fqn -
Returns:
Throws:
TreeException - signals the operation failed
java.lang.IllegalArgumentException - if one of the argument is null
java.lang.IllegalStateException - if the session is already terminated