|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TransactionWorkspace.java | - | - | - | - |
|
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; | |
12 | import java.util.SortedMap; | |
13 | ||
14 | /** | |
15 | * Used to contain a copy of the tree being worked on within the scope of a given transaction. | |
16 | * Maintains {@link WorkspaceNode}s rather than conventional | |
17 | * <p/> | |
18 | * Also see {@link org.jboss.cache.transaction.OptimisticTransactionEntry}, which creates and maintains | |
19 | * an instance of TransactionWorkspace for each | |
20 | * transaction running. | |
21 | * | |
22 | * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik@jboss.org</a>) | |
23 | * @author Steve Woodcock (<a href="mailto:stevew@jofti.com">stevew@jofti.com</a>) | |
24 | */ | |
25 | ||
26 | public interface TransactionWorkspace<K, V> | |
27 | { | |
28 | /** | |
29 | * @return Returns a map of {@link WorkspaceNode}s, keyed on {@link Fqn} | |
30 | */ | |
31 | public Map<Fqn, WorkspaceNode<K, V>> getNodes(); | |
32 | ||
33 | /** | |
34 | * @param nodes The nodes to set. Takes {@link WorkspaceNode}s. | |
35 | */ | |
36 | public void setNodes(Map<Fqn, WorkspaceNode<K, V>> nodes); | |
37 | ||
38 | public WorkspaceNode<K, V> getNode(Fqn fqn); | |
39 | ||
40 | /** | |
41 | * Is thread safe so you dont need to deal with synchronising access to this method. | |
42 | * | |
43 | * @param node | |
44 | */ | |
45 | public void addNode(WorkspaceNode<K, V> node); | |
46 | ||
47 | /** | |
48 | * Is thread safe so you dont need to deal with synchronising access to this method. | |
49 | */ | |
50 | public WorkspaceNode<K, V> removeNode(Fqn fqn); | |
51 | ||
52 | /** | |
53 | * Returns all nodes equal to or after the given node. | |
54 | */ | |
55 | public SortedMap<Fqn, WorkspaceNode<K, V>> getNodesAfter(Fqn fqn); | |
56 | ||
57 | /** | |
58 | * Tests if versioning is implicit for a given tx. | |
59 | * If set to true, the interceptor chain will handle versioning (implicit to JBossCache). | |
60 | * If set to false, DataVersions will have to come from the caller. | |
61 | */ | |
62 | public boolean isVersioningImplicit(); | |
63 | ||
64 | /** | |
65 | * Sets if versioning is implicit for a given tx. | |
66 | * If set to true, the interceptor chain will handle versioning (implicit to JBossCache). | |
67 | * If set to false, DataVersions will have to come from the caller. | |
68 | */ | |
69 | public void setVersioningImplicit(boolean versioningImplicit); | |
70 | ||
71 | /** | |
72 | * returns true if the workspace contains a node with specified Fqn | |
73 | */ | |
74 | boolean hasNode(Fqn fqn); | |
75 | ||
76 | /** | |
77 | * Empties the collection of nodes held by this workspace. | |
78 | */ | |
79 | void clearNodes(); | |
80 | } |
|