Exemplo n.º 1
0
        protected void Application_Start()
        {
            XmlConfigurator.Configure();
            AreaRegistration.RegisterAllAreas();
            Log.Info("Starting up Weald");

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

            _container = new WindsorContainer();
            _container.Install(new WealdInstaller());

            var visualSvnServerInfoProvider = _container.Resolve <IProvideVisualSvnServerInfo>();

            RepositoryInfoCacheProvider = _container.Resolve <IProvideRepositoryInfoCache>();

            if (!visualSvnServerInfoProvider.IsVisualSvnServerInstalled)
            {
                Log.ErrorFormat("VisualSVN Server is not installed on this computer, {0}. " +
                                "Weald functionality will not be available", Environment.MachineName);
            }
            else
            {
                RepositoryInfoCacheProvider.UpdateAllRepositoryInfos();

                var updateIntervalValue = string.Empty;
                var updateInterval      = new TimeSpan();

                try
                {
                    var configProvider = _container.Resolve <IProvideWebConfiguration>();
                    if (!string.IsNullOrEmpty(configProvider.GetValue("SvnServerAlias")))
                    {
                        SvnServerHostname = configProvider.GetValue("SvnServerAlias").ToUpperInvariant();
                    }

                    updateIntervalValue = configProvider.GetValue("RepoInfoRefreshInterval");
                    updateInterval      = TimeSpan.Parse(updateIntervalValue);
                }
                catch (Exception e)
                {
                    Log.Error(string.Format("The RepoInfoRefreshInterval value {0} in the Web.config is not valid", updateIntervalValue), e);
                }

                _container.Resolve <IRepeatActions>()
                .StartAction(RepositoryInfoCacheProvider.UpdateAllRepositoryInfos, updateInterval,
                             _tokenSource.Token);
            }

            Log.Info("Finished Weald startup");
        }
Exemplo n.º 2
0
 public ReposController(IProvideRepositoryInfoCache repositoryInfoCacheProvider)
 {
     _repositoryInfoCacheProvider = repositoryInfoCacheProvider;
 }