Example #1
0
        /// <summary>
        /// The main logic for invoking a transformation.  It does not return until a sweep
        /// for new scans is performed across all projects.
        /// </summary>
        /// <param name="concurrentThreads">The number of concurrent scan transformation threads.</param>
        /// <param name="previousStatePath">A folder path where files will be created to store any state
        /// data required to resume operations across program runs.</param>
        /// <param name="ctx"></param>
        /// <param name="outFactory">The factory implementation for making IOutput instances
        /// used for outputting various record types.</param>
        /// <param name="records">The names of the supported record types that will be used by
        /// the IOutputFactory to create the correct output implementation instance.</param>
        /// <param name="token">A cancellation token that can be used to stop processing of data if
        /// the task needs to be interrupted.</param>
        public static void DoTransform(int concurrentThreads, String previousStatePath, String instanceId,
                                       CxRestContext ctx, IOutputFactory outFactory, RecordNames records, CancellationToken token)
        {
            try
            {
                Transformer xform = new Transformer(ctx, token, previousStatePath)
                {
                    ThreadOpts = new ParallelOptions()
                    {
                        CancellationToken      = token,
                        MaxDegreeOfParallelism = concurrentThreads
                    },
                    ProjectInfoOut           = outFactory.newInstance(records.ProjectInfo),
                    SastScanSummaryOut       = outFactory.newInstance(records.SASTScanSummary),
                    SastScanDetailOut        = outFactory.newInstance(records.SASTScanDetail),
                    PolicyViolationDetailOut = outFactory.newInstance(records.PolicyViolations),
                    ScaScanSummaryOut        = outFactory.newInstance(records.SCAScanSummary),
                    ScaScanDetailOut         = outFactory.newInstance(records.SCAScanDetail),
                    InstanceId = instanceId
                };

                xform.ExecuteSweep();
            }
            catch (Exception ex)
            {
                _log.Error("Unhandled exception caught.", ex);
            }
        }
Example #2
0
        /// <summary>
        /// The main logic for invoking a transformation.  It does not return until a sweep
        /// for new scans is performed across all projects.
        /// </summary>
        /// <param name="concurrentThreads">The number of concurrent scan transformation threads.</param>
        /// <param name="previousStatePath">A folder path where files will be created to store any state
        /// data required to resume operations across program runs.</param>
        /// <param name="ctx"></param>
        /// <param name="outFactory">The factory implementation for making IOutput instances
        /// used for outputting various record types.</param>
        /// <param name="records">The names of the supported record types that will be used by
        /// the IOutputFactory to create the correct output implementation instance.</param>
        /// <param name="token">A cancellation token that can be used to stop processing of data if
        /// the task needs to be interrupted.</param>
        public static void DoTransform(int concurrentThreads, String previousStatePath, String instanceId,
                                       CxRestContext ctx, IProjectFilter filter, RecordNames records, CancellationToken token)
        {
            Transformer xform = new Transformer(ctx, token, previousStatePath, filter)
            {
                ThreadOpts = new ParallelOptions()
                {
                    CancellationToken      = token,
                    MaxDegreeOfParallelism = concurrentThreads
                },
                ProjectInfoOut           = Output.RegisterRecord(records.ProjectInfo),
                SastScanSummaryOut       = Output.RegisterRecord(records.SASTScanSummary),
                SastScanDetailOut        = Output.RegisterRecord(records.SASTScanDetail),
                PolicyViolationDetailOut = Output.RegisterRecord(records.PolicyViolations),
                ScaScanSummaryOut        = Output.RegisterRecord(records.SCAScanSummary),
                ScaScanDetailOut         = Output.RegisterRecord(records.SCAScanDetail),
                InstanceId = instanceId
            };

            xform.ExecuteSweep();
        }