KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > optimistic > TransactionWorkspace


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.optimistic;
8
9 import org.jboss.cache.Fqn;
10
11 import java.util.Map JavaDoc;
12 import java.util.SortedMap JavaDoc;
13
14 /**
15  * Used to contain a copy of the tree being worked on within the scope of a given transaction. Maintains {@see WorkspaceNode}s rather than conventional
16  * {@see DataNode}s. Also see {@see OptimisticTransactionEntry}, which creates and maintains an instance of TransactionWorkspace for each
17  * transaction running.
18  *
19  * @author Manik Surtani (<a HREF="mailto:manik@jboss.org">manik@jboss.org</a>)
20  * @author Steve Woodcock (<a HREF="mailto:stevew@jofti.com">stevew@jofti.com</a>)
21  */

22
23 public interface TransactionWorkspace
24 {
25    /**
26     * @return Returns a map of {@link WorkspaceNode}s, keyed on {@link Fqn}
27     */

28    public Map JavaDoc<Fqn, WorkspaceNode> getNodes();
29
30    /**
31     * @param nodes The nodes to set. Takes {@link WorkspaceNode}s.
32     */

33    public void setNodes(Map JavaDoc<Fqn, WorkspaceNode> nodes);
34
35    public WorkspaceNode getNode(Fqn fqn);
36
37    /**
38     * Is thread safe so you dont need to deal with synchronising access to this method.
39     *
40     * @param node
41     */

42    public void addNode(WorkspaceNode node);
43
44    /**
45     * Is thread safe so you dont need to deal with synchronising access to this method.
46     */

47    public Object JavaDoc removeNode(Fqn fqn);
48
49    /**
50     * Returns all nodes equal to or after the given node.
51     */

52    public SortedMap JavaDoc<Fqn, WorkspaceNode> getNodesAfter(Fqn fqn);
53
54    /**
55     * Tests if versioning is implicit for a given tx.
56     * If set to true, the interceptor chain will handle versioning (implicit to JBossCache).
57     * If set to false, DataVersions will have to come from the caller.
58     */

59    public boolean isVersioningImplicit();
60
61    /**
62     * Sets if versioning is implicit for a given tx.
63     * If set to true, the interceptor chain will handle versioning (implicit to JBossCache).
64     * If set to false, DataVersions will have to come from the caller.
65     */

66    public void setVersioningImplicit(boolean versioningImplicit);
67
68    /**
69     * returns true if the workspace contains a node with specified Fqn
70     */

71    boolean hasNode(Fqn fqn);
72 }
73
Popular Tags