Exemple #1
0
        protected void Application_Start()
        {
#if DEBUG
            DyntaxaLogger.WriteMessage("Web application started");
#endif
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);

            RegisterRoutes(RouteTable.Routes);
            // MK 2015-10-12 County map isn't used?
            //String path = Server.MapPath("~/Images/Maps/Sverigekarta med län.shp");
            //CountyOccurrenceMap.InitializeMap(path);

            Configuration.SetInstallationType();
            CoreData.CountryManager     = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager      = new LocaleManagerMultiThreadCache();
            CoreData.ReferenceManager   = new ReferenceManagerMultiThreadCache();
            CoreData.TaxonManager       = new TaxonManagerMultiThreadCache();
            CoreData.UserManager        = new UserManagerMultiThreadCache();
            CoreData.SpeciesFactManager = new SpeciesFactManagerMultiThreadCache();

            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            PesiNameDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();

            CoreData.UserManager.LoginApplicationUser();
            CoreData.UserManager.LoginApplicationTransactionUser();
            ScheduledTasksManager.AddTasks();
        }
        private ReferenceDataSource GetReferenceDataSource(Boolean refresh = false)
        {
            if (_referenceDataSource.IsNull() || refresh)
            {
                _referenceDataSource = new ReferenceDataSource();
            }

            return(_referenceDataSource);
        }
Exemple #3
0
        public void TestInitialize()
        {
            Configuration.SetInstallationType();
            //Configuration.InstallationType = InstallationType.Production;

            CoreData.CountryManager            = new CountryManagerSingleThreadCache();
            CoreData.LocaleManager             = new LocaleManagerSingleThreadCache();
            CoreData.UserManager               = new UserManagerSingleThreadCache();
            CoreData.OrganizationManager       = new OrganizationManager();
            CoreData.ApplicationManager        = new ApplicationManager();
            CoreData.ReferenceManager          = new ReferenceManagerSingleThreadCache();
            CoreData.RegionManager             = new RegionManager(GetCoordinateSystem());
            CoreData.TaxonManager              = new TaxonManagerSingleThreadCache();
            CoreData.SpeciesObservationManager = new SpeciesObservationManagerSingleThreadCache();
            CoreData.AnalysisManager           = new AnalysisManager();

            UserDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            PictureDataSource.SetDataSource();

            bool loginSuccess;

            // Added try catch due to problems with Moneses-Dev loosing connection.
            try
            {
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }
            catch (TimeoutException)
            {
                Thread.Sleep(20000);
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }

            if (!loginSuccess)
            {
                throw new ArgumentException("UserManager login failed.");
            }
        }
 public ReferenceDataSourceTest()
 {
     _referenceDataSource = null;
 }
Exemple #5
0
        protected void Application_Start()
        {
#if DEBUG
            Logger.WriteMessage("Web application started");
#endif
            Configuration.SetInstallationType();
            ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            ModelBinders.Binders.Add(typeof(double), new DoubleModelBinder());
            SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            String path = Server.MapPath("~/App_Data/Map/Sverigekarta med län.geojson");
            ArtDatabanken.WebApplication.AnalysisPortal.IO.MapImage.InitializeMap(path);
            SpeciesObservationPointMap.InitializeMap(path);

            IFilterProvider[] providers = FilterProviders.Providers.ToArray();
            FilterProviders.Providers.Clear();
            FilterProviders.Providers.Add(new ExcludeFilterProvider(providers));

            CoreData.CountryManager  = new CountryManagerMultiThreadCache();
            CoreData.LocaleManager   = new LocaleManagerMultiThreadCache();
            CoreData.TaxonManager    = new TaxonManagerMultiThreadCache();
            CoreData.UserManager     = new UserManagerMultiThreadCache();
            CoreData.RegionManager   = new RegionManagerMultiThreadCache(new CoordinateSystem());
            CoreData.MetadataManager = new MetadataManagerMultiThreadCache();

            // Get species observation information from Elasticsearch.
            //WebServiceProxy.AnalysisService.WebServiceAddress = @"silurus2-1.artdata.slu.se/AnalysisService/AnalysisService.svc";
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceAddress = @"silurus2-1.artdata.slu.se/SwedishSpeciesObservationService/SwedishSpeciesObservationService.svc";

            // Set datasources
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            SpeciesObservationDataSource.SetDataSource();
            GeoReferenceDataSource.SetDataSource();
            AnalysisDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();
            WebServiceProxy.SwedishSpeciesObservationService.MaxBufferPoolSize = Resources.AppSettings.Default.MaxBufferPoolSize;
            // Local test.
            //WebServiceProxy.SwedishSpeciesObservationService.InternetProtocol = InternetProtocol.Http;
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceAddress = @"localhost:1667/SwedishSpeciesObservationService.svc";
            //WebServiceProxy.SwedishSpeciesObservationService.WebServiceProtocol = WebServiceProtocol.SOAP11;

            // Login application user
            try
            {
                CoreData.UserManager.LoginApplicationUser();
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to login application user", ex);
            }

            // Initialize Red list cache
            try
            {
                CoreData.AnalysisManager.InitAnalysisCache(CoreData.UserManager.GetApplicationContext());
                //TaxonListInformationManager.Instance.InitCache();
                IUserContext cacheUserContext = CoreData.UserManager.GetApplicationContext();
                cacheUserContext.Locale = CoreData.LocaleManager.GetLocale(cacheUserContext, LocaleId.sv_SE);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to initialize cache", ex);
            }

            ScheduledTasksManager.AddTasks();
        }