private IEnumerable <Probes.SelectedProbe> GetSelectedProbes()
        {
            SelectedProbe registry = this.CreateSelectedProbe <registry_object>(probe, "registry", FamilyEnumeration.windows, collectRequest);
            SelectedProbe family   = this.CreateSelectedProbe <family_object>(familyProbe, "family", FamilyEnumeration.windows, collectRequest);

            List <SelectedProbe> selectedProbes = new List <SelectedProbe>();

            selectedProbes.Add(registry);
            selectedProbes.Add(family);
            return(selectedProbes);
        }
        /// <summary>
        /// Creates the probe execution with his collect result
        /// </summary>
        /// <param name="probeResult">The probe result.</param>
        /// <param name="probe">The probe.</param>
        /// <param name="session">The session.</param>
        /// <returns></returns>
        private ProbeExecution CreateTheProbeExecution(ProbeResult probeResult, SelectedProbe probe)
        {
            CollectResultFactory collectResultFactory = new CollectResultFactory();

            ProbeExecution executionOfCurrentProbe = collectFactory.CreateAProbeExecution(probeResult, probe.Capability.OvalObject);
            CollectResult  probeExecutionResult    = collectResultFactory.CreateCollectResultForTheProbeExecution(probeResult);

            executionOfCurrentProbe.SystemCharacteristics = probeExecutionResult.SystemCharacteristics;

            return(executionOfCurrentProbe);
        }
        private SelectedProbe CreateSelectedProbe <T>(IProbe probe, string capability, FamilyEnumeration plataform, CollectRequest collectRequest) where T : ObjectType
        {
            SelectedProbe selectedProbe = new SelectedProbe(probe,
                                                            collectRequest.GetObjectTypes(session).OfType <T>(),
                                                            new ProbeCapabilities()
            {
                OvalObject    = capability,
                PlataformName = plataform
            });

            return(selectedProbe);
        }
        /// <summary>
        /// Executes the collect for the one probe.
        /// </summary>
        /// <param name="collectRequest">The request collect.</param>
        /// <param name="probe">The probe.</param>
        /// <param name="collectExecution">the object that represents the execution of a collect</param>
        /// <returns></returns>
        private ProbeExecution ExecuteCollect(IDocumentSession session, SelectedProbe probe, CollectRequest collectRequest, VariablesEvaluated variables,
                                              IEnumerable <StateType> states, ExecutionLogBuilder executionLog)
        {
            ProbeResult probeResult = null;

            executionLog.StartCollectOf(probe.Capability.OvalObject);

            var initialTimeStamp = DateTime.Now;

            this.SetStartInstrumentationLog(executionLog, initialTimeStamp, probe.Capability.OvalObject);

            probeResult = probe.Execute(connectionContext, Target, variables, collectRequest.GetSystemCharacteristics(session), states);

            this.SetEndInstrumentationLog(executionLog, initialTimeStamp, probe.Capability.OvalObject);

            this.MergeExecutionLogs(executionLog, probe, probeResult);
            return(this.CreateTheProbeExecution(probeResult, probe));
        }
示例#5
0
        public IEnumerable <SelectedProbe> GetNotSupportedObjects(IEnumerable <ObjectType> objectTypes, FamilyEnumeration plataform)
        {
            List <SelectedProbe> selectedProbes = new List <SelectedProbe>();

            var objectTypesByComponentString =
                from t in objectTypes
                group t by t.ComponentString into types
                select new { Capability = types.Key, objectsTypes = types };

            foreach (var type in objectTypesByComponentString)
            {
                IProbeCapabilities capability = this.CreateProbeCapability(type.Capability, plataform);
                IProbe             probe      = this.GetProbe(capability);
                if (probe == null)
                {
                    probe = this.probes.First().Value;
                    SelectedProbe selectedProbe = new SelectedProbe(probe, type.objectsTypes, (ProbeCapabilities)capability);
                    selectedProbes.Add(selectedProbe);
                }
            }
            return(selectedProbes);
        }
 /// <summary>
 /// this method makes the combination between probeLogs and contextLog, provided by ExecutionManager.
 /// This process normally occours in the end of collect of a probe.
 /// Because this, in this process is included the End entry in the log.
 /// </summary>
 /// <param name="probe">The probe.</param>
 /// <param name="probeResult">The probe result.</param>
 private void MergeExecutionLogs(ExecutionLogBuilder executionLog, SelectedProbe probe, ProbeResult probeResult)
 {
     executionLog.AddDetailInformation(probeResult.ExecutionLog);
     executionLog.EndCollectOf(probe.Capability.OvalObject);
     probeResult.ExecutionLog = executionLog.BuildExecutionLogs();
 }