protected DestinationControllerAbstract(XmlNode node, NgExecutionController executionController)
        {
            this.config = node;
            this.executionController = executionController;

            this.eventDistributor = executionController.eventDistributor;
            this.clientHub        = executionController.clientHub;

            this.executionNodeID = node.Attributes["executionNodeUuid"]?.Value;
            this.uuid            = node.Attributes["uuid"]?.Value;

            try {
                name = config.Attributes["name"].Value;
            } catch (Exception) {
                Console.WriteLine("Error: No Name define <destination>");
                return;
            }

            this.triggerIDs      = SetTriggerIDS();
            this.saveMessageFile = SetVar("saveMessageFile", null);
            this.dataSource      = SetVar("dataSource", null);
            this.dataFile        = SetVar("dataFile", null);
            this.excelRowStart   = SetVar("excelRowStart", -1);

            this.amsHost    = SetVar("amshost", null);
            this.amsToken   = SetVar("amstoken", null);
            this.amsAptCode = SetVar("aptcode", null);
            this.amsTimeout = SetVar("amstimeout", null);

            this.ConfigOK = true;
        }
 public AmsDirectExecutionController(XmlNode node, NgExecutionController executionController) : base(node, executionController)
 {
     if (!ConfigOK)
     {
         return;
     }
     this.destinationDirectory = SetVar("destinationDirectory", null);
     this.protocol             = SetVar("protocol", "WS");
 }
Ejemplo n.º 3
0
        public ClientHub(string hostURL, NgExecutionController ngExecutionController)
        {
            this.ngExecutionController = ngExecutionController;
            hubURL = hostURL;
            this.ConfigureHub(hostURL);

            Task.Run(async delegate {
                StartSignalRClientHub();
            });
        }
        public LineExecutionController(XmlNode node, NgExecutionController executionController) : base(node, executionController)
        {
            if (!ConfigOK)
            {
                return;
            }
            LineName = config.Attributes["name"].Value;
            LineType = config.Attributes["protocol"].Value;

            try {
                destinationEndPoint = new DestinationEndPoint(config, logger);
                if (!destinationEndPoint.OK_TO_RUN)
                {
                    destLogger.Error($"Error: End Point Configuration Problem for {name}");
                    ConfigOK = false;
                    return;
                }
            } catch (Exception ex) {
                destLogger.Error(ex, $"Error: No End Point defined for {name}");
                SetOutput("Error: No End Point Defined " + ex.Message);
                ConfigOK = false;
                return;
            }

            try {
                templateFile = config.Attributes["templateFile"].Value;
            } catch (Exception ex) {
                if (LineType != "HTTPGET")
                {
                    destLogger.Error(ex, $"Template File not defined for {name}");
                    SetOutput("Error: No Template File Defined");
                    ConfigOK = false;
                    return;
                }
            }
            try {
                template = File.ReadAllText(templateFile);
            } catch (Exception ex) {
                if (LineType != "HTTPGET")
                {
                    destLogger.Error(ex, $"Template File {templateFile} cannot be read for {name}.");
                    SetOutput("Error: Template File Could Not Be Read");
                    return;
                }
                else
                {
                    template = "";
                }
            }
            destLogger.Info($"Controller and View Created for {LineName}");
        }
        protected SourceControllerAbstract(XmlNode node, int chainDepth, List <string> triggersInUse, int serverOffset, NgExecutionController executionController)
        {
            this.node                = node;
            this.triggersInUse       = triggersInUse;
            this.clientHub           = executionController?.clientHub;
            eventDistributor         = executionController?.eventDistributor;
            this.executionController = executionController;
            this.serverOffset        = serverOffset;
            name = node.Attributes["name"]?.Value;
            id   = node.Attributes["ID"]?.Value;

            dataSourceType   = node.Attributes["dataSource"]?.Value;
            flightSourceType = node.Attributes["flttype"]?.Value;

            executionNodeID = node.Attributes["executionNodeUuid"]?.Value;
            uuid            = node.Attributes["uuid"]?.Value;

            if ((flightSourceType != null && flightSourceType != "none") || node.Name == "amsdatadriven")
            {
                if (flightSourceType == "arr")
                {
                    flttype = FlightType.Arrival;
                }
                else if (flightSourceType == "dep")
                {
                    flttype = FlightType.Departure;
                }
                else
                {
                    flttype = FlightType.Both;
                }

                try {
                    if (node.Attributes["flightSetFrom"] != null)
                    {
                        flightSetFrom = int.Parse(node.Attributes["flightSetFrom"]?.Value);
                    }
                    else
                    {
                        flightSetFrom = -180;
                    }
                } catch (Exception) {
                    flightSetFrom = -180;
                }
                try {
                    if (node.Attributes["flightSetTo"] != null)
                    {
                        flightSetTo = int.Parse(node.Attributes["flightSetTo"]?.Value);
                    }
                    else
                    {
                        flightSetTo = 180;
                    }
                } catch (Exception) {
                    flightSetTo = 180;
                }
                try {
                    if (node.Attributes["refreshFlight"] != null)
                    {
                        refreshFlight = bool.Parse(node.Attributes["refreshFlight"]?.Value);
                    }
                    else
                    {
                        refreshFlight = false;
                    }
                } catch (Exception) {
                    refreshFlight = false;
                }
            }
            else
            {
                flttype = FlightType.None;
            }

            switch (dataSourceType)
            {
            case "CSV":
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                break;

            case "Excel":
                dataFile      = node.Attributes["dataFile"]?.Value;
                excelSheet    = node.Attributes["excelSheet"]?.Value;
                excelRowStart = node.Attributes["excelRowStart"]?.Value;
                excelRowEnd   = node.Attributes["excelRowEnd"]?.Value;
                break;

            case "XML":
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                repeatingElement    = node.Attributes["repeatingElement"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                try {
                    xmlToString = bool.Parse(node.Attributes["xmlToString"]?.Value);
                } catch (Exception) {
                    xmlToString = false;
                }
                break;

            case "JSON":
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                repeatingElement    = node.Attributes["repeatingElement"]?.Value;
                break;

            case "DATABASE":
            case "MSSQL":
            case "MySQL":
            case "ORACLE":
                connStr = node.Attributes["connStr"]?.Value;
                sql     = node.Attributes["sql"]?.Value;
                dbType  = node.Attributes["sourceType"]?.Value;
                break;
            }

            dataSourceFileOrURL = dataSourceFileOrURL ?? "file";

            XmlNode filtersDefn = node.SelectSingleNode("./filter");

            if (filtersDefn != null)
            {
                /*
                 * At the top level, there is only one Expresssion, which it self can be a compound
                 * expression or a single data filter
                 *
                 * When the Expression itself is constucted, it recurssive creates all the Expression o
                 * filters configured under it
                 */

                // Cycle through the expressions types (and, or, not, xor) to see if any exist
                foreach (string eType in Expression.expressionTypes)
                {
                    XmlNode exprDefn = filtersDefn.SelectSingleNode($"./{eType}");
                    if (exprDefn != null)
                    {
                        expression = new Expression(exprDefn);
                    }
                }

                FilterFactory fact = new FilterFactory();
                // Cycle through the data filter types (and, or, not, xor) to see if any exist
                foreach (string fType in Expression.filterTypes)
                {
                    XmlNode filtDefn = filtersDefn.SelectSingleNode($"./{fType}");
                    if (filtDefn != null)
                    {
                        topLevelFilter = fact.GetFilter(filtDefn);
                    }
                }

                try {
                    filterTime = filtersDefn.Attributes["filterTime"]?.Value;
                } catch (Exception) {
                    filterTime = "post";
                }

                if (filterTime == null)
                {
                    filterTime = "post";
                }
            }

            // Add the chained controllers
            foreach (XmlNode chained in node.SelectNodes("./chained"))
            {
                chainedController.Add(new RateDrivenSourceController(chained, chainDepth++, triggersInUse, serverOffset, executionController));
            }
        }
Ejemplo n.º 6
0
 private static void StartClientMode()
 {
     controller = new NgExecutionController(ExecutionControllerType.Client, serverHub: $"http://{server}:{port}/", localStart: localStart);
 }
Ejemplo n.º 7
0
 private static void ExecuteLocal()
 {
     controller = new NgExecutionController(ExecutionControllerType.StandAlone, executeFile: executeFile, reportFile: report, localStart: localStart);
 }
 public TriggerEventDistributor(NgExecutionController executionController)
 {
     this.executionController = executionController;
     instance = this;
 }
        public RateDrivenSourceController(XmlNode node, int chainDepth, List <string> triggersInUse, int serverOffset, NgExecutionController executionController) : base(node, chainDepth, triggersInUse, serverOffset, executionController)
        {
            if (chainDepth > 0)
            {
                isChained = true;
            }
            maxMsgPerMinuteProfile = node.Attributes["maxMsgPerMinuteProfile"]?.Value;

            try {
                var v = node.Attributes["messagesPerMinute"]?.Value;
                messagesPerMinute = (v == null) ? 60.0 : double.Parse(v);
            } catch (Exception) {
                messagesPerMinute = 60.0;
            }
            intervalMessagesPerMinute = messagesPerMinute;

            try {
                interval = 1000 * (60.0 / messagesPerMinute);
            } catch (Exception) {
                interval = 1000 * (60.0);
            }

            try {
                var v = node.Attributes["maxNumMessages"]?.Value;
                maxNumMessages = (v == null) ? -1 : int.Parse(v);
            } catch (Exception) {
                maxNumMessages = -1;
            }

            try {
                var v = node.Attributes["stopOnDataEnd"]?.Value;
                abortOnListEnd = (v != null) && bool.Parse(v);
            } catch (Exception) {
                abortOnListEnd = false;
            }

            try {
                var v = node.Attributes["sequentialFlight"]?.Value;
                sequentialFlight = (v != null) && bool.Parse(v);
            } catch (Exception) {
                sequentialFlight = false;
            }

            try {
                var v = node.Attributes["delay"]?.Value;
                chainDelay = (v == null) ? 0 : int.Parse(v);
            } catch (Exception) {
                chainDelay = 0;
            }

            try {
                var v = node.Attributes["useParentData"]?.Value;
                useParentData = (v != null) && bool.Parse(v);
            } catch (Exception) {
                useParentData = false;
            }

            try {
                var v = node.Attributes["stopOnFlightDataEnd"]?.Value;
                abortOnFlightListEnd = (v != null) && bool.Parse(v);
            } catch (Exception) {
                abortOnFlightListEnd = false;
            }

            try {
                var v = node.Attributes["maxRunTime"]?.Value;
                if (v != null)
                {
                    maxRunTime = int.Parse(v);
                }
                else
                {
                    maxRunTime = -1;
                }
            } catch (Exception) {
                maxRunTime = -1;
            }

            try {
                var v = node.Attributes["deferredStart"]?.Value;
                if (v != null)
                {
                    deferredStart = double.Parse(v);
                }
                else
                {
                    deferredStart = 0.0;
                }
            } catch (Exception) {
                deferredStart = 0.0;
            }

            if (id != null)
            {
                if (triggersInUse.Contains(id))
                {
                    lineInUse = true;
                }
                else
                {
                    lineInUse = false;
                }
            }
            else
            {
                lineInUse = false;
            }
        }
Ejemplo n.º 10
0
        public DataDrivenSourceController(XmlNode node, List <string> triggersInUse, int serverOffset, NgExecutionController nGExecutionController) : base(node, 1, triggersInUse, serverOffset, nGExecutionController)
        {
            this.node          = node;
            this.triggersInUse = triggersInUse;
            this.serverOffset  = serverOffset;

            try {
                var v = node.Attributes["sequentialFlight"]?.Value;
                if (v != null)
                {
                    sequentialFlight = bool.Parse(node.Attributes["sequentialFlight"].Value);
                }
                else
                {
                    sequentialFlight = true;
                }
            } catch (Exception) {
                sequentialFlight = true;
            }

            try {
                var v = node.Attributes["relativeTime"]?.Value;
                if (v != null)
                {
                    relativeTime = bool.Parse(v);
                }
                else
                {
                    relativeTime = false;
                }
            } catch (Exception) {
                relativeTime = false;
            }

            foreach (XmlNode trigger in this.node.SelectNodes("./trigger"))
            {
                string triggerID = trigger.Attributes["id"]?.Value;
                if (triggerID == null)
                {
                    continue;
                }
                if (triggersInUse.Contains(triggerID))
                {
                    lineInUse = true;
                }
            }

            if (node.Name == "csvdatadriven")
            {
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                timeElement         = node.Attributes["timeElement"]?.Value;
                timeElementFormat   = node.Attributes["timeElementFormat"]?.Value;
            }
            if (node.Name == "exceldatadriven")
            {
                dataFile          = node.Attributes["dataFile"]?.Value;
                excelSheet        = node.Attributes["excelSheet"]?.Value;
                excelRowStart     = node.Attributes["excelRowStart"]?.Value;
                excelRowEnd       = node.Attributes["excelRowEnd"]?.Value;
                timeElement       = node.Attributes["timeElement"]?.Value;
                timeElementFormat = node.Attributes["timeElementFormat"]?.Value;
            }
            if (node.Name == "xmldatadriven")
            {
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                repeatingElement    = node.Attributes["repeatingElement"]?.Value;
                timeElement         = node.Attributes["timeElement"]?.Value;
                timeElementFormat   = node.Attributes["timeElementFormat"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                try {
                    xmlToString = bool.Parse(node.Attributes["xmlToString"]?.Value);
                } catch (Exception) {
                    xmlToString = false;
                }
            }
            if (node.Name == "jsondatadriven")
            {
                dataFile            = node.Attributes["dataFile"]?.Value;
                dataRestURL         = node.Attributes["dataRestURL"]?.Value;
                dataSourceFileOrURL = node.Attributes["sourceType"]?.Value;
                repeatingElement    = node.Attributes["repeatingElement"]?.Value;
                timeElement         = node.Attributes["timeElement"]?.Value;
                timeElementFormat   = node.Attributes["timeElementFormat"]?.Value;
            }
            if (node.Name == "databasedatadriven")
            {
                connStr           = node.Attributes["connStr"]?.Value;
                sql               = node.Attributes["sql"]?.Value;
                dbType            = node.Attributes["sourceType"]?.Value;
                timeElement       = node.Attributes["timeElement"]?.Value;
                timeElementFormat = node.Attributes["timeElementFormat"]?.Value;
            }
        }
Ejemplo n.º 11
0
 public ClientHub(NgExecutionController ngExecutionController)
 {
     this.ngExecutionController = ngExecutionController;
     this.localOnly             = true;
 }