public IStatisticsProxy InitializeStatisticsComponent(IApplicationManager appManager) { IStatisticsProxy proxy = StatisticsComponentProxy.Instance; ((AbstractComponentProxy)proxy).InitializeComponentAccessPermissions(appManager); //((IComponentProxy)proxy).Start(); return(proxy); }
public StatsController(IStatisticsProxy statsStorage) { _Proxy = statsStorage; }
public StatsController(IStatisticsProxy statsStorage) { this.proxy = statsStorage; }
public static XmlNode CreateSummaryXmlNode(XmlDocument doc, XmlNode node) { XmlNode createdNode = doc.CreateNode(XmlNodeType.Element, "Creation", null); XmlNode languageDeclarationsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfLanguageDeclarations", null); XmlNode categoryDeclarationsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfCategoryDeclarations", null); XmlNode ruleDeclarationsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfRuleDeclarations", null); XmlNode totalProjectDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfTotalProjectDefinitions", null); XmlNode activeProjectDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfActiveProjectDefinitions", null); XmlNode inactiveProjectDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfInactiveProjectDefinitions", null); XmlNode totalCategoryDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfTotalCategoryDefinitions", null); XmlNode activeCategoryDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfActiveCategoryDefinitions", null); XmlNode inactiveCategoryDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfInactiveCategoryDefinitions", null); XmlNode totalRuleDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfTotalRuleDefinitions", null); XmlNode activeRuleDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfActiveRuleDefinitions", null); XmlNode inactiveRuleDefinitionsNode = doc.CreateNode(XmlNodeType.Element, "NumberOfInactiveRuleDefinitions", null); XmlNode fileCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfFilesSearched", null); XmlNode totalMatchCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfTotalMatches", null); XmlNode infoMatchCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfInfoMatches", null); XmlNode warningMatchCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfWarningMatches", null); XmlNode criticalMatchCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfCriticalMatches", null); XmlNode fatalMatchCountNode = doc.CreateNode(XmlNodeType.Element, "NumberOfFatalMatches", null); IStatisticsProxy statProxy = ProxyHome.Instance.RetrieveStatisticsProxy(OutputKeyKeeper.Instance.AccessKey); // Creation... createdNode.InnerText = statProxy.StartTimeStamp.ToLongDateString() + " - " + statProxy.StartTimeStamp.ToLongTimeString(); // Declarations... languageDeclarationsNode.InnerText = statProxy.ReadCounter(CounterIds.LanguageDeclarations) + ""; categoryDeclarationsNode.InnerText = statProxy.ReadCounter(CounterIds.CategoryDeclarations) + ""; ruleDeclarationsNode.InnerText = statProxy.ReadCounter(CounterIds.RuleDeclarations) + ""; // Project definitions... int totalProjectDefinitions = statProxy.ReadCounter(CounterIds.TotalProjectDefinitions); int activeProjectDefinitions = statProxy.ReadCounter(CounterIds.ActiveProjectDefinitions); totalProjectDefinitionsNode.InnerText = totalProjectDefinitions + ""; activeProjectDefinitionsNode.InnerText = activeProjectDefinitions + ""; inactiveProjectDefinitionsNode.InnerText = totalProjectDefinitions - activeProjectDefinitions + ""; // Category definitions... int totalCategoryDefinitions = statProxy.ReadCounter(CounterIds.TotalCategoryDefinitions); int activeCategoryDefinitions = statProxy.ReadCounter(CounterIds.ActiveCategoryDefinitions); totalCategoryDefinitionsNode.InnerText = totalCategoryDefinitions + ""; activeCategoryDefinitionsNode.InnerText = activeCategoryDefinitions + ""; inactiveCategoryDefinitionsNode.InnerText = totalCategoryDefinitions - activeCategoryDefinitions + ""; // Rule definitions... int totalRuleDefinitions = statProxy.ReadCounter(CounterIds.TotalRuleDefinitions); int activeRuleDefinitions = statProxy.ReadCounter(CounterIds.ActiveRuleDefinitions); totalRuleDefinitionsNode.InnerText = totalRuleDefinitions + ""; activeRuleDefinitionsNode.InnerText = activeRuleDefinitions + ""; inactiveRuleDefinitionsNode.InnerText = totalRuleDefinitions - activeRuleDefinitions + ""; // File searched... fileCountNode.InnerText = statProxy.ReadCounter(CounterIds.Files) + ""; // Matches... int info = statProxy.ReadCounter(CounterIds.InfoMatches); int warning = statProxy.ReadCounter(CounterIds.WarningMatches); int critical = statProxy.ReadCounter(CounterIds.CriticalMatches); int fatal = statProxy.ReadCounter(CounterIds.FatalMatches); infoMatchCountNode.InnerText = info + ""; warningMatchCountNode.InnerText = warning + ""; criticalMatchCountNode.InnerText = critical + ""; fatalMatchCountNode.InnerText = fatal + ""; totalMatchCountNode.InnerText = (info + warning + critical + fatal) + ""; // Adding nodes to the parent summary node... node.AppendChild(createdNode); node.AppendChild(languageDeclarationsNode); node.AppendChild(categoryDeclarationsNode); node.AppendChild(ruleDeclarationsNode); node.AppendChild(totalProjectDefinitionsNode); node.AppendChild(activeProjectDefinitionsNode); node.AppendChild(inactiveProjectDefinitionsNode); node.AppendChild(totalCategoryDefinitionsNode); node.AppendChild(activeCategoryDefinitionsNode); node.AppendChild(inactiveCategoryDefinitionsNode); node.AppendChild(totalRuleDefinitionsNode); node.AppendChild(activeRuleDefinitionsNode); node.AppendChild(inactiveRuleDefinitionsNode); node.AppendChild(fileCountNode); node.AppendChild(totalMatchCountNode); node.AppendChild(infoMatchCountNode); node.AppendChild(warningMatchCountNode); node.AppendChild(criticalMatchCountNode); node.AppendChild(fatalMatchCountNode); return(node); }
public void DefaultConstructor() { // This may NOT throw any exceptions!!! IStatisticsProxy statisticsProxy = StatisticsComponentProxy.Instance; }
public StatsController(IStatisticsProxy statisticsProxy, IStatisticsStorage statisticsStorage) { Proxy = statisticsProxy; Storage = statisticsStorage; }
private void GenerateAllFilesFoundDuringSearch() { IConfigurationProxy cfgProxy = ProxyHome.Instance.RetrieveConfigurationProxy(OutputKeyKeeper.Instance.AccessKey); IStatisticsProxy statProxy = ProxyHome.Instance.RetrieveStatisticsProxy(OutputKeyKeeper.Instance.AccessKey); XmlDocument doc = new XmlDocument(); XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(declaration); var pi = doc.CreateProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"" + Ids.XSLT_DIR + "/" + Ids.FILES_SEARCHED_XSLT_FILE + "\""); doc.AppendChild(pi); // <Projects> // <Project Name="string" Id="guid"> // <RootDirectory Path="string"> // <File Path="string" /> // <File Path="string" /> // <File Path="string" /> // </RootDirectory> // </Project> // </Projects> XmlNode projects = doc.CreateNode(XmlNodeType.Element, "Projects", null); foreach (KeyValuePair <int, IProjectDefinition> pair in cfgProxy.Projects()) { IProjectDefinition projectDefinition = pair.Value; if (!pair.Value.Enabled) { continue; } XmlNode project = doc.CreateNode(XmlNodeType.Element, "Project", null); XmlAttribute nameAttrib = doc.CreateAttribute("Name"); XmlAttribute idAttrib = doc.CreateAttribute("Id"); nameAttrib.Value = projectDefinition.Name; idAttrib.Value = projectDefinition.Id.ToString(); project.Attributes.Append(nameAttrib); project.Attributes.Append(idAttrib); foreach (IRootDirectoryStatistics rootDirectoryStats in statProxy.GetRootDirectoriesFromId(projectDefinition.Id)) { XmlNode rootDir = doc.CreateNode(XmlNodeType.Element, "RootDirectory", null); XmlAttribute dirPath = doc.CreateAttribute("Path"); dirPath.Value = rootDirectoryStats.RootDirectory; rootDir.Attributes.Append(dirPath); foreach (string filename in rootDirectoryStats.Filenames) { XmlNode file = doc.CreateNode(XmlNodeType.Element, "File", null); XmlAttribute filePath = doc.CreateAttribute("Path"); filePath.Value = filename; file.Attributes.Append(filePath); rootDir.AppendChild(file); } project.AppendChild(rootDir); } projects.AppendChild(project); } doc.AppendChild(projects); doc.Save(Path.Combine(OutputRootDir, Ids.OUTPUT_DIR, Ids.FILES_SEARCHED_XML_FILE)); }