Exemplo n.º 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;
 }
Exemplo n.º 2
0
        private static TProcess makeDefault <TProcess>(ISkyApplication app, TProcess process, PID pid) where TProcess : Process
        {
            app.DependencyInjector.InjectInto(process);

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

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

            process.m_SysDescriptor = descriptor;
            return(process);
        }
Exemplo n.º 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 = DataDocConverter.DefaultInstance.DataDocToBSONDocument(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;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Infrastructure method, developers do not call
 /// </summary>
 public void ____Deserialize(ProcessDescriptor descriptor)
 {
     m_SysDescriptor = descriptor;
 }
Exemplo n.º 5
0
 protected void UpdateStatus(IProcessHost host, ProcessStatus status, string description, DateTime timestamp, string about)
 {
     m_SysDescriptor = new ProcessDescriptor(SysDescriptor, status, description, timestamp, about);
 }