public static void AddApiDocs(this IServiceCollection services, IDashboardConfiguration configuration)
        {
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc(configuration.ApiConfiguration.Version, new OpenApiInfo
                {
                    Version        = configuration.ApiConfiguration.Version,
                    Title          = configuration.ApiConfiguration.Name,
                    Description    = "",
                    TermsOfService = new Uri("https://example.com/terms"),
                    Contact        = new OpenApiContact
                    {
                        Name  = "George Theofilis",
                        Email = string.Empty,
                        Url   = new Uri("https://github.com/theofilis"),
                    },
                    License = new OpenApiLicense
                    {
                        Name = "Use under LICX",
                        Url  = new Uri("https://example.com/license"),
                    }
                });

                c.OperationFilter <AuthorizeCheckOperationFilter>();

                c.CustomSchemaIds((type) => type.FullName.Replace("MyHome.", ""));
            });
            services.AddSwaggerGenNewtonsoftSupport();
        }
Example #2
0
 public CachingDashboardConfigurationLoader(ObjectSource objectSource, HttpContext context)
 {
     dashboardConfiguration = context.Cache[DashboardConfigurationKey] as IDashboardConfiguration;
     if (dashboardConfiguration == null)
     {
         dashboardConfiguration = new DashboardConfigurationLoader(new ObjectionNetReflectorInstantiator(objectSource));
         context.Cache.Add(DashboardConfigurationKey, dashboardConfiguration, null, DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, null);
     }
 }
Example #3
0
        /// <summary>
        /// Clears the cached configuration.
        /// </summary>
        public static void ClearCache()
        {
            IDashboardConfiguration config = HttpContext.Current.Cache[DashboardConfigurationKey] as IDashboardConfiguration;

            if (config != null)
            {
                HttpContext.Current.Cache.Remove(DashboardConfigurationKey);
            }
        }
		public CachingDashboardConfigurationLoader(ObjectSource objectSource, HttpContext context)
		{
			dashboardConfiguration = context.Cache[DashboardConfigurationKey] as IDashboardConfiguration;
			if (dashboardConfiguration == null)
			{
				dashboardConfiguration = new DashboardConfigurationLoader(new ObjectionNetReflectorInstantiator(objectSource));
				context.Cache.Add(DashboardConfigurationKey, dashboardConfiguration, null, DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, null);
			}
		}
 public LoginViewBuilder(ICruiseRequest request, ILinkFactory linkFactory,
                         IVelocityViewGenerator velocityViewGenerator, IDashboardConfiguration configuration,
                         ISessionRetriever retriever, ISessionStorer storer)
 {
     this.request               = request;
     this.linkFactory           = linkFactory;
     this.velocityViewGenerator = velocityViewGenerator;
     this.configuration         = configuration;
     this.storer = storer;
 }
 public LoginViewBuilder(ICruiseRequest request, ILinkFactory linkFactory, 
     IVelocityViewGenerator velocityViewGenerator, IDashboardConfiguration configuration,
     ISessionStorer storer)
 {
     this.request = request;
     this.linkFactory = linkFactory;
     this.velocityViewGenerator = velocityViewGenerator;
     this.configuration = configuration;
     this.storer = storer;
 }
        public LoginViewBuilder(ICruiseRequest request, ILinkFactory linkFactory, 
            IVelocityViewGenerator velocityViewGenerator, IDashboardConfiguration configuration,
            ISessionRetriever retriever)
        {
            this.request = request;
            this.linkFactory = linkFactory;
            this.velocityViewGenerator = velocityViewGenerator;
            this.configuration = configuration;
            this.retriever = retriever;

            this.BuildServerName = request.ServerName;
            this.ProjectName = request.ProjectName;
        }
Example #8
0
        public LoginViewBuilder(ICruiseRequest request, ILinkFactory linkFactory,
                                IVelocityViewGenerator velocityViewGenerator, IDashboardConfiguration configuration,
                                ISessionRetriever retriever)
        {
            this.request               = request;
            this.linkFactory           = linkFactory;
            this.velocityViewGenerator = velocityViewGenerator;
            this.configuration         = configuration;
            this.retriever             = retriever;

            this.BuildServerName = request.ServerName;
            this.ProjectName     = request.ProjectName;
        }
Example #9
0
        public NLogger(IDashboardConfiguration configuration)
        {
            var logPath = configuration.KeyValueStore["logs"];

            var logConfig = new LoggingConfiguration();

            var target = new FileTarget
            {
                FileName         = Path.Combine(logPath, "log.txt"),
                Layout           = @"${time} [${uppercase:${level}}] ${message} ${exception:format=ToString,StackTrace}",
                ArchiveAboveSize = 1024 * 1024 * 2,
                ArchiveNumbering = ArchiveNumberingMode.Sequence
            };

            logConfig.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Info, target));
            LogManager.Configuration = logConfig;

            _logger = LogManager.GetLogger(configuration.ApplicationName);
        }
        public DashboardViewModel(IDashboardConfiguration config, IEntityService <IPrice> priceService, IEntityService <IStrategy> strategyService)
        {
            var dummyCommand = ReactiveCommand.Create(() => { });

            AvailableDates = new ReactiveList <DateTime>(Enumerable.Range(0, 5).Select(offset => DateTime.Now.AddDays(-offset)));
            SelectedDate   = AvailableDates.First();

            DashboardMenu.Add(new StaticItemDescriptor(String.Format("{0} - {1}", config.ApplicationName, config.Version)));

            _widgetMenu = CreateWidgetMenu();

            DashboardMenu.Add(_widgetMenu);

            this.WhenAnyValue(vm => vm.CurrentWorkspace)
            .Where(val => null != val)
            .Subscribe(obs =>
            {
                _widgetMenu.GetChildrenMenuItems((item => item.GetType() == typeof(WidgetButtonItemDescriptor))).ForEach(item =>
                {
                    item.IsEnabled = ((item as WidgetButtonItemDescriptor).Widget as WorkspaceAwareWidgetAttribute).IsVisible(obs.State);
                });
            });
        }
 public DefaultCacheStrategy(IDashboardConfiguration configuration)
 {
     _persistantCache = new DefaultPersistantCache <TObject>(configuration.ApplicationName);
     _memoryCache     = new DefaultMemoryCache <TObject>(configuration.ApplicationName);
 }
        // This all needs breaking up a bit (to make it testable, apart from anything else)
        public ObjectSource SetupObjectSourceForRequest(HttpContext context)
        {
            ObjectSource objectSource = (ObjectSource)objectionManager; // Yuch - put this in Object Wizard somewhere

            objectionManager.AddInstanceForType(typeof(ObjectSource), objectionManager);

            objectionManager.AddInstanceForType(typeof(HttpContext), context);
            HttpRequest request = context.Request;

            objectionManager.AddInstanceForType(typeof(HttpRequest), request);

            NameValueCollection parametersCollection = new NameValueCollection();

            parametersCollection.Add(request.QueryString);
            parametersCollection.Add(request.Form);
            objectionManager.AddInstanceForType(typeof(IRequest),
                                                new NameValueCollectionRequest(parametersCollection, request.Headers, request.Path,
                                                                               request.RawUrl, request.ApplicationPath));

            DefaultUrlBuilder urlBuilder = new DefaultUrlBuilder();

            objectionManager.AddInstanceForType(typeof(IUrlBuilder),
                                                new AbsolutePathUrlBuilderDecorator(
                                                    urlBuilder,
                                                    request.ApplicationPath));

            objectionManager.SetImplementationType(typeof(ICruiseRequest), typeof(RequestWrappingCruiseRequest));

            objectionManager.SetImplementationType(typeof(IMultiTransformer), typeof(PathMappingMultiTransformer));

            objectionManager.SetDependencyImplementationForType(typeof(PathMappingMultiTransformer), typeof(IMultiTransformer), typeof(HtmlAwareMultiTransformer));

            IDashboardConfiguration config = GetDashboardConfiguration(objectSource, context);

            objectionManager.AddInstanceForType(typeof(IDashboardConfiguration), config);

            IRemoteServicesConfiguration remoteServicesConfig = config.RemoteServices;

            objectionManager.AddInstanceForType(typeof(IRemoteServicesConfiguration), remoteServicesConfig);

            IPluginConfiguration pluginConfig = config.PluginConfiguration;

            objectionManager.AddInstanceForType(typeof(IPluginConfiguration), pluginConfig);

            ISessionRetriever sessionRetriever = pluginConfig.SessionStore.RetrieveRetriever();

            objectionManager.AddInstanceForType(typeof(ISessionRetriever), sessionRetriever);

            ISessionStorer sessionStorer = pluginConfig.SessionStore.RetrieveStorer();

            objectionManager.AddInstanceForType(typeof(ISessionStorer), sessionStorer);
            urlBuilder.SessionStorer = sessionStorer;


            System.Collections.Generic.List <string> LoadedPlugins = new System.Collections.Generic.List <string>();
            bool UnknownPluginDetected = false;

            foreach (IPlugin plugin in pluginConfig.FarmPlugins)
            {
                if (plugin == null)
                {
                    UnknownPluginDetected = true;
                }
                else
                {
                    LoadedPlugins.Add(plugin.LinkDescription);

                    foreach (INamedAction action in plugin.NamedActions)
                    {
                        if ((action as INoSiteTemplateAction) == null)
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator)).Decorate(typeof(QuerySessionActionDecorator)).Decorate(typeof(NoCacheabilityActionProxy));
                        }
                        else
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(QuerySessionActionDecorator)).Decorate(typeof(NoCacheabilityActionProxy));
                        }
                    }
                }
            }


            if (UnknownPluginDetected)
            {
                ThrowExceptionShouwingLoadedPlugins(LoadedPlugins, "FarmPlugins");
            }
            LoadedPlugins = new System.Collections.Generic.List <string>();

            foreach (IPlugin plugin in pluginConfig.ServerPlugins)
            {
                if (plugin == null)
                {
                    UnknownPluginDetected = true;
                }
                else
                {
                    LoadedPlugins.Add(plugin.LinkDescription);
                    foreach (INamedAction action in plugin.NamedActions)
                    {
                        if ((action as INoSiteTemplateAction) == null)
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator)).Decorate(typeof(QuerySessionActionDecorator)).Decorate(typeof(NoCacheabilityActionProxy));
                        }
                        else
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(QuerySessionActionDecorator)).Decorate(typeof(NoCacheabilityActionProxy));
                        }
                    }
                }
            }

            if (UnknownPluginDetected)
            {
                ThrowExceptionShouwingLoadedPlugins(LoadedPlugins, "ServerPlugins");
            }
            LoadedPlugins = new System.Collections.Generic.List <string>();


            foreach (IPlugin plugin in pluginConfig.ProjectPlugins)
            {
                if (plugin == null)
                {
                    UnknownPluginDetected = true;
                }
                else
                {
                    LoadedPlugins.Add(plugin.LinkDescription);
                    foreach (INamedAction action in plugin.NamedActions)
                    {
                        if ((action as INoSiteTemplateAction) == null)
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator)).Decorate(typeof(QuerySessionActionDecorator));
                        }
                        else
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(QuerySessionActionDecorator));
                        }
                    }
                }
            }

            if (UnknownPluginDetected)
            {
                ThrowExceptionShouwingLoadedPlugins(LoadedPlugins, "ProjectPlugins");
            }


            // Even if the user hasn't specified to use this plugin, we still need it registered since there are links to it elsewhere
            try
            {
                objectSource.GetByName(LatestBuildReportProjectPlugin.ACTION_NAME.ToLowerInvariant());
            }
            catch (ApplicationException)
            {
                IPlugin latestBuildPlugin = (IPlugin)objectSource.GetByType(typeof(LatestBuildReportProjectPlugin));
                objectionManager.AddInstanceForName(latestBuildPlugin.NamedActions[0].ActionName.ToLowerInvariant(), latestBuildPlugin.NamedActions[0].Action)
                .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator)).Decorate(typeof(QuerySessionActionDecorator));
            }


            LoadedPlugins = new System.Collections.Generic.List <string>();

            foreach (IBuildPlugin plugin in pluginConfig.BuildPlugins)
            {
                if (plugin == null)
                {
                    UnknownPluginDetected = true;
                }
                else
                {
                    LoadedPlugins.Add(plugin.LinkDescription);
                    foreach (INamedAction action in plugin.NamedActions)
                    {
                        if ((action as INoSiteTemplateAction) == null)
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant() + "_CONDITIONAL_GET_FINGERPRINT_CHAIN", action.Action)
                            .Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(SiteTemplateActionDecorator))
                            .Decorate(typeof(QuerySessionActionDecorator));
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(BuildCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction))
                            .Decorate(typeof(CachingActionProxy)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator))
                            .Decorate(typeof(QuerySessionActionDecorator));
                        }
                        else
                        {
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant() + "_CONDITIONAL_GET_FINGERPRINT_CHAIN", action.Action)
                            .Decorate(typeof(CruiseActionProxyAction))
                            .Decorate(typeof(QuerySessionActionDecorator));
                            objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(BuildCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction))
                            .Decorate(typeof(CachingActionProxy)).Decorate(typeof(ExceptionCatchingActionProxy))
                            .Decorate(typeof(QuerySessionActionDecorator));
                        }
                    }
                }
            }

            if (UnknownPluginDetected)
            {
                ThrowExceptionShouwingLoadedPlugins(LoadedPlugins, "BuildPlugins");
            }
            LoadedPlugins = new System.Collections.Generic.List <string>();

            // Security plugins (for handling authentication)
            foreach (ISecurityPlugin plugin in pluginConfig.SecurityPlugins)
            {
                plugin.SessionStorer = sessionStorer;
                foreach (INamedAction action in plugin.NamedActions)
                {
                    if ((action as INoSiteTemplateAction) == null)
                    {
                        objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                        .Decorate(typeof(ServerCheckingProxyAction))
                        .Decorate(typeof(CruiseActionProxyAction))
                        .Decorate(typeof(ExceptionCatchingActionProxy))
                        .Decorate(typeof(SiteTemplateActionDecorator))
                        .Decorate(typeof(QuerySessionActionDecorator))
                        .Decorate(typeof(NoCacheabilityActionProxy));
                    }
                    else
                    {
                        objectionManager.AddInstanceForName(action.ActionName.ToLowerInvariant(), action.Action)
                        .Decorate(typeof(ServerCheckingProxyAction))
                        .Decorate(typeof(CruiseActionProxyAction))
                        .Decorate(typeof(ExceptionCatchingActionProxy))
                        .Decorate(typeof(QuerySessionActionDecorator))
                        .Decorate(typeof(NoCacheabilityActionProxy));
                    }
                }
            }

            if (UnknownPluginDetected)
            {
                ThrowExceptionShouwingLoadedPlugins(LoadedPlugins, "SecurityPlugins");
            }

            AddRequiredSecurityAction(LogoutSecurityAction.ActionName.ToLowerInvariant(), typeof(LogoutSecurityAction));
            AddRequiredSecurityAction(ChangePasswordSecurityAction.ActionName.ToLowerInvariant(), typeof(ChangePasswordSecurityAction));

            // ToDo - make this kind of thing specifiable by Plugins (note that this action is not wrapped with a SiteTemplateActionDecorator
            // See BuildLogBuildPlugin for linked todo
            objectionManager.AddTypeForName(XmlBuildLogAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlBuildLogAction))
            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(BuildCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction));

            // TODO - Xml Exceptions?
            objectionManager.AddTypeForName(ForceBuildXmlAction.ACTION_NAME.ToLowerInvariant(), typeof(ForceBuildXmlAction))
            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction));

            // Supporting xml project status queries from CCTray or clients earlier than version 1.3
            // Also still used by the web dashboard for displaying farm/server reports
            objectionManager.AddTypeForName(XmlReportAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlReportAction));
            objectionManager.AddTypeForName(ProjectXmlReport.ActionName.ToLowerInvariant(), typeof(ProjectXmlReport)).Decorate(typeof(CruiseActionProxyAction));

            // Supporting cruise server project and queue status queries from CCTray or clients 1.3 or later
            objectionManager.AddTypeForName(XmlServerReportAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlServerReportAction));

            // Security handler for CCTray or client 1.5 or later
            objectionManager.AddTypeForName(XmlServerSecurityAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlServerSecurityAction));

            // RSS publisher
            objectionManager.AddTypeForName(Plugins.RSS.RSSFeed.ACTION_NAME.ToLowerInvariant(), typeof(Plugins.RSS.RSSFeed)).Decorate(typeof(CruiseActionProxyAction));

            // Status data
            objectionManager.AddTypeForName(ProjectStatusAction.ActionName.ToLowerInvariant(), typeof(ProjectStatusAction))
            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction));

            // File downloads
            objectionManager.AddTypeForName(ProjectFileDownload.ActionName.ToLowerInvariant(), typeof(ProjectFileDownload)).Decorate(typeof(CruiseActionProxyAction));
            objectionManager.AddTypeForName(BuildFileDownload.ActionName.ToLowerInvariant(), typeof(BuildFileDownload)).Decorate(typeof(CruiseActionProxyAction));

            // Parameters handler for CCTray or client 1.5 or later
            objectionManager.AddInstanceForName(XmlProjectParametersReportAction.ACTION_NAME.ToLowerInvariant(),
                                                objectSource.GetByType(typeof(XmlProjectParametersReportAction)));

            // Raw XML request handler
            objectionManager.AddTypeForName(MessageHandlerPlugin.ActionName.ToLowerInvariant(),
                                            typeof(MessageHandlerPlugin)).Decorate(typeof(CruiseActionProxyAction));

            return(objectSource);
        }
Example #13
0
        // This all needs breaking up a bit (to make it testable, apart from anything else)
        public ObjectGiver SetupObjectGiverForRequest(HttpContext context)
        {
            ObjectGiver giver = (ObjectGiver)giverManager;              // Yuch - put this in Object Wizard somewhere

            giverManager.AddTypedInstance(typeof(ObjectGiver), giverManager);

            giverManager.AddTypedInstance(typeof(HttpContext), context);
            HttpRequest request = context.Request;

            giverManager.AddTypedInstance(typeof(HttpRequest), request);

            // Add functionality to object giver to handle this?
            giverManager.AddTypedInstance(typeof(IRequest), new AggregatedRequest(new NameValueCollectionRequest(request.Form), new NameValueCollectionRequest(request.QueryString)));

            giverManager.SetImplementationType(typeof(IUrlBuilder), typeof(DefaultUrlBuilder));
            giverManager.SetImplementationType(typeof(IMultiTransformer), typeof(PathMappingMultiTransformer));

            giverManager.SetDependencyImplementationForType(typeof(PathMappingMultiTransformer), typeof(IMultiTransformer), typeof(HtmlAwareMultiTransformer));

            IDashboardConfiguration config = (IDashboardConfiguration)giver.GiveObjectByType(typeof(IDashboardConfiguration));

            giverManager.AddTypedInstance(typeof(IDashboardConfiguration), config);

            IRemoteServicesConfiguration remoteServicesConfig = config.RemoteServices;

            giverManager.AddTypedInstance(typeof(IRemoteServicesConfiguration), remoteServicesConfig);

            IPluginConfiguration pluginConfig = config.PluginConfiguration;

            giverManager.AddTypedInstance(typeof(IPluginConfiguration), pluginConfig);

            // Need to get these into plugin setup
            // These plugins are currently disabled - this code will be required again when they are needed
//			giverAndRegistrar.SetDependencyImplementationForIdentifer(SaveNewProjectAction.ACTION_NAME, typeof(IPathMapper), typeof(PathMapperUsingHostName));
//			giverAndRegistrar.SetDependencyImplementationForIdentifer(SaveEditProjectAction.ACTION_NAME, typeof(IPathMapper), typeof(PathMapperUsingHostName));

            // ToDo - Refactor these plugin sections

            foreach (IPlugin plugin in pluginConfig.FarmPlugins)
            {
                foreach (INamedAction action in plugin.NamedActions)
                {
                    giverManager.CreateInstanceMapping(action.ActionName, action.Action)
                    .Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator));
                }
            }

            foreach (IPlugin plugin in pluginConfig.ServerPlugins)
            {
                foreach (INamedAction action in plugin.NamedActions)
                {
                    giverManager.CreateInstanceMapping(action.ActionName, action.Action)
                    .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator));
                }
            }

            foreach (IPlugin plugin in pluginConfig.ProjectPlugins)
            {
                foreach (INamedAction action in plugin.NamedActions)
                {
                    giverManager.CreateInstanceMapping(action.ActionName, action.Action)
                    .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator));
                }
            }

            // Even if the user hasn't specified to use this plugin, we still need it registered since there are links to it elsewhere
            try
            {
                giver.GiveObjectById(LatestBuildReportProjectPlugin.ACTION_NAME);
            }
            catch (ApplicationException)
            {
                IPlugin latestBuildPlugin = (IPlugin)giver.GiveObjectByType(typeof(LatestBuildReportProjectPlugin));
                giverManager.CreateInstanceMapping(latestBuildPlugin.NamedActions[0].ActionName, latestBuildPlugin.NamedActions[0].Action)
                .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator));
            }

            foreach (IPlugin plugin in pluginConfig.BuildPlugins)
            {
                foreach (INamedAction action in plugin.NamedActions)
                {
                    giverManager.CreateInstanceMapping(action.ActionName, action.Action)
                    .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(BuildCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction)).Decorate(typeof(ExceptionCatchingActionProxy)).Decorate(typeof(SiteTemplateActionDecorator));
                }
            }

            // ToDo - make this kind of thing specifiable by Plugins (note that this action is not wrapped with a SiteTemplateActionDecorator
            // See BuildLogBuildPlugin for linked todo
            giverManager.CreateImplementationMapping(XmlBuildLogAction.ACTION_NAME, typeof(XmlBuildLogAction))
            .Decorate(typeof(ServerCheckingProxyAction)).Decorate(typeof(BuildCheckingProxyAction)).Decorate(typeof(ProjectCheckingProxyAction)).Decorate(typeof(CruiseActionProxyAction));

            return(giver);
        }
Example #14
0
 public ReactiveSettingsStorageProxy(IDashboardConfiguration configuration)
     : base(configuration)
 {
 }
 public LazilyInitialisingVelocityTransformer(IPhysicalApplicationPathProvider physicalApplicationPathProvider, IDashboardConfiguration configuration)
 {
     this.physicalApplicationPathProvider = physicalApplicationPathProvider;
     this.configuration = configuration;
 }
Example #16
0
 public LazilyInitialisingVelocityTransformer(IPhysicalApplicationPathProvider physicalApplicationPathProvider, IDashboardConfiguration configuration)
 {
     this.physicalApplicationPathProvider = physicalApplicationPathProvider;
     this.configuration = configuration;
 }
Example #17
0
 public ReactiveSettingsStorage(IDashboardConfiguration configuration)
 {
     BlobCache.ApplicationName = configuration.ApplicationName;
     _blobCache = AppCore.Instance.Get <IBlobCache>();
 }
Example #18
0
        public void SetupObjectSourceForFirstRequest(HttpContext context)
        {
            _objectionManager.AddInstanceForType(typeof(ObjectSource), _objectionManager);

            ObjectSource objectSource = UpdateObjectSourceForRequest(context);

            DefaultUrlBuilder urlBuilder = new DefaultUrlBuilder();

            _objectionManager.AddInstanceForType(typeof(IUrlBuilder),
                                                 new AbsolutePathUrlBuilderDecorator(
                                                     urlBuilder,
                                                     context.Request.ApplicationPath));

            _objectionManager.SetImplementationType(typeof(ICruiseRequest), typeof(RequestWrappingCruiseRequest));

            _objectionManager.SetImplementationType(typeof(IMultiTransformer), typeof(PathMappingMultiTransformer));

            _objectionManager.SetDependencyImplementationForType(typeof(PathMappingMultiTransformer), typeof(IMultiTransformer), typeof(HtmlAwareMultiTransformer));

            IDashboardConfiguration config = GetDashboardConfiguration(objectSource, context);

            _objectionManager.AddInstanceForType(typeof(IDashboardConfiguration), config);

            IRemoteServicesConfiguration remoteServicesConfig = config.RemoteServices;

            _objectionManager.AddInstanceForType(typeof(IRemoteServicesConfiguration), remoteServicesConfig);

            IPluginConfiguration pluginConfig = config.PluginConfiguration;

            _objectionManager.AddInstanceForType(typeof(IPluginConfiguration), pluginConfig);

            ISessionRetriever sessionRetriever = pluginConfig.SessionStore.RetrieveRetriever();

            _objectionManager.AddInstanceForType(typeof(ISessionRetriever), sessionRetriever);

            ISessionStorer sessionStorer = pluginConfig.SessionStore.RetrieveStorer();

            _objectionManager.AddInstanceForType(typeof(ISessionStorer), sessionStorer);

            LoadFarmPlugins(pluginConfig);
            LoadServerPlugins(pluginConfig);
            LoadProjectPlugins(pluginConfig);

            // Even if the user hasn't specified to use this plugin, we still need it registered since there are links to it elsewhere
            try
            {
                objectSource.GetByName(LatestBuildReportProjectPlugin.ACTION_NAME.ToLowerInvariant());
            }
            catch (ApplicationException)
            {
                IPlugin latestBuildPlugin = (IPlugin)objectSource.GetByType(typeof(LatestBuildReportProjectPlugin));
                AddActionInstance(latestBuildPlugin.NamedActions[0])
                .Decorate(typeof(ServerCheckingProxyAction))
                .Decorate(typeof(ProjectCheckingProxyAction))
                .Decorate(typeof(CruiseActionProxyAction))
                .Decorate(typeof(ExceptionCatchingActionProxy))
                .Decorate(typeof(SiteTemplateActionDecorator));
            }

            LoadBuildPlugins(pluginConfig);
            LoadSecurityPlugins(pluginConfig, sessionStorer);

            AddRequiredSecurityAction(LogoutSecurityAction.ActionName.ToLowerInvariant(), typeof(LogoutSecurityAction));
            AddRequiredSecurityAction(ChangePasswordSecurityAction.ActionName.ToLowerInvariant(), typeof(ChangePasswordSecurityAction));

            // ToDo - make this kind of thing specifiable by Plugins (note that this action is not wrapped with a SiteTemplateActionDecorator
            // See BuildLogBuildPlugin for linked todo
            _objectionManager.AddTypeForName(XmlBuildLogAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlBuildLogAction))
            .Decorate(typeof(ServerCheckingProxyAction))
            .Decorate(typeof(BuildCheckingProxyAction))
            .Decorate(typeof(ProjectCheckingProxyAction))
            .Decorate(typeof(CruiseActionProxyAction));

            // TODO - Xml Exceptions?
            _objectionManager.AddTypeForName(ForceBuildXmlAction.ACTION_NAME.ToLowerInvariant(), typeof(ForceBuildXmlAction))
            .Decorate(typeof(ServerCheckingProxyAction))
            .Decorate(typeof(ProjectCheckingProxyAction))
            .Decorate(typeof(CruiseActionProxyAction));

            // Supporting xml project status queries from CCTray or clients earlier than version 1.3
            // Also still used by the web dashboard for displaying farm/server reports
            _objectionManager.AddTypeForName(XmlReportAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlReportAction));
            _objectionManager.AddTypeForName(ProjectXmlReport.ActionName.ToLowerInvariant(), typeof(ProjectXmlReport))
            .Decorate(typeof(CruiseActionProxyAction));

            // Supporting cruise server project and queue status queries from CCTray or clients 1.3 or later
            _objectionManager.AddTypeForName(XmlServerReportAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlServerReportAction));

            // Security handler for CCTray or client 1.5 or later
            _objectionManager.AddTypeForName(XmlServerSecurityAction.ACTION_NAME.ToLowerInvariant(), typeof(XmlServerSecurityAction));

            // RSS publisher
            _objectionManager.AddTypeForName(Plugins.RSS.RSSFeed.ACTION_NAME.ToLowerInvariant(), typeof(Plugins.RSS.RSSFeed))
            .Decorate(typeof(CruiseActionProxyAction));

            // Status data
            _objectionManager.AddTypeForName(ProjectStatusAction.ActionName.ToLowerInvariant(), typeof(ProjectStatusAction))
            .Decorate(typeof(ServerCheckingProxyAction))
            .Decorate(typeof(ProjectCheckingProxyAction))
            .Decorate(typeof(CruiseActionProxyAction));

            // File downloads
            _objectionManager.AddTypeForName(ProjectFileDownload.ActionName.ToLowerInvariant(), typeof(ProjectFileDownload))
            .Decorate(typeof(CruiseActionProxyAction));
            _objectionManager.AddTypeForName(BuildFileDownload.ActionName.ToLowerInvariant(), typeof(BuildFileDownload))
            .Decorate(typeof(CruiseActionProxyAction));

            // Parameters handler for CCTray or client 1.5 or later
            _objectionManager.AddInstanceForName(XmlProjectParametersReportAction.ACTION_NAME.ToLowerInvariant(),
                                                 objectSource.GetByType(typeof(XmlProjectParametersReportAction)));

            // Raw XML request handler
            _objectionManager.AddTypeForName(MessageHandlerPlugin.ActionName.ToLowerInvariant(), typeof(MessageHandlerPlugin))
            .Decorate(typeof(CruiseActionProxyAction));
        }