public override void Execute() { //* if (ConMan() == null) { FlowError.Complain("ConnectToSturdyRef(" + Name + "): No ConnectionManager instance available."); } //*/ // read mandatory sturdy ref to connect to Packet p = _sturdyRefPort.Receive(); if (p != null) { _sturdyRef = p.Content.ToString(); Drop(p); } if (string.IsNullOrEmpty(_sturdyRef)) { FlowError.Complain("ConnectToSturdyRef(" + Name + ").IN: Received sturdy ref is invalid or empty."); } // read a string this component will convert to a type p = _capTypePort.Receive(); if (p != null) { _capType = SupportedTypes.GetValueOrDefault(p.Content.ToString(), _capType); Drop(p); if (_capType == null) { FlowError.Complain("ConnectToSturdyRef(" + Name + ").TYPE: Received capability type is unknown."); } } try { dynamic task = typeof(InfraCommon.ConnectionManager) .GetMethod("Connect") .MakeGenericMethod(_capType) .Invoke(ConMan(), new object[] { _sturdyRef }); _outPort.Send(Create(task.Result)); } catch (System.Exception e) { FlowError.Complain("ConnectToSturdyRef(" + Name + "): Exception: " + e.Message); } }