Example #1
0
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                Guid eventID = ILogger.GetLogger(LoggerName).LogEvent(Guid.Empty, EventName, InstructionSet.ProcessName, out exceptions);

                if (eventID == Guid.Empty)
                {
                    throw new Exception("Failed to record process event.");
                }

                InstructionSet.InstructionSetContainer[EventName] = eventID;
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                Guid objectID = Guid.Parse(ObjectID);

                InstructionSet.InstructionSetContainer["ObjectID"] = objectID;

                if (!ILogger.GetLogger(LoggerName).SetObjectInfo(objectID, ObjectName, DateTime.Parse(CreationTime), out exceptions))
                {
                    throw new Exception("Failed to record object info.");
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
Example #3
0
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                if (InstructionSet.InstructionSetContainer.ContainsKey(EventName))
                {
                    Guid eventID = (Guid)InstructionSet.InstructionSetContainer[EventName];

                    if (!ILogger.GetLogger(LoggerName).LogEventMetadata(eventID, Metadata, out exceptions))
                    {
                        throw new Exception("Failed to record event metadata.");
                    }
                }
                else
                {
                    throw new Exception("The eventID wasn't present in the InstructionSetContainer.");
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
 public void AddErrors(List <Exception> exceptions)
 {
     if (Exceptions is null)
     {
         Exceptions = new List <Exception>();
     }
     Exceptions.AddRange(exceptions);
 }
Example #5
0
            public void Start()
            {
                Failed    = 0;
                Succeeded = 0;
                Broker.OnNotificationFailed += (notification, exception) =>
                {
                    Failed++;
                    Exceptions.AddRange(exception.InnerExceptions);
                };
                Broker.OnNotificationSucceeded += (notification) => { Succeeded++; };

                Broker.Start();
            }
 private void OnException(object sender, ModelTreeTraverseServiceExceptionEventArgs e)
 {
     if (e.Exception is SPMeta2ModelValidationException)
     {
         Exceptions.Add(e.Exception as SPMeta2ModelValidationException);
         e.Handled = true;
     }
     else if (e.Exception is SPMeta2AggregateException)
     {
         Exceptions.AddRange((e.Exception as SPMeta2AggregateException).InnerExceptions
                             .OfType <SPMeta2ModelValidationException>());
         e.Handled = true;
     }
 }
Example #7
0
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                Guid objectID = Guid.Parse(ObjectID);

                InstructionSet.InstructionSetContainer["ObjectID"] = objectID;
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
Example #8
0
        protected override bool _Run()
        {
            List <Exception> exceptions = new List <Exception>();

            STEM.Sys.Serialization.Dictionary <string, string> fileSizes = new Sys.Serialization.Dictionary <string, string>();
            List <string> filesActioned = new List <string>();

            if (PopulatePostMortemMeta)
            {
                PostMortemMetaData["FilesRequested"] = STEM.Sys.Serializable.Serialize(FileList);
            }

            foreach (string file in FileList)
            {
                if (!File.Exists(file))
                {
                    continue;
                }

                CB_SourcePath      = Path.GetDirectoryName(file);
                CB_ExpandSource    = false;
                CB_FileFilter      = Path.GetFileName(file);
                CB_DirectoryFilter = "*";
                CB_RecurseSource   = false;

                base._Run();

                if (PopulatePostMortemMeta)
                {
                    if (Exceptions.Count == 0)
                    {
                        if (PostMortemMetaData.ContainsKey("FileSize"))
                        {
                            string fs = PostMortemMetaData["FileSize"];

                            fileSizes[file] = fs;
                        }

                        filesActioned.Add(file);
                    }
                }

                if (PostMortemMetaData.ContainsKey("FileSize"))
                {
                    PostMortemMetaData.Remove("FileSize");
                }

                if (PostMortemMetaData.ContainsKey("FilesActioned"))
                {
                    PostMortemMetaData.Remove("FilesActioned");
                }

                exceptions.AddRange(Exceptions);
                Exceptions.Clear();
            }

            if (PopulatePostMortemMeta)
            {
                PostMortemMetaData["FilesActioned"] = STEM.Sys.Serializable.Serialize(filesActioned);
                PostMortemMetaData["FileSizes"]     = STEM.Sys.Serializable.Serialize(fileSizes);
            }

            if (exceptions.Count > 0)
            {
                Exceptions.AddRange(exceptions);
            }

            return(Exceptions.Count == 0);
        }
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                Guid objectID = Guid.Empty;

                if (InstructionSet.InstructionSetContainer.ContainsKey("ObjectID"))
                {
                    objectID = (Guid)InstructionSet.InstructionSetContainer["ObjectID"];
                }

                if (objectID != Guid.Empty && UpdateObjectName)
                {
                    if (!ILogger.GetLogger(LoggerName).SetObjectInfo(objectID, ObjectName, out exceptions))
                    {
                        throw new Exception("Failed to record object info.");
                    }
                }

                if (objectID == Guid.Empty && GenerateObjectID)
                {
                    objectID = Guid.NewGuid();
                    if (!ILogger.GetLogger(LoggerName).SetObjectInfo(objectID, ObjectName, out exceptions))
                    {
                        throw new Exception("Failed to record object info.");
                    }

                    InstructionSet.InstructionSetContainer["ObjectID"] = objectID;
                }

                Guid eventID = Guid.Empty;

                if (objectID == Guid.Empty)
                {
                    eventID = ILogger.GetLogger(LoggerName).LogEvent(ObjectName, EventName, InstructionSet.ProcessName, out exceptions);
                }
                else
                {
                    eventID = ILogger.GetLogger(LoggerName).LogEvent(objectID, EventName, InstructionSet.ProcessName, out exceptions);
                }

                if (eventID == Guid.Empty)
                {
                    if (objectID == Guid.Empty)
                    {
                        throw new Exception("Failed to record event against ObjectName.");
                    }
                    else
                    {
                        throw new Exception("Failed to record event against ObjectID.");
                    }
                }

                InstructionSet.InstructionSetContainer[EventName] = eventID;
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
Example #10
0
 internal RetrySession(RetrySession retrySession) : this(retrySession._retryPolicy)
 {
     Attempts    = retrySession.Attempts;
     ElapsedTime = TimeSpan.FromTicks(retrySession.ElapsedTime.Ticks);
     Exceptions.AddRange(retrySession.Exceptions);
 }