KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > common > tree > Session


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.common.tree;
10
11 import org.jboss.portal.common.FQN;
12
13 import java.util.Map JavaDoc;
14
15 /**
16  * The tree session is used to group modifications made to the tree.
17  *
18  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
19  * @version $Revision: 1.1 $
20  */

21 public interface Session
22 {
23
24    /**
25     * Returns the manager this session belongs to.
26     */

27    Tree getTree();
28
29    /**
30     * Rollback all changes made to the tree.
31     *
32     * @throws IllegalStateException if the session is already terminated
33     */

34    void rollback() throws IllegalStateException JavaDoc;
35
36    /**
37     * Make all the change to the tree permanent.
38     *
39     * @throws TreeException signals the operation failed
40     * @throws IllegalStateException if the session is already terminated
41     */

42    void commit() throws TreeException, IllegalStateException JavaDoc;
43
44    /**
45     * Set a property on the node.
46     *
47     * @param node the target node
48     * @param key the property key
49     * @param value the new property value
50     * @throws TreeException signals the operation failed
51     * @throws IllegalArgumentException if one of the argument is null
52     * @throws IllegalStateException if the session is already terminated
53     */

54    void setProperty(Node node, String JavaDoc key, Object JavaDoc value) throws TreeException, IllegalArgumentException JavaDoc, IllegalStateException JavaDoc;
55
56    /**
57     * Remove a property on the node.
58     *
59     * @param node the target node
60     * @param key the property key
61     * @throws TreeException signals the operation failed
62     * @throws IllegalArgumentException if one of the argument is null
63     * @throws IllegalStateException if the session is already terminated
64     */

65    void removeProperty(Node node, String JavaDoc key) throws TreeException, IllegalArgumentException JavaDoc, IllegalStateException JavaDoc;
66
67    /**
68     * Add a child to the current node.
69     *
70     * @param parent the node that will be the parent of the newly created node
71     * @param key the node name for the parent
72     * @param properties the initial properties contained in this node
73     * @return the newly created node
74     * @throws TreeException signals the operation failed
75     * @throws IllegalArgumentException if one of the argument is null
76     * @throws IllegalStateException if the session is already terminated
77     */

78    Node addChild(Node parent, String JavaDoc key, Map JavaDoc properties) throws TreeException, IllegalArgumentException JavaDoc, IllegalStateException JavaDoc;
79
80    /**
81     * Removes a child from a parent node.
82     *
83     * @param parent the parent node
84     * @param key the child key
85     * @throws TreeException signals the operation failed
86     * @throws IllegalArgumentException if one of the argument is null
87     * @throws IllegalStateException if the session is already terminated
88     */

89    void removeChild(Node parent, String JavaDoc key) throws TreeException, IllegalArgumentException JavaDoc, IllegalStateException JavaDoc;
90
91    /**
92     * Create a node and all its ancestors if they dont previously exist.
93     *
94     * @param fqn
95     * @return
96     * @throws TreeException signals the operation failed
97     * @throws IllegalArgumentException if one of the argument is null
98     * @throws IllegalStateException if the session is already terminated
99     */

100    Node createNode(FQN fqn, Map JavaDoc properties) throws TreeException, IllegalArgumentException JavaDoc, IllegalStateException JavaDoc;
101
102    /**
103     * Remove a node and all its children recursively.
104     *
105     * @param fqn the name of the node to remove
106     * @throws TreeException signals the operation failed
107     * @throws IllegalArgumentException if one of the argument is null
108     * @throws IllegalStateException if the session is already terminated
109     */

110    // void removeNode(FQN fqn) throws TreeException, IllegalArgumentException, IllegalStateException;
111
}
112
Popular Tags