BuildApp – StepInstancesConnectionFinder

The next process step is to find the right event and method names defined by FDL. Two helper functions (GetSourceEndPoints ande GetTargetEndPoints) do the work. Both work in the same way. Here’s the content of GetSourceEndPoints:

private List<ConnectionEndPoint> GetSourceEndPoints(AppDefinition app, string currentNamespace, FDLFlowDefinition currentFlowDefinition, FDLWireDefinition currentConnectionDefinition) {
			List<ConnectionEndPoint> tSourceEndPoints = new List<ConnectionEndPoint>();
 
	if (!currentFlowDefinition.Steps.Collection[currentConnectionDefinition.Source.Step].IsSubFlowStep) {
		ConnectionEndPoint tConnectionEndPoint = new ConnectionEndPoint();
		tConnectionEndPoint.FDLNamespace = currentNamespace;
		tConnectionEndPoint.FDLStepName = currentConnectionDefinition.Source.Step;
		tConnectionEndPoint.FDLPinName = currentConnectionDefinition.Source.Pin;
		tSourceEndPoints.Add(tConnectionEndPoint);
	}
	Else {
		string tSubFlowNamespace = string.Concat(currentNamespace,  ".", currentConnectionDefinition.Source.Step);
		DSLStepDefinition tSubFlowStepDefinition = currentFlowDefinition.Steps. 
 			Collection[currentConnectionDefinition.Source.Step];
		DSLFlowDefinition tSubFlowDefinition = app.FlowDefinitions[  
 			tSubFlowStepDefinition.TypeName];
 
		foreach (FDLWireDefinition tConnection in tSubFlowDefinition.Wires.Collection) {
			if ((tConnection.Target.Step == "Out") 
 			 && (tConnection.Target.Pin == currentConnectionDefinition.Source.Pin))
				tSourceEndPoints.AddRange( GetSourceEndPoints( 
 					app, tSubFlowNamespace, tSubFlowDefinition, 
 					 tConnection));
		}
	}
	return tSourceEndPoints;
}

These functions are “crawling” down to each step by drilling down the flow definitions starting with “MainFlow”. The functions simply compare the step names defined in the flow definitions with the names of the implemented methods of events. If the name defined in FDL contains a fullstop, the AppBuilder expects a full qualified name (FDL namespace plus class name). The results are stored in instances of „StepInstanceConnection“:

StepInstanceConnection.png

Each endpoint of a connection consists of namespace, name of the step und the name of the pin (e.g. event or method name). Fullname and FullStepName are helper properties. FullStepName return the namespace and name of the class. FullName includes the method or event same (Depends on source or target).
After this step, the AppBuilder knows everything that’s needed to connect the events by delegates. The next step will do that.

Last edited Apr 22, 2013 at 8:41 AM by InneHo, version 4

Comments

No comments yet.