|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IRogGraphCollection
Represents a collection (forest) of object graphs.
An ROG graph collection manages a set of ROG root nodes. Each node uniquely
identifies an ROG instance and is identified by a graph id. The graph
collection supports the addition and removal of graph nodes (root as well
as non-root nodes) and retrieval of root nodes.
Node Addition
When an ROG node is added to a graph collection, the collection first
determines whether the node is a root ROG node or not. If it is, the node
is added to the root node set managed by the collection. Otherwise, the
node's parent is retrieved from the ODS store that contains the added node
the added node linked to its parent. It should be noted that objects linked
into their graph using the add facility offered by a graph collection first
needs to be added to an ODS store before being supplied to the collection
for addition.
Node Removal
When an ROG node is removed from a graph collection, the collection first
determines whether the node is a root ROG node or not. If it is, the node
is removed from the root node set managed by the collection. Otherwise,
the node is unlinked from its parent.
Node Retrieval
Only root nodes can be retrieved from a collection.
Users typically link/unlink ROG nodes to/from their graphs using the graph
collection addition/removal mechanism only on replicated (backup) endpoints.
On primary endpoints, the recommended use is to add/remove root nodes to/from
their graph collection but to directly link child objects into their graph
via setter/getter methods offered by the child's parent nodes (which, in
turn, use the facilities offered by container nodes to manage their children)
Method Summary | |
---|---|
void |
add(IRogNode node)
Add an ROG node into a graph collection. |
IRogRootNode |
get(int grid)
Get a root ROG node from the graph collection. |
IStoreBinding |
getInitialStore()
Get the store a graph collection was created with. |
IStoreBinding |
getStore()
Get a graph collection's store. |
void |
remove(IRogNode node)
Remove an ROG node from a graph collection. |
Method Detail |
---|
IStoreBinding getInitialStore()
A graph collection can be created attached to an initial store. Graphs added to the collection are automatically added to the collection's store. If the initial store is null, then the collection inherits the store of the first graph added to it. If the initial store is non-null, then each graph added to the collection must either not be associated with a store (in which case it is put in the collection's store) or associated with the same store as the collection.
IStoreBinding getStore()
Prior to the first graph added to a collection, this method will return
the same value as getInitialStore()
. Subsequent to the addition
of the first graph, the value returned by this method will be the
store resolved for the graph - the initial store if non-null or else
the first added graph's store.
Note: For instances of a graph collection without an initial
store but layered on stores such as StoreBinding
, the store
initialized dynamically from the first added graph would be the store
associated with the graph root which is not the StoreBinding
but rather the core binding that underlies it.
void add(IRogNode node)
node
- The node to add.
IllegalArgumentException
- Thrown in the following conditions:IRogContainerNode
IllegalStateException
- Thrown in the following conditions:This method adds a new ROG node to a graph collection. The method first checks if the supplied node is a root node. If so, the node is added to store bound to the collection the root node set managed by the graph collection. Otherwise, the method finds the node's parent from the ODS store bound to the node (the node needs to be in an ODS store before this method is invoked) and adds the node to the parent node as a child node.
Note: This method can only be used in scenarios where a collection is bound to a non-null store and the node being added is already in the same store bound to the collection at the time it is added to the collection.
IRogRootNode get(int grid)
grid
- The id of the graph of which the desired node is the root.void remove(IRogNode node)
node
- The node to remove.
IllegalArgumentException
- Thrown if the specified node is null.
This method removed an ROG node from a graph collection. The method first checks if the supplied node is a root node. If so, the node is removed from the root node set managed by the graph collection. Otherwise, the method gets the node's parent unlinked from the node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |