java.lang.Object
de.grogra.util.LockableImpl
de.grogra.persistence.PersistenceManager
de.grogra.graph.impl.GraphManager
- All Implemented Interfaces:
Graph
,SharedObjectProvider
,Lockable
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.grogra.util.Lockable
Lockable.DeadLockException
Nested classes/interfaces inherited from interface de.grogra.persistence.SharedObjectProvider
SharedObjectProvider.Binding
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal LongToIntHashMap
A mapping of each node ID (participating in integration) to an index into the rate vector is stored here.static final I18NBundle
static final String
double[]
Stores a reference to the rate vector.static final GraphManager
static final GraphState
Fields inherited from class de.grogra.persistence.PersistenceManager
makeLock
Fields inherited from interface de.grogra.graph.Graph
BRANCH_EDGE, CONTAINMENT_EDGE, CONTAINMENT_END_EDGE, EDGENODE_IN_EDGE, EDGENODE_OUT_EDGE, ELLIPSE_SYMBOL, IGNORED_EDGE, INSTANTIATION_EDGE, MAIN_GRAPH, MARK_EDGE, MIN_NORMAL_BIT_INDEX, MIN_UNUSED_EDGE, MIN_UNUSED_EDGE_BIT, NOTIFIES_EDGE, PERSISTENT, PERSISTENT_DELETED, RECTANGLE_SYMBOL, REFINEMENT_EDGE, RHOMBUS_SYMBOL, ROUND_RECTANGLE_SYMBOL, SPECIAL_EDGE_MASK, SPECIAL_EDGE_OF_SOURCE_BIT, STD_EDGE_5, STD_EDGE_6, SUCCESSOR_EDGE, TRANSIENT
-
Constructor Summary
ConstructorsConstructorDescriptionGraphManager
(PersistenceConnection cx, String key, boolean logLifeCycle, boolean checkLock) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
static void
acceptGraph
(Node root, Visitor v, ArrayPath pathToUse) void
void
addAttributeChangeListener
(Object object, boolean asNode, AttributeChangeListener l) void
void
void
addEdgeChangeListener
(Object object, boolean asNode, EdgeChangeListener l) void
addMetaNode
(Node node, Transaction t) void
final int
allocateBitMark
(boolean resetOnDispose) final int
allocateObjectMark
(boolean resetOnDispose) protected void
completeTransaction
(Transaction t, boolean commit) boolean
Check if the graph contains a node with the specified name.<V> ObjectMap<V>
protected Transaction
createTransaction
(Thread thread) protected TransactionApplier
final void
disposeBitMark
(int handle, boolean resetAll) final void
disposeBitMark
(int handle, boolean resetAll, boolean onlyNodes) final void
disposeObjectMark
(int handle, boolean resetAll) final void
disposeObjectMark
(int handle, boolean resetAll, boolean onlyNodes) void
void
protected void
protected void
getAccessor
(Object object, boolean asNode, Attribute attribute) Returns an attribute accessor for the given attribute on the given object.getAttributes
(Object object, boolean asNode) Returns the set of attributes which are available for the given object.int
getDependent
(Object object, boolean asNode, Attribute a) Returns the set of attributes whose values depend on the given attributea
for the givenobject
.getDescription
(Object object, boolean asNode, String type) Returns a description for the given object.int
getEdgeBits
(Object edge) Returns the edge bits of an edge.getFirstEdge
(Object node) Returns the first edge of the linked list of edges ofnode
.int
Number of nodes in the main graph.int
getGraphSize
(String key) Number of nodes of the specified graph.long
Returns a unique identifier for the givennode
.getInstantiator
(Object node) int
getLifeCycleState
(Object object, boolean asNode) Returns the life cycle state of the given object as part of this graph.void
getListOfNodes
(Node node, Edge edge, boolean branch, HashMap<Node, String> visited, ObjectList<Node> toVisit) Returns the main graph state.int
Number of nodes in the meta graph.Returns a name for the given object.getNextEdge
(Object edge, Object parentNode) Returns the edge afteredge
in the linked list of edges ofnode
.getNodeForId
(long id) Returns the node identified byid
.getNodeForName
(Node root, String name) Check if the graph contains a node with the specified name and possibly returns it.getNodeForName
(String name) getObject
(long id) getObjectForName
(boolean node, String name) Returns the object with the given name.Defines the derived attribute which has as value the parent object.getProperty
(String key) getRoot()
Returns the root node of theGraph.MAIN_GRAPH
of this graph.Returns the root node for the given root key.String[]
Returns the root keys for the graph.void
getScales
(ArrayList<ScaleClass> scales) void
getScalesInternal
(Node node, ArrayList<ScaleClass> scales) int
getScaleValue
(Node node) Get node in type graph representing the type of the input nodegetSourceNode
(Object edge) Returns the source node ofedge
.getSpecialEdgeDescriptors
(Object node, boolean asSource) getSRoot()
Returns the root of the Structure of scalesint
getTargetNode
(Object edge) Returns the target node ofedge
.Defines the pattern used for the construction of this graph's tree.getTypeNode
(Node node) Get node in type graph representing the type of the input nodeReturns the root of the type graph for the graphboolean[]
void
initMainState
(Executor sync) protected void
invokeRun
(LockProtectedRunnable task, boolean sameThread, Lock lock) protected boolean
isAllowedThread
(boolean write) protected void
void
logDataOnPersistenceChange
(boolean value) void
makePersistentImpl
(PersistenceCapable o, long id, Transaction t) protected void
protected void
prepareCompletion
(Transaction t, boolean commit) long
prepareId
(PersistenceCapable node) void
void
void
Removes all nodes in graph from extent.void
void
removeAttributeChangeListener
(Object object, boolean asNode, AttributeChangeListener l) void
void
void
removeEdgeChangeListener
(Object object, boolean asNode, EdgeChangeListener l) void
removeMetaNode
(Node node, Transaction t) void
void
replaceInGraph
(Node node, Node toBeReplaced, Transaction xa) method to replace the node (toBeReplaced) by the node (node) in the graph.void
setMakePersistentTransitive
(boolean value) void
setProperty
(String key, Object value) void
void
setVisibleScales
(boolean[] visibleScales) void
suppressLogging
(boolean value) toXLString
(boolean qualified) Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it.toXLString
(boolean qualified, boolean ids) Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it.toXLString
(boolean qualified, String rootKey, boolean ids) Parses the graph from the rootKey and generates a textual representation of it.protected void
transactionApplied
(Transaction.Data xa, boolean rollback, Transaction t) void
writeExtent
(GraphOutput out, Node root) void
void
Dump the whole graph into out.void
writeObject
(Shareable object, PersistenceOutput out) Methods inherited from class de.grogra.persistence.PersistenceManager
addXAListener, beginTransaction, close, getActiveTransaction, getBindings, getConnection, getId, getLog, getStamp, getTransaction, getTransactionData, getTransactions, idUsed, initNonlocalTransactionNotifier, localTransactionCommitted, localTransactionRolledBack, makePersistent, makePersistent, makeTransient, nextId, removeXAListener, transactionCommitted, undo
Methods inherited from class de.grogra.util.LockableImpl
execute, execute, executeForcedly, executeForcedly, getMaxWaitingTime, getQueueLength, isLocked, killLock, lock
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.grogra.util.Lockable
execute, execute, executeForcedly, executeForcedly, getMaxWaitingTime, getQueueLength, isLocked
-
Field Details
-
I18N
-
META_GRAPH
- See Also:
-
STATIC
-
STATIC_STATE
-
rate
public double[] rateStores a reference to the rate vector. When integration starts, a reference to the rate vector is stored here, so that PropertyRuntime.GraphProperty can access the rate vector.- See Also:
-
de.grogra.rgg.model.PropertyRuntime.GraphProperty#defRateAssign()
-
baseMap
A mapping of each node ID (participating in integration) to an index into the rate vector is stored here. It is assumed, that all properties of a node participating in integration are stored in the rate array in a continuous block, where the start index of the block is the number stored in this mapping.
-
-
Constructor Details
-
GraphManager
-
-
Method Details
-
initMainState
-
getMainState
Description copied from interface:Graph
Returns the main graph state. The main graph state is the only graph state within which modifications to the graph may be done. The notification of event listeners is done in the context of this state, too.- Specified by:
getMainState
in interfaceGraph
- Returns:
- this graph's main graph state
- See Also:
-
getStateMap
- Specified by:
getStateMap
in interfaceGraph
-
addChangeBoundaryListener
- Specified by:
addChangeBoundaryListener
in interfaceGraph
-
removeChangeBoundaryListener
- Specified by:
removeChangeBoundaryListener
in interfaceGraph
-
addAttributeChangeListener
- Specified by:
addAttributeChangeListener
in interfaceGraph
-
addEdgeChangeListener
- Specified by:
addEdgeChangeListener
in interfaceGraph
-
removeAttributeChangeListener
- Specified by:
removeAttributeChangeListener
in interfaceGraph
-
removeEdgeChangeListener
- Specified by:
removeEdgeChangeListener
in interfaceGraph
-
addAttributeChangeListener
- Specified by:
addAttributeChangeListener
in interfaceGraph
-
removeAttributeChangeListener
- Specified by:
removeAttributeChangeListener
in interfaceGraph
-
addEdgeChangeListener
- Specified by:
addEdgeChangeListener
in interfaceGraph
-
removeEdgeChangeListener
- Specified by:
removeEdgeChangeListener
in interfaceGraph
-
setRoot
-
getRoot
Returns the root node of theGraph.MAIN_GRAPH
of this graph.- Returns:
- root node of main graph
-
getRoot
Description copied from interface:Graph
Returns the root node for the given root key.- Specified by:
getRoot
in interfaceGraph
- Parameters:
key
- a root key, one ofGraph.getRootKeys()
- Returns:
- the root node of the graph identified by
key
, ornull
if no such root node exists - See Also:
-
getRootKeys
Description copied from interface:Graph
Returns the root keys for the graph.- Specified by:
getRootKeys
in interfaceGraph
- Returns:
- an array of root keys
- See Also:
-
logDataOnPersistenceChange
public void logDataOnPersistenceChange(boolean value) -
suppressLogging
public void suppressLogging(boolean value) -
createXAApplier
- Specified by:
createXAApplier
in classPersistenceManager
-
createTransaction
- Specified by:
createTransaction
in classPersistenceManager
-
isAllowedThread
protected boolean isAllowedThread(boolean write) - Overrides:
isAllowedThread
in classLockableImpl
-
executeInAllowedThread
- Overrides:
executeInAllowedThread
in classLockableImpl
-
invokeRun
- Overrides:
invokeRun
in classLockableImpl
-
enterWriteLock
protected void enterWriteLock()- Overrides:
enterWriteLock
in classLockableImpl
-
leaveWriteLock
protected void leaveWriteLock()- Overrides:
leaveWriteLock
in classLockableImpl
-
prepareCompletion
- Overrides:
prepareCompletion
in classPersistenceManager
-
transactionApplied
- Overrides:
transactionApplied
in classPersistenceManager
-
completeTransaction
- Overrides:
completeTransaction
in classPersistenceManager
-
setProperty
-
getProperty
-
removeAllFromExtent
public void removeAllFromExtent()Removes all nodes in graph from extent. Used when automatically generated modules are recompiled. Then instances of the modules must be replaced with new instances of the newly compiled types. Old nodes of the old modules must be removed from the extent so they are no longer referenced. -
prepareId
- Specified by:
prepareId
in classPersistenceManager
-
setMakePersistentTransitive
public void setMakePersistentTransitive(boolean value) -
makePersistentImpl
- Specified by:
makePersistentImpl
in classPersistenceManager
-
getExtent
-
getExtent
-
rebuildExtents
public void rebuildExtents() -
makeTransientImpl
- Specified by:
makeTransientImpl
in classPersistenceManager
-
getObject
- Specified by:
getObject
in classPersistenceManager
-
allocateBitMark
public final int allocateBitMark(boolean resetOnDispose) - Specified by:
allocateBitMark
in classPersistenceManager
-
disposeBitMark
public final void disposeBitMark(int handle, boolean resetAll) - Specified by:
disposeBitMark
in classPersistenceManager
-
disposeBitMark
public final void disposeBitMark(int handle, boolean resetAll, boolean onlyNodes) -
allocateObjectMark
public final int allocateObjectMark(boolean resetOnDispose) - Specified by:
allocateObjectMark
in classPersistenceManager
-
disposeObjectMark
public final void disposeObjectMark(int handle, boolean resetAll) - Specified by:
disposeObjectMark
in classPersistenceManager
-
disposeObjectMark
public final void disposeObjectMark(int handle, boolean resetAll, boolean onlyNodes) -
createBooleanMap
- Specified by:
createBooleanMap
in interfaceGraph
-
createObjectMap
- Specified by:
createObjectMap
in interfaceGraph
-
writeExtent
- Specified by:
writeExtent
in classPersistenceManager
- Throws:
IOException
-
writeExtent
- Throws:
IOException
-
writeExtentWithoutTopology
Dump the whole graph into out. Nodes are visited without considering their topology- Parameters:
out
-- Throws:
IOException
-
readExtent
- Specified by:
readExtent
in classPersistenceManager
- Throws:
IOException
-
accept
-
acceptGraph
-
createStaticState
-
getParentAttribute
Description copied from interface:Graph
Defines the derived attribute which has as value the parent object.- Specified by:
getParentAttribute
in interfaceGraph
- Returns:
- the parent attribute
- See Also:
-
getTreePattern
Description copied from interface:Graph
Defines the pattern used for the construction of this graph's tree.- Specified by:
getTreePattern
in interfaceGraph
- Returns:
- an edge pattern
- See Also:
-
getProviderName
- Specified by:
getProviderName
in interfaceSharedObjectProvider
-
readReference
- Specified by:
readReference
in interfaceSharedObjectProvider
- Throws:
IOException
-
addMetaNode
-
removeMetaNode
-
getLifeCycleState
Description copied from interface:Graph
Returns the life cycle state of the given object as part of this graph.- Specified by:
getLifeCycleState
in interfaceGraph
- Parameters:
object
- the object to testasNode
-true
ifobject
is a node,false
ifobject
is an edge- Returns:
- life cycle state, one of
Graph.PERSISTENT
,Graph.PERSISTENT_DELETED
,Graph.TRANSIENT
-
getName
Description copied from interface:Graph
Returns a name for the given object. Names are not necessarily unique. -
getId
Description copied from interface:Graph
Returns a unique identifier for the givennode
. -
getNodeForId
Description copied from interface:Graph
Returns the node identified byid
.- Specified by:
getNodeForId
in interfaceGraph
- Parameters:
id
- an identifier- Returns:
- the corresponding node, or
null
ifid
identifies no node - See Also:
-
getObjectForName
Description copied from interface:Graph
Returns the object with the given name. If several such objects exist, one of them is chosen in an unspecified manner. If no such object exists,null
is returned.- Specified by:
getObjectForName
in interfaceGraph
- Parameters:
node
-true
if a node of the given name is to be found,false
if an edge is to be foundname
- the name of the object- Returns:
- an object of the given kind (node or edge) with the given name,
or
null
if no such object exists - See Also:
-
getNodeForName
-
getDescription
Description copied from interface:Graph
Returns a description for the given object. The type of the desired description (e.g., text, icon) is specified in the argumenttype
; it is interpreted as inDescribed.getDescription(String)
.- Specified by:
getDescription
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgetype
- the type of description- Returns:
- a description of the given type, or
null
-
getSpecialEdgeDescriptors
- Specified by:
getSpecialEdgeDescriptors
in interfaceGraph
-
getSymbol
-
getColor
-
getAttributes
Description copied from interface:Graph
Returns the set of attributes which are available for the given object.- Specified by:
getAttributes
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edge- Returns:
- the object's attributes
-
getDependent
Description copied from interface:Graph
Returns the set of attributes whose values depend on the given attributea
for the givenobject
.- Specified by:
getDependent
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgea
- the attribute- Returns:
- the set of dependent attributes
-
getAccessor
Description copied from interface:Graph
Returns an attribute accessor for the given attribute on the given object.- Specified by:
getAccessor
in interfaceGraph
- Parameters:
object
- the objectasNode
-true
ifobject
is a node,false
ifobject
is an edgeattribute
- the attribute- Returns:
- an accessor for the object's attribute value
-
getFirstEdge
Description copied from interface:Graph
Returns the first edge of the linked list of edges ofnode
.- Specified by:
getFirstEdge
in interfaceGraph
- Parameters:
node
- the common node of the edges of the linked list- Returns:
- the first edge of the linked list
- See Also:
-
getInstantiator
- Specified by:
getInstantiator
in interfaceGraph
-
getEdgeBits
Description copied from interface:Graph
Returns the edge bits of an edge.- Specified by:
getEdgeBits
in interfaceGraph
- Parameters:
edge
- the edge- Returns:
- the edge's edge bits
- See Also:
-
getSourceNode
Description copied from interface:Graph
Returns the source node ofedge
.- Specified by:
getSourceNode
in interfaceGraph
- Parameters:
edge
- an edge- Returns:
- the source node
- See Also:
-
getTargetNode
Description copied from interface:Graph
Returns the target node ofedge
.- Specified by:
getTargetNode
in interfaceGraph
- Parameters:
edge
- an edge- Returns:
- the target node
- See Also:
-
getNextEdge
Description copied from interface:Graph
Returns the edge afteredge
in the linked list of edges ofnode
.- Specified by:
getNextEdge
in interfaceGraph
- Parameters:
edge
- the previous edge in the linked listparentNode
- the common node of the edges of the linked list- Returns:
- the next edge of the linked list
- See Also:
-
dumpNodeStatistics
-
dumpNodeStatistics
-
toXLString
Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it. with classes and id's- Parameters:
qualified
-ids
-- Returns:
-
toXLString
Parses the GraphManager.MAIN_GRAPH and generates a textual representation of it. with classes- Parameters:
qualified
-- Returns:
-
toXLString
Parses the graph from the rootKey and generates a textual representation of it.- Parameters:
qualified
-rootKey
- {GraphManager.MAIN_GRAPH, GraphManager.META_GRAPH, GraphManager.COMPONENT_GRAPH}- Returns:
-
getGraphSize
Number of nodes of the specified graph.- Parameters:
key
- graph identification key (one of: MAIN_GRAPH, COMPONENT_GRAPH, META_GRAPH)- Returns:
-
getGraphSize
public int getGraphSize()Number of nodes in the main graph. same as count((* Node *))- Returns:
-
getMetaGraphSize
public int getMetaGraphSize()Number of nodes in the meta graph.- Returns:
-
getListOfNodes
public void getListOfNodes(Node node, Edge edge, boolean branch, HashMap<Node, String> visited, ObjectList<Node> toVisit) - Parameters:
node
- start nodeedge
-branch
-visited
- list of visited nodestoVisit
- list of all nodes
-
contains
Check if the graph contains a node with the specified name.- Parameters:
root
- String namename
- Node root- Returns:
- true, if the graph starting with root contains a node with the specified name
-
getNodeForName
Check if the graph contains a node with the specified name and possibly returns it.- Parameters:
String
- nameNode
- root- Returns:
- node, if the graph starting with root contains a node with the specified name
-
getSRoot
Returns the root of the Structure of scales- Parameters:
g
- GraphManager (i.e. the graph) instance- Returns:
- the root of the Structure of scales
-
getScales
-
getScalesInternal
-
getTypeRoot
Returns the root of the type graph for the graph- Parameters:
g
- GraphManager (i.e. the graph) instance- Returns:
- the root of the type graph for the graph
-
getTypeNode
Get node in type graph representing the type of the input node- Parameters:
node
-- Returns:
- node from type graph representing type of input node
-
getScaleValue
Get node in type graph representing the type of the input node- Parameters:
node
-- Returns:
- node from type graph representing type of input node
-
getVisibleScales
public boolean[] getVisibleScales() -
setVisibleScales
public void setVisibleScales(boolean[] visibleScales) -
replaceInGraph
method to replace the node (toBeReplaced) by the node (node) in the graph. I.e. by replacing all edges. Warning: endless loop when replaced happens in visitor. The newly created nodes should be ignored
-