private void OnInit(IInputProperty sender, SuccessEventArgs args) { this._inputReader = this.InputPointReader(this.Input.RecordInfo); if (this._inputReader == null) { args.Success = false; return; } this.Output?.Init( FieldDescription.CreateRecordInfo( this.Input.RecordInfo, new FieldDescription( this.ConfigObject.OutputBinXFieldName, FieldType.E_FT_Double, source: "HexBin: X Co-ordinate of Center"), new FieldDescription( this.ConfigObject.OutputBinYFieldName, FieldType.E_FT_Double, source: "HexBin: Y Co-ordinate of Center"))); this._outputBinXFieldBase = this.Output?[this.ConfigObject.OutputBinXFieldName]; this._outputBinYFieldBase = this.Output?[this.ConfigObject.OutputBinYFieldName]; args.Success = true; }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { var fieldDescription = new FieldDescription( this.ConfigObject.OutputFieldName, this.ConfigObject.OutputType, source: $"NumberParser: {this.ConfigObject.InputFieldName} parsed as a number"); this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false); if (this._inputFieldBase == null) { args.Success = false; return; } this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription)); this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName]; // Create the Copier this._copier = this.RecordCopierFactory.CreateCopier( this.Input.RecordInfo, this.Output?.RecordInfo, this.ConfigObject.OutputFieldName); args.Success = true; }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { // Get Input Field this._inputField = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false); if (this._inputField == null) { args.Success = false; return; } // Create Output Format this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, new FieldDescription(nameof(XmlUtils.NodeData.XPath), FieldType.E_FT_V_WString), new FieldDescription(nameof(XmlUtils.NodeData.InnerText), FieldType.E_FT_V_WString), new FieldDescription(nameof(XmlUtils.NodeData.InnerXml), FieldType.E_FT_V_WString))); // Create the Copier this._copier = this.RecordCopierFactory.CreateCopier( this.Input.RecordInfo, this.Output?.RecordInfo, nameof(XmlUtils.NodeData.XPath), nameof(XmlUtils.NodeData.InnerText), nameof(XmlUtils.NodeData.InnerXml)); this._xpathField = this.Output?[nameof(XmlUtils.NodeData.XPath)]; this._innerTextField = this.Output?[nameof(XmlUtils.NodeData.InnerText)]; this._innerXmlField = this.Output?[nameof(XmlUtils.NodeData.InnerXml)]; args.Success = true; }
private void InputOnClosed(IInputProperty sender) { if (this.Breaker.State == ConnectionState.Closed) { this.Output?.Close(true); } }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { // Get Input Field var inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false); if (inputFieldBase == null) { args.Success = false; return; } // Create Output Format var fieldDescription = new FieldDescription( this.ConfigObject.OutputFieldName, FieldType.E_FT_V_WString, this.ConfigObject.OutputFieldLength, source: nameof(StringFormatterEngine)); this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription)); this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName]; // Create the Copier this._copier = this.RecordCopierFactory.CreateCopier( this.Input.RecordInfo, this.Output?.RecordInfo, this.ConfigObject.OutputFieldName); // Create the Formatter function this._formatter = this.CreateFormatter(inputFieldBase); args.Success = this._formatter != null; }
private void BreakerOnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { if (this._failed) { args.Success = false; return; } this._failed = true; this.ExecutionComplete(); }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { this._nextValue = this.CreateRandomFunc(); var fieldDescription = new FieldDescription( this.ConfigObject.OutputFieldName, this.ConfigObject.OutputType, source: $"RandomNumber: {this.ConfigObject.ToString().Replace($"{this.ConfigObject.OutputFieldName}=", string.Empty)}"); this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription)); this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName]; args.Success = true; }
private void OnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { var record = this.Output.Record; record.Reset(); this.Input.Copier.Copy(record, args.RecordData); var val = this._nextValue(); this._outputFieldBase.SetFromDouble(record, val); this.Output.Push(record); args.Success = true; }
private void BreakerOnClosed(IInputProperty sender) { if (!this._failed) { while ((this._inputRecords?.Count ?? 0) > 0) { var record = this._inputRecords?.Dequeue(); this.Output?.Push(record); } } if (this.Input.State == ConnectionState.Closed) { this.Output?.Close(true); } }
private void OnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { this.Output.Record.Reset(); this._copier.Copy(this.Output.Record, args.RecordData); var input = this._inputFieldBase.GetAsString(args.RecordData); var result = this._parser(input); if (result.HasValue) { this._outputFieldBase.SetFromString( this.Output.Record, result.Value.ToString( this._outputFieldBase.FieldType == FieldType.E_FT_Time ? "HH:mm:ss" : "yyyy-MM-dd HH:mm:ss")); } this.Output.Push(this.Output.Record, false, 0); args.Success = true; }
private void InputOnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { if (this._failed) { args.Success = false; return; } var record = this.Input.RecordInfo.CreateRecord(); this.Input.Copier.Copy(record, args.RecordData); if (this.Breaker.State == ConnectionState.Closed) { this.Output?.Push(record); } else { this._inputRecords.Enqueue(record); } }
private void OnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { var record = this.Output.Record; record.Reset(); this._copier.Copy(record, args.RecordData); var result = this._formatter(args.RecordData); if (result != null) { this._outputFieldBase.SetFromString(record, result); } else { this._outputFieldBase.SetNull(record); } this.Output?.Push(record); }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false); if (this._inputFieldBase == null) { args.Success = false; return; } var field = new FieldDescription( this.ConfigObject.OutputFieldName, FieldType.E_FT_V_String, 256, source: nameof(HashCodeGeneratorEngine)); this.Output.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, field)); this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName]; this._hashAlgorithm = this.GetAlgorithm(); args.Success = true; }
private void OnRecordPushed(IInputProperty sender, RecordPushedEventArgs args) { var xml = this._inputField.GetAsString(args.RecordData); var nodes = this.ReadNodes(xml); var record = this.Output.Record; if (nodes == null) { record.Reset(); this._copier.Copy(record, args.RecordData); this._xpathField.SetNull(record); this._innerTextField.SetNull(record); this._innerXmlField.SetNull(record); this.Output?.Push(record); this._recordCount++; if (this._recordCount % 100 == 0) { this.Output.PushCountAndSize(); } } else { foreach (var nodeData in nodes) { record.Reset(); this._copier.Copy(record, args.RecordData); if (nodeData?.XPath == null) { this._xpathField.SetNull(record); } else { this._xpathField.SetFromString(record, nodeData.XPath); } if (nodeData?.InnerText == null) { this._innerTextField.SetNull(record); } else { this._innerTextField.SetFromString(record, nodeData.InnerText); } if (nodeData?.InnerXml == null) { this._innerXmlField.SetNull(record); } else { this._innerXmlField.SetFromString(record, nodeData.InnerXml); } this.Output?.Push(record); this._recordCount++; if (this._recordCount % 100 == 0) { this.Output.PushCountAndSize(); } } } }
private void InputOnInitCalled(IInputProperty property, SuccessEventArgs args) { this._inputRecords = new Queue <Record>(); this.Output?.Init(this.Input.RecordInfo); }