Пример #1
0
 void IEventsVisitor.Visit(MetadataEvent evt)
 {
     Output.AppendFormat("Meta: {0}={1}", evt.Key, evt.Value);
 }
Пример #2
0
 void IEventsVisitor.Visit(MetadataEvent evt)
 {
     CreateElement(evt, SC.Elt_Meta,
                   new XAttribute(SC.Attr_MetaKey, evt.Key),
                   new XAttribute(SC.Attr_MetaValue, evt.Value));
 }
Пример #3
0
        public bool TryDeserialize(XElement elt, out Event ret)
        {
            ret = null;
            switch (elt.Name.LocalName)
            {
            case SC.Elt_HttpMessage:
                ret = new HttpMessage(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_DisplayName),
                    MessageDirection(elt, SC.Attr_MessageDirection),
                    MessageType(elt, SC.Attr_MessageType),
                    Attr(elt, SC.Attr_MessageId),
                    Attr(elt, SC.Attr_Remote),
                    Attr(elt, SC.Attr_Method),
                    "",
                    Enumerable.Empty <KeyValuePair <string, string> >(),
                    StatusCode(elt, SC.Attr_StatusCode),
                    targetIdHint: Attr(elt, SC.Attr_TargetId),
                    statusComment: Attr(elt, SC.Attr_StatusComment)
                    );
                break;

            case SC.Elt_NetworkMessage:
                ret = new NetworkMessageEvent(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_DisplayName),
                    MessageDirection(elt, SC.Attr_MessageDirection),
                    MessageType(elt, SC.Attr_MessageType),
                    typesPool.Intern(Attr(elt, SC.Attr_EventType)),
                    Attr(elt, SC.Attr_MessageId),
                    Attr(elt, SC.Attr_TargetId),
                    remoteNodeIdsPool.Intern(Attr(elt, SC.Attr_Remote))
                    );
                break;

            case SC.Elt_ResponselessNetworkMessage:
                ret = new ResponselessNetworkMessageEvent(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_DisplayName),
                    MessageDirection(elt, SC.Attr_MessageDirection),
                    MessageType(elt, SC.Attr_MessageType),
                    messageId: Attr(elt, SC.Attr_MessageId),
                    targetIdHint: Attr(elt, SC.Attr_TargetId)
                    );
                break;

            case SC.Elt_Cancellation:
                ret = new RequestCancellationEvent(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_DisplayName),
                    Attr(elt, SC.Attr_MessageId)
                    );
                break;

            case SC.Elt_Function:
                ret = new FunctionInvocationEvent(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_DisplayName),
                    MessageDirection(elt, SC.Attr_MessageDirection),
                    MessageType(elt, SC.Attr_MessageType),
                    Attr(elt, SC.Attr_MessageId)
                    );
                break;

            case SC.Elt_Meta:
                ret = new MetadataEvent(
                    MakeTrigger(elt),
                    Attr(elt, SC.Attr_MetaKey),
                    Attr(elt, SC.Attr_MetaValue)
                    );
                break;
            }
            if (ret != null)
            {
                ret.Tags = tagsPool.Intern(
                    new HashSet <string>((Attr(elt, SC.Attr_Tags) ?? "").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
                ret.Status = EventStatus(elt, SC.Attr_Status);
            }
            return(ret != null);
        }