-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from jdunkerley/streaming
IOutputHelper interface and factory
- Loading branch information
Showing
21 changed files
with
199 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace JDunkerley.AlteryxAddIns.Framework.Factories | ||
{ | ||
using Interfaces; | ||
|
||
/// <summary> | ||
/// Factory For Creating <see cref="IOutputHelper"/> objects. | ||
/// </summary> | ||
public class OutputHelperFactory : IOutputHelperFactory | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of an <see cref="IOutputHelper"/> | ||
/// </summary> | ||
/// <param name="hostEngine">The host engine.</param> | ||
/// <param name="connectionName">Name of the outgoing connection.</param> | ||
/// <returns>A configured instance of an <see cref="IOutputHelper"/></returns> | ||
public IOutputHelper CreateOutputHelper(IBaseEngine hostEngine, string connectionName) | ||
=> new OutputHelper(hostEngine, connectionName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
namespace JDunkerley.AlteryxAddIns.Framework.Interfaces | ||
{ | ||
using System.Xml; | ||
using AlteryxRecordInfoNet; | ||
|
||
/// <summary> | ||
/// Interface Defining An Output Helper | ||
/// </summary> | ||
public interface IOutputHelper | ||
{ | ||
/// <summary> | ||
/// Gets a reusable <see cref="Record"/> object | ||
/// </summary> | ||
Record Record { get; } | ||
|
||
/// <summary> | ||
/// Gets the <see cref="RecordInfo"/> describing the Output records | ||
/// </summary> | ||
RecordInfo RecordInfo { get; } | ||
|
||
/// <summary> | ||
/// Given a fieldName, gets the <see cref="FieldBase"/> for it | ||
/// </summary> | ||
/// <param name="fieldName">Name of field</param> | ||
/// <returns><see cref="FieldBase"/> representing the field</returns> | ||
FieldBase this[string fieldName] { get; } | ||
|
||
/// <summary> | ||
/// Initializes the output stream. | ||
/// </summary> | ||
/// <param name="recordInfo">RecordInfo defining the fields and outputs of the connection.</param> | ||
/// <param name="sortConfig">Sort configuration to pass onto Alteryx.</param> | ||
/// <param name="oldConfig">XML configuration of the tool.</param> | ||
void Init(RecordInfo recordInfo, XmlElement sortConfig = null, XmlElement oldConfig = null); | ||
|
||
/// <summary> | ||
/// Pushes a record to Alteryx to hand onto over tools. | ||
/// </summary> | ||
/// <param name="record">Record object to push to the stream.</param> | ||
/// <param name="close">Value indicating whether to close the connection after pushing the record.</param> | ||
/// <param name="updateCountMod">How often to update Row Count and Data</param> | ||
void Push(Record record, bool close = false, ulong updateCountMod = 250); | ||
|
||
/// <summary> | ||
/// Update The Progress Of A Connection | ||
/// </summary> | ||
/// <param name="percentage">Percentage Progress from 0.0 to 1.0</param> | ||
/// <param name="setToolProgress">Set Tool Progress As Well</param> | ||
void UpdateProgress(double percentage, bool setToolProgress = false); | ||
|
||
/// <summary> | ||
/// Tell Alteryx We Are Finished | ||
/// </summary> | ||
/// <param name="executionComplete">Tell Alteryx Tool Execution Is Complete</param> | ||
void Close(bool executionComplete = false); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
AlteryxAddIns.Framework/Interfaces/IOutputHelperFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace JDunkerley.AlteryxAddIns.Framework.Interfaces | ||
{ | ||
/// <summary> | ||
/// Interface to decouple the construction of <see cref="IOutputHelper"/> objects from <see cref="BaseEngine{TConfig}"/>. | ||
/// </summary> | ||
public interface IOutputHelperFactory | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of an <see cref="IOutputHelper"/> | ||
/// </summary> | ||
/// <param name="hostEngine">The host engine.</param> | ||
/// <param name="connectionName">Name of the outgoing connection.</param> | ||
/// <returns>A configured instance of an <see cref="IOutputHelper"/></returns> | ||
IOutputHelper CreateOutputHelper(IBaseEngine hostEngine, string connectionName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.