Ejemplo n.º 1
0
        public StateInspectorOutput(LogSourcePostprocessorDeserializationParams p, ILogPartTokenFactory rotatedLogPartFactory = null)
        {
            this.logSource = p.LogSource;

            if (!p.Reader.ReadToFollowing("root"))
            {
                throw new FormatException();
            }
            etag.Read(p.Reader);

            var eventsDeserializer = new EventsDeserializer(TextLogEventTrigger.DeserializerFunction);

            foreach (var elt in p.Reader.ReadChildrenElements())
            {
                if (eventsDeserializer.TryDeserialize(elt, out var evt))
                {
                    events.Add(evt);
                }
                else if (rotatedLogPartFactory.TryReadLogPartToken(elt, out var tmp))
                {
                    this.rotatedLogPartToken = tmp;
                }
                p.Cancellation.ThrowIfCancellationRequested();
            }
        }
Ejemplo n.º 2
0
 public static bool TryReadLogPartToken(this ILogPartTokenFactory rotatedLogPartFactory, XElement element, out ILogPartToken token)
 {
     token = null;
     if (rotatedLogPartFactory != null && element != null && element.Name.LocalName == rotatedLogPartTokenEltName)
     {
         token = rotatedLogPartFactory.TryDeserialize(element);
     }
     return(token != null);
 }
Ejemplo n.º 3
0
 public TimeSeriesPostprocessorOutput(LogSourcePostprocessorDeserializationParams p,
                                      ILogPartTokenFactory rotatedLogPartFactory, TSBlocks.ITimeSeriesTypesAccess timeSeriesTypesAccess)
 {
     this.logSource = p.LogSource;
     logDisplayName = logSource.DisplayName;
     p.Reader.ReadStartElement();
     events     = (List <TSBlocks.EventBase>)timeSeriesTypesAccess.GetEventsSerializer().Deserialize(p.Reader);
     timeSeries = (List <TSBlocks.TimeSeriesData>)timeSeriesTypesAccess.GetSeriesSerializer().Deserialize(p.Reader);
     timeSeries.ForEach(Sanitize);
 }
Ejemplo n.º 4
0
        public StateInspectorOutput(XDocument doc, ILogSource logSource, ILogPartTokenFactory rotatedLogPartFactory = null)
        {
            this.logSource = logSource;
            var eventsDeserializer = new EventsDeserializer(TextLogEventTrigger.DeserializerFunction);

            this.events = eventsDeserializer
                          .Deserialize(doc.Root)
                          .ToList();
            this.rotatedLogPartToken = rotatedLogPartFactory.SafeDeserializeLogPartToken(doc.Root);
        }
 public TimeSeriesPostprocessorOutput(XDocument doc, ILogSource logSource,
                                      ILogPartTokenFactory rotatedLogPartFactory, TSBlocks.ITimeSeriesTypesAccess timeSeriesTypesAccess)
 {
     this.logSource = logSource;
     logDisplayName = logSource.DisplayName;
     using (var reader = doc.CreateReader())
     {
         reader.ReadStartElement();
         events     = (List <TSBlocks.EventBase>)timeSeriesTypesAccess.GetEventsSerializer().Deserialize(reader);
         timeSeries = (List <TSBlocks.TimeSeriesData>)timeSeriesTypesAccess.GetSeriesSerializer().Deserialize(reader);
     }
 }
Ejemplo n.º 6
0
        public static ILogPartToken SafeDeserializeLogPartToken(this ILogPartTokenFactory rotatedLogPartFactory, XElement element)
        {
            if (rotatedLogPartFactory == null || element == null)
            {
                return(new NullLogPartToken());
            }
            var tokenElt = element.Element(rotatedLogPartTokenEltName);

            if (tokenElt == null)
            {
                return(new NullLogPartToken());
            }
            return(rotatedLogPartFactory.Deserialize(tokenElt) ?? new NullLogPartToken());
        }
        public TimelinePostprocessorOutput(XDocument doc, ILogSource logSource, IEntitiesComparer entitiesComparer, ILogPartTokenFactory rotatedLogPartFactory)
        {
            this.logSource = logSource;
            var eventsDeserializer = new EventsDeserializer(TextLogEventTrigger.DeserializerFunction);

            this.timelineEvents      = eventsDeserializer.Deserialize(doc.Root).ToList().AsReadOnly();
            this.rotatedLogPartToken = rotatedLogPartFactory.SafeDeserializeLogPartToken(doc.Root);
        }
 public TimelinePostprocessorOutput(XDocument doc, ILogSource logSource, ILogPartTokenFactory rotatedLogPartFactory = null) :
     this(doc, logSource, TimelineEntitiesComparer.Instance, rotatedLogPartFactory)
 {
 }
Ejemplo n.º 9
0
        public SequenceDiagramPostprocessorOutput(LogSourcePostprocessorDeserializationParams p, ILogPartTokenFactory rotatedLogPartFactory)
        {
            this.logSource = p.LogSource;
            var reader = p.Reader;

            events              = new List <M.Event>();
            timelineComments    = new List <TLBlock.Event>();
            stateComments       = new List <SIBlock.Event>();
            rotatedLogPartToken = new NullLogPartToken();

            if (!reader.ReadToFollowing("root"))
            {
                throw new FormatException();
            }
            etag.Read(reader);

            if (reader.ReadToFollowing(messagingEventsElementName))
            {
                var eventsDeserializer = new M.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        events.Add(evt);
                    }
                }
            }
            if (reader.ReadToFollowing(timelineCommentsElementName))
            {
                var eventsDeserializer = new TLBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        timelineComments.Add(evt);
                    }
                }
            }
            if (reader.ReadToFollowing(stateCommentsElementName))
            {
                var eventsDeserializer = new SIBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction);
                foreach (var elt in reader.ReadChildrenElements())
                {
                    if (eventsDeserializer.TryDeserialize(elt, out var evt))
                    {
                        stateComments.Add(evt);
                    }
                }
            }
        }
        public SequenceDiagramPostprocessorOutput(XDocument doc, ILogSource logSource, ILogPartTokenFactory rotatedLogPartFactory)
        {
            this.logSource = logSource;

            this.events = (new M.EventsDeserializer(TextLogEventTrigger.DeserializerFunction)).Deserialize(
                doc.Root).ToList();
            this.timelineComments = (new TLBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction)).Deserialize(
                doc.Root.Element("timeline-comments") ?? new XElement("dummy")).ToList();
            this.stateComments = (new SIBlock.EventsDeserializer(TextLogEventTrigger.DeserializerFunction)).Deserialize(
                doc.Root.Element("state-comments") ?? new XElement("dummy")).ToList();
            this.rotatedLogPartToken = rotatedLogPartFactory.SafeDeserializeLogPartToken(doc.Root);
        }
Ejemplo n.º 11
0
 void ILogPartTokenFactories.Register(ILogPartTokenFactory factory) => factories[factory.Id] = factory;
Ejemplo n.º 12
0
 void IManager.Register(ILogPartTokenFactory logPartFactory)
 {
     logPartTokenFactories.Register(logPartFactory);
 }
Ejemplo n.º 13
0
 public TimelinePostprocessorOutput(LogSourcePostprocessorDeserializationParams p, ILogPartTokenFactory rotatedLogPartFactory = null) :
     this(p, TimelineEntitiesComparer.Instance, rotatedLogPartFactory)
 {
 }