Package com.fluxtion.generator.model
Class TopologicallySortedDependecyGraph
java.lang.Object
com.fluxtion.generator.model.TopologicallySortedDependecyGraph
- All Implemented Interfaces:
com.fluxtion.builder.node.NodeRegistry
public class TopologicallySortedDependecyGraph
extends java.lang.Object
implements com.fluxtion.builder.node.NodeRegistry
Creates a sorted set of dependencies from a supplied set of instances.
- Author:
- Greg Higgins
-
Constructor Summary
Constructors Constructor Description TopologicallySortedDependecyGraph(com.fluxtion.builder.node.DeclarativeNodeConiguration declarativeNodeConiguration)
TopologicallySortedDependecyGraph(com.fluxtion.builder.node.SEPConfig config)
TopologicallySortedDependecyGraph(java.lang.Object... obj)
TopologicallySortedDependecyGraph(java.util.List nodes)
TopologicallySortedDependecyGraph(java.util.List nodes, java.util.Map<java.lang.Object,java.lang.String> publicNodes)
TopologicallySortedDependecyGraph(java.util.List nodes, java.util.Map<java.lang.Object,java.lang.String> publicNodes, com.fluxtion.builder.node.DeclarativeNodeConiguration declarativeNodeConiguration, com.fluxtion.builder.generation.GenerationContext context, java.util.Map<java.lang.String,com.fluxtion.api.audit.Auditor> auditorMap, com.fluxtion.builder.node.SEPConfig config)
Create a new TopologicallySortedDependecyGraphTopologicallySortedDependecyGraph(java.util.Map<java.lang.Object,java.lang.String> publicNodes)
-
Method Summary
Modifier and Type Method Description void
exportAsGraphMl(java.io.Writer writer, boolean addEvents)
exports graph as graphml, can be exported with and without event as nodes on the graph.<T> T
findOrCreateNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName)
<T> T
findOrCreateNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName, boolean isPublic)
<T> T
findOrCreatePublicNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName)
void
generateDependencyTree()
Generates the dependency tree for introspection.com.fluxtion.builder.node.SEPConfig
getConfig()
java.util.List<?>
getDirectChildren(java.lang.Object parent)
returns a list of the direct children of this object in the SEP.node in the SEPjava.util.List<?>
getDirectChildrenListeningForEvent(java.lang.Object parent)
java.util.List<?>
getDirectParents(java.lang.Object child)
returns a list of the direct parents of this object in the SEP.java.util.List<?>
getDirectParentsListeningForEvent(java.lang.Object child)
java.util.List<java.lang.Object>
getEventSortedDependents(java.lang.Object obj)
java.util.Map<java.lang.Object,java.lang.String>
getInstanceMap()
java.util.Map<java.lang.String,com.fluxtion.api.audit.Auditor>
getRegistrationListenerMap()
java.util.List<java.lang.Object>
getSortedDependents()
java.util.List<java.lang.Object>
getSortedDependents(java.lang.Object obj)
boolean
isPublicNode(java.lang.Object node)
<T extends com.fluxtion.api.audit.Auditor>
TregisterAuditor(T node, java.lang.String auditorName)
<T> T
registerNode(T node, java.lang.String variableName)
<T> T
registerNode(T node, java.lang.String variableName, boolean isPublic)
<T> T
registerPublicNode(T node, java.lang.String variableName)
java.lang.String
variableName(java.lang.Object node)
Accessor to the name mapping for an instance.
-
Constructor Details
-
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(java.lang.Object... obj) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(java.util.List nodes) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(java.util.Map<java.lang.Object,java.lang.String> publicNodes) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(com.fluxtion.builder.node.DeclarativeNodeConiguration declarativeNodeConiguration) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(java.util.List nodes, java.util.Map<java.lang.Object,java.lang.String> publicNodes) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(com.fluxtion.builder.node.SEPConfig config) -
TopologicallySortedDependecyGraph
public TopologicallySortedDependecyGraph(java.util.List nodes, java.util.Map<java.lang.Object,java.lang.String> publicNodes, com.fluxtion.builder.node.DeclarativeNodeConiguration declarativeNodeConiguration, com.fluxtion.builder.generation.GenerationContext context, java.util.Map<java.lang.String,com.fluxtion.api.audit.Auditor> auditorMap, com.fluxtion.builder.node.SEPConfig config)Create a new TopologicallySortedDependecyGraph- Parameters:
nodes
- The set of nodes that will be sorted as a list.publicNodes
- Map of public available instances, the value is the unique name of each instance. The names will override existing instances in the nodes List or add the node to the set.declarativeNodeConiguration
- factory descriptionstrat
- NodeNameProducer strategycontext
- Generation context for this cycleauditorMap
- Auditors to injectconfig
- Config for this generation cycle
-
-
Method Details
-
variableName
public java.lang.String variableName(java.lang.Object node)Accessor to the name mapping for an instance.- Parameters:
node
- The instance to for this lookup.- Returns:
- the variable name of the instance.
-
getInstanceMap
public java.util.Map<java.lang.Object,java.lang.String> getInstanceMap() -
getSortedDependents
public java.util.List<java.lang.Object> getSortedDependents() throws java.lang.Exception- Throws:
java.lang.Exception
-
getRegistrationListenerMap
public java.util.Map<java.lang.String,com.fluxtion.api.audit.Auditor> getRegistrationListenerMap() -
getSortedDependents
public java.util.List<java.lang.Object> getSortedDependents(java.lang.Object obj) throws java.lang.Exception- Parameters:
obj
- The root object to search from in the graph.- Returns:
- a sorted dependents list with this object as a root.
- Throws:
java.lang.Exception
- when generating graph
-
getEventSortedDependents
public java.util.List<java.lang.Object> getEventSortedDependents(java.lang.Object obj) throws java.lang.Exception- Throws:
java.lang.Exception
-
getDirectChildren
public java.util.List<?> getDirectChildren(java.lang.Object parent)returns a list of the direct children of this object in the SEP.node in the SEP- Parameters:
parent
- node in the SEP- Returns:
- list of direct children of this node
-
getDirectChildrenListeningForEvent
public java.util.List<?> getDirectChildrenListeningForEvent(java.lang.Object parent) -
getDirectParents
public java.util.List<?> getDirectParents(java.lang.Object child)returns a list of the direct parents of this object in the SEP.- Parameters:
child
- in the SEP- Returns:
- direct parents of this node
-
getDirectParentsListeningForEvent
public java.util.List<?> getDirectParentsListeningForEvent(java.lang.Object child) -
registerPublicNode
public <T> T registerPublicNode(T node, java.lang.String variableName)- Specified by:
registerPublicNode
in interfacecom.fluxtion.builder.node.NodeRegistry
-
registerAuditor
public <T extends com.fluxtion.api.audit.Auditor> T registerAuditor(T node, java.lang.String auditorName)- Specified by:
registerAuditor
in interfacecom.fluxtion.builder.node.NodeRegistry
-
registerNode
public <T> T registerNode(T node, java.lang.String variableName, boolean isPublic) -
registerNode
public <T> T registerNode(T node, java.lang.String variableName)- Specified by:
registerNode
in interfacecom.fluxtion.builder.node.NodeRegistry
-
findOrCreatePublicNode
public <T> T findOrCreatePublicNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName)- Specified by:
findOrCreatePublicNode
in interfacecom.fluxtion.builder.node.NodeRegistry
-
findOrCreateNode
public <T> T findOrCreateNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName)- Specified by:
findOrCreateNode
in interfacecom.fluxtion.builder.node.NodeRegistry
-
findOrCreateNode
public <T> T findOrCreateNode(java.lang.Class<T> clazz, java.util.Map config, java.lang.String variableName, boolean isPublic) -
generateDependencyTree
public void generateDependencyTree() throws java.lang.ExceptionGenerates the dependency tree for introspection.- Throws:
java.lang.Exception
- when problem generating the dependency tree
-
isPublicNode
public boolean isPublicNode(java.lang.Object node) -
getConfig
public com.fluxtion.builder.node.SEPConfig getConfig() -
exportAsGraphMl
public void exportAsGraphMl(java.io.Writer writer, boolean addEvents) throws org.xml.sax.SAXException, javax.xml.transform.TransformerConfigurationExceptionexports graph as graphml, can be exported with and without event as nodes on the graph.- Parameters:
writer
- targetaddEvents
- flag to control inclusion of events as nodes- Throws:
org.xml.sax.SAXException
- problem writing jpgraphMljavax.xml.transform.TransformerConfigurationException
- problem writing jpgraphMl
-