private void processSituation(ElaboratedData elaboratedData, DateTime publicationTime, DateTime timeDefault)
        {
            LocationByReference locationByReference = null;
            BasicData           basicData           = elaboratedData.basicData;



            if (basicData.GetType() == typeof(TrafficHeadway))
            {
                TrafficHeadway data = (TrafficHeadway)basicData;
                locationByReference = (LocationByReference)data.pertinentLocation;
            }
            else if (basicData.GetType() == typeof(TrafficFlow))
            {
                TrafficFlow data = (TrafficFlow)basicData;
                locationByReference = (LocationByReference)data.pertinentLocation;
            }
            else if (basicData.GetType() == typeof(TrafficConcentration))
            {
                TrafficConcentration data = (TrafficConcentration)basicData;
                locationByReference = (LocationByReference)data.pertinentLocation;
            }
            else if (basicData.GetType() == typeof(TrafficSpeed))
            {
                TrafficSpeed data = (TrafficSpeed)basicData;
                locationByReference = (LocationByReference)data.pertinentLocation;
            }
            else if (basicData.GetType() == typeof(TravelTimeData))
            {
                TravelTimeData data = (TravelTimeData)basicData;
                locationByReference = (LocationByReference)data.pertinentLocation;
            }
            else
            {
                logWrapper.Warning("basicData instance of -" + basicData.GetType().ToString());
            }

            String linkIdentifier = null;

            if (locationByReference != null)
            {
                linkIdentifier = basicData.GetType().ToString() + locationByReference.predefinedLocationReference.id;

                if (logWrapper.isTrace())
                {
                    logWrapper.Trace("Processing Fused Sensor Only Identifier(" + linkIdentifier + ")");
                }

                FusedSensorOnlyData fusedSensorOnlyData = new FusedSensorOnlyData(linkIdentifier, publicationTime, timeDefault, elaboratedData);
                fusedSensorOnlyDataStore.updateData(fusedSensorOnlyData);
            }
            else
            {
                logWrapper.Error("Failed to Process elaboratedData, " + elaboratedData.ToString());
            }
        }
Example #2
0
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            logWrapper = new LogWrapper("Global");
            logWrapper.Warning("*** Starting DATEXII Toolkit Web Services ***");

            string rootDirectory = ConfigurationManager.AppSettings["rootDirectory"];

            if (!Directory.Exists(rootDirectory))
            {
                Directory.CreateDirectory(rootDirectory);
            }
            DATEXIIUpdateService.GetInstance();
        }
Example #3
0
        public void Set(string key, object value, bool persist, bool flush = false)
        {
            if (!HasKey(key))
            {
                var data = new DBData();
                data.value   = value;
                data.persist = persist;
                if (persist && !persistData.ContainsKey(key))
                {
                    persistData.Add(key, data);
                }
                database.Add(key, data);
            }
            else
            {
                var data = database[key] as DBData;

                if (data.isReadonly)
                {
                    LogWrapper.Warning("[{0}] Cannot override read-only data: {1}", GetType(), key);
                }
                else
                {
                    data.value   = value;
                    data.persist = persist;
                    if (!persist)
                    {
                        persistData.Remove(key);
                    }
                }
            }

            if (flush)
            {
                Flush();
            }
        }