Example #1
0
 public ProcessDescriptor(ProcessDescriptor processDescriptor, ProcessStatus status, string description, DateTime timestamp, string about)
 {
     PID               = processDescriptor.PID;
     Description       = processDescriptor.Description;
     Timestamp         = processDescriptor.Timestamp;
     About             = processDescriptor.About;
     Status            = status;
     StatusDescription = description;
     StatusTimestamp   = timestamp;
     StatusAbout       = about;
 }
Example #2
0
        private static TProcess makeDefault <TProcess>(TProcess process, PID pid) where TProcess : Process
        {
            var attr = GuidTypeAttribute.GetGuidTypeAttribute <Process, ProcessAttribute>(process.GetType());

            var descriptor = new ProcessDescriptor(
                pid,
                attr.Description,
                App.TimeSource.UTCNow,
                "{0}@{1}@{2}".Args(App.CurrentCallUser.Name, App.Name, AgniSystem.HostName));

            process.m_SysDescriptor = descriptor;
            return(process);
        }
Example #3
0
        /// <summary>
        /// Frames the Todo instance, pass serialize null to frame only Sys Fields without content
        /// </summary>
        public ProcessFrame(Process process, int?serializer = SERIALIZER_DEFAULT)
        {
            if (process == null)
            {
                throw new WorkersException(StringConsts.ARGUMENT_ERROR + "ProcessFrame.ctor(process==null)");
            }

            ____CtorOriginal = process;

            var qa = GuidTypeAttribute.GetGuidTypeAttribute <Process, ProcessAttribute>(process.GetType());

            if (serializer.HasValue)
            {
                if (serializer == SERIALIZER_DEFAULT)
                {
                    serializer = SERIALIZER_BSON;
                }
                else
                if (serializer != SERIALIZER_BSON)//we only support BSON for now
                {
                    throw new WorkersException(StringConsts.PROCESS_FRAME_SER_NOT_SUPPORTED_ERROR.Args(process.GetType().Name, serializer));
                }

                byte[] content;
                try
                {
                    var cdoc = RowConverter.DefaultInstance.RowToBSONDocument(process, null);
                    content = cdoc.WriteAsBSONToNewArray();
                }
                catch (Exception error)
                {
                    throw new WorkersException(StringConsts.PROCESS_FRAME_SER_ERROR.Args(process.GetType().FullName, error.ToMessageWithType()), error);
                }

                this.Serializer = serializer.Value;
                this.Content    = content;
            }
            else
            {
                this.Serializer = 0;
                this.Content    = null;
            }

            this.Type       = qa.TypeGuid;
            this.Descriptor = process.SysDescriptor;
        }
Example #4
0
 public void ____Deserialize(ProcessDescriptor descriptor)
 {
     m_SysDescriptor = descriptor;
 }
Example #5
0
 protected void UpdateStatus(IProcessHost host, ProcessStatus status, string description, DateTime timestamp, string about)
 {
     m_SysDescriptor = new ProcessDescriptor(SysDescriptor, status, description, timestamp, about);
 }