Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
XmlFileEventSinkNode.cs
2using System.Threading.Tasks;
3using System.Xml;
6using Waher.Things;
9
11{
16 {
21 : base()
22 {
23 }
24
35 string SinkId, string FileName, string TransformFileName, int DeleteAfterDays)
36 : base(Source, Parent, SinkId)
37 {
38 this.FileName = FileName;
39 this.TransformFileName = TransformFileName;
40 this.DeleteAfterDays = DeleteAfterDays;
41 }
42
46 [Page(7, "Configuration")]
47 [Header(148, "File Name:")]
48 [ToolTip(149, "Name of file where events will be logged.")]
49 [Text(TextPosition.AfterField, 154, "The substrings %YEAR%, %MONTH%, %DAY%, %HOUR%, %MINUTE and %SECOND% will be replaced by the current year, month, day, hour, minute and second respectively.")]
50 [Required]
51 public string FileName { get; set; }
52
56 [Page(7, "Configuration")]
57 [Header(155, "Transform File Name:")]
58 [ToolTip(156, "Name of optional transform file that will be embedded in generated XML files.")]
59 [Text(TextPosition.AfterField, 154, "The substrings %YEAR%, %MONTH%, %DAY%, %HOUR%, %MINUTE and %SECOND% will be replaced by the current year, month, day, hour, minute and second respectively.")]
60 public string TransformFileName { get; set; }
61
65 [Page(7, "Configuration")]
66 [Header(150, "Delete After Days:")]
67 [ToolTip(151, "Number of days after which log files are deleted.")]
68 [Required]
69 [Range(1, int.MaxValue)]
70 public int DeleteAfterDays { get; set; }
71
76 public override Task<string> GetTypeNameAsync(Language Language)
77 {
78 return Language.GetStringAsync(typeof(GatewayConfigSource), 157, "XML File Event Sink");
79 }
80
87 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
88 {
89 LinkedList<Parameter> Parameters = (LinkedList<Parameter>)await base.GetDisplayableParametersAsync(Language, Caller);
91
92 Parameters.AddLast(new StringParameter("FileName", await Namespace.GetStringAsync(152, "File Name"), this.FileName));
93 Parameters.AddLast(new StringParameter("TransformFileName", await Namespace.GetStringAsync(158, "Transform"), this.TransformFileName));
94
95 return Parameters;
96 }
97
102 public override void Export(XmlWriter Output)
103 {
104 Output.WriteStartElement("XmlFileEventSink");
105 Output.WriteAttributeString("id", this.SinkId);
106 Output.WriteAttributeString("fileName", this.FileName);
107 Output.WriteAttributeString("transformFileName", this.TransformFileName);
108 Output.WriteAttributeString("deleteAfterDays", this.DeleteAfterDays.ToString());
109 Output.WriteEndElement();
110 }
111 }
112}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
Abstract base class for event sink nodes.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
string TransformFileName
Name of the transform file to embed in XML file output.
XmlFileEventSinkNode(GatewayConfigSource Source, ConfigurationNode Parent, string SinkId, string FileName, string TransformFileName, int DeleteAfterDays)
Representation of a XmlFileEventSink
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override void Export(XmlWriter Output)
Exports the event sink definition to XML.
Tokens available in request.
Definition: RequestOrigin.cs:9
TextPosition
Where the instructions are to be place.
Definition: TextAttribute.cs:9