Beispiel #1
0
 public void AssignType(XAttribute attribute, string type)
 {
     if ((type != null) && (type.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_TYPE.Clone();
         attr.Value = type;
         attribute.GetAttributes().Add(QualifiedName(KEY_TYPE), attr);
     }
 }
Beispiel #2
0
 public void AssignInstance(XEvent evt, string instance)
 {
     if ((instance != null) && (instance.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_INSTANCE.Clone();
         attr.Value = instance;
         evt.GetAttributes().Add(QualifiedName(KEY_INSTANCE), attr);
     }
 }
Beispiel #3
0
 void AssignCurrencyPrivate(IXAttributable element, string currency)
 {
     if ((currency != null) && (currency.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_CURRENCY.Clone();
         attr.Value = currency;
         element.GetAttributes().Add(QualifiedName(KEY_CURRENCY), attr);
     }
 }
 public void assignResource(XEvent evt, String resource)
 {
     if ((resource != null) && (resource.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_RESOURCE.Clone();
         attr.Value = resource.Trim();
         evt.GetAttributes().Add(QualifiedName(KEY_RESOURCE), attr);
     }
 }
Beispiel #5
0
 public void AssignName(IXElement element, string name)
 {
     if ((name != null) && (name.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_NAME.Clone();
         attr.Value = name;
         element.GetAttributes().Add(QualifiedName(KEY_NAME), attr);
     }
 }
 public void assignRole(XEvent evt, String role)
 {
     if ((role != null) && (role.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_ROLE.Clone();
         attr.Value = role.Trim();
         evt.GetAttributes().Add(QualifiedName(KEY_ROLE), attr);
     }
 }
Beispiel #7
0
 public void AssignDriver(XAttribute attribute, string driver)
 {
     if ((driver != null) && (driver.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_DRIVER.Clone();
         attr.Value = driver;
         attribute.GetAttributes().Add(QualifiedName(KEY_DRIVER), attr);
     }
 }
 public void assignGroup(XEvent evt, String group)
 {
     if ((group != null) && (group.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_GROUP.Clone();
         attr.Value = group.Trim();
         evt.GetAttributes().Add(QualifiedName(KEY_GROUP), attr);
     }
 }
Beispiel #9
0
        XAttributeLiteral Assign(IXAttributable element, XAttributeLiteral definedAttribute,
                                 SoftwareEventType value)
        {
            XAttributeLiteral attr = (XAttributeLiteral)definedAttribute.Clone();

            attr.Value = GetSoftwareEventTypeName(value);
            element.GetAttributes().Add(definedAttribute.Key, attr);
            return(attr);
        }
Beispiel #10
0
        public void AssignModel(XLog log, string model)
        {
            if ((model != null) && (model.Trim().Length > 0))
            {
                XAttributeLiteral modelAttr = (XAttributeLiteral)ATTR_MODEL.Clone();

                modelAttr.Value = model.Trim();
                log.GetAttributes().Add(QualifiedName(KEY_MODEL), modelAttr);
            }
        }
Beispiel #11
0
        public void AssignTransition(XEvent evt, string transition)
        {
            if ((transition != null) && (transition.Trim().Length > 0))
            {
                XAttributeLiteral transAttr = (XAttributeLiteral)ATTR_TRANSITION.Clone();

                transAttr.Value = transition.Trim();
                evt.GetAttributes().Add(QualifiedName(KEY_TRANSITION), transAttr);
            }
        }
Beispiel #12
0
        XAttributeLiteral Assign(IXAttributable element, XAttributeLiteral definedAttribute, string value)
        {
            if (value != null)
            {
                XAttributeLiteral attr = (XAttributeLiteral)definedAttribute.Clone();

                attr.Value = value;
                element.GetAttributes().Add(definedAttribute.Key, attr);
                return(attr);
            }
            return(null);
        }
Beispiel #13
0
        XAttributeLiteral AssignToValues(XAttributeList list, XAttribute definedAttribute, string value)
        {
            if (value != null)
            {
                XAttributeLiteral attr = (XAttributeLiteral)definedAttribute.Clone();

                attr.Value = value;
                list.AddToCollection(attr);

                return(attr);
            }
            return(null);
        }
Beispiel #14
0
        public IList <string> ExtractModelReferences(IXAttributable target)
        {
            IList <string>    modelReferences         = new List <string>();
            XAttributeLiteral modelReferenceAttribute = (XAttributeLiteral)target.GetAttributes()[QualifiedName(KEY_MODELREFERENCE)];

            if (modelReferenceAttribute != null)
            {
                String refString = modelReferenceAttribute.Value.Trim();
                foreach (Match m in Regex.Matches(refString, @"\\s"))
                {
                    modelReferences.Add(m.Value.Trim());
                }
            }
            return(modelReferences);
        }
Beispiel #15
0
        public void AssignModelReferenceUris(IXAttributable target, List <Uri> modelReferenceURIs)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Uri mUri in modelReferenceURIs)
            {
                sb.Append(mUri.ToString());
                sb.Append(" ");
            }
            if (sb.ToString().Trim().Length > 0)
            {
                XAttributeLiteral attr = (XAttributeLiteral)ATTR_MODELREFERENCE.Clone();

                attr.Value = sb.ToString().Trim();
                target.GetAttributes().Add(QualifiedName(KEY_MODELREFERENCE), attr);
            }
        }
Beispiel #16
0
        XSoftwareEventExtension() : base("Software  evt", "swevent", EXTENSION_URI)
        {
            IXFactory factory = XFactoryRegistry.Instance.CurrentDefault;

            #region Application Information
            ATTR_APP_NAME = factory.CreateAttributeLiteral(KEY_APP_NAME, "__INVALID__", this);
            this.eventAttributes.Add(KEY_APP_NAME, (XAttribute)ATTR_APP_NAME.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_APP_NAME), "User defined application name");

            ATTR_APP_NODE = factory.CreateAttributeLiteral(KEY_APP_NODE, "__INVALID__", this);
            this.eventAttributes.Add(KEY_APP_NODE, (XAttribute)ATTR_APP_NODE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_APP_NODE), "User defined application node");

            ATTR_APP_SESSION = factory.CreateAttributeLiteral(KEY_APP_SESSION, "__INVALID__", this);
            this.eventAttributes.Add(KEY_APP_SESSION, (XAttribute)ATTR_APP_SESSION.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_APP_SESSION), "User defined application session");

            ATTR_APP_TIER = factory.CreateAttributeLiteral(KEY_APP_TIER, "__INVALID__", this);
            this.eventAttributes.Add(KEY_APP_TIER, (XAttribute)ATTR_APP_TIER.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_APP_TIER), "User defined application tier");
            #endregion

            #region Callee event location
            ATTR_CALLEE_PACKAGE = factory.CreateAttributeLiteral(KEY_CALLEE_PACKAGE, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_PACKAGE, (XAttribute)ATTR_CALLEE_PACKAGE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_PACKAGE), "Callee - Package");

            ATTR_CALLEE_CLASS = factory.CreateAttributeLiteral(KEY_CALLEE_CLASS, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_CLASS, (XAttribute)ATTR_CALLEE_CLASS.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_CLASS), "Callee - Class");

            ATTR_CALLEE_METHOD = factory.CreateAttributeLiteral(KEY_CALLEE_METHOD, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_METHOD, (XAttribute)ATTR_CALLEE_METHOD.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_METHOD), "Callee - Method");

            ATTR_CALLEE_PARAMSIG = factory.CreateAttributeLiteral(KEY_CALLEE_PARAMSIG, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_PARAMSIG, (XAttribute)ATTR_CALLEE_PARAMSIG.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_PARAMSIG), "Callee - Parameter signature");

            ATTR_CALLEE_RETURNSIG = factory.CreateAttributeLiteral(KEY_CALLEE_RETURNSIG, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_RETURNSIG, (XAttribute)ATTR_CALLEE_RETURNSIG.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_RETURNSIG), "Callee - Return signature");

            ATTR_CALLEE_ISCONSTRUCTOR = factory.CreateAttributeBoolean(KEY_CALLEE_ISCONSTRUCTOR, false, this);
            this.eventAttributes.Add(KEY_CALLEE_ISCONSTRUCTOR, (XAttribute)ATTR_CALLEE_ISCONSTRUCTOR.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_ISCONSTRUCTOR), "Callee - Is a class constructor");

            ATTR_CALLEE_INSTANCEID = factory.CreateAttributeLiteral(KEY_CALLEE_INSTANCEID, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_INSTANCEID, (XAttribute)ATTR_CALLEE_INSTANCEID.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_INSTANCEID), "Callee - Instance id of class instance");

            ATTR_CALLEE_FILENAME = factory.CreateAttributeLiteral(KEY_CALLEE_FILENAME, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLEE_FILENAME, (XAttribute)ATTR_CALLEE_FILENAME.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_FILENAME), "Callee - File name source code artifact");

            ATTR_CALLEE_LINENR = factory.CreateAttributeDiscrete(KEY_CALLEE_LINENR, -1L, this);
            this.eventAttributes.Add(KEY_CALLEE_LINENR, (XAttribute)ATTR_CALLEE_LINENR.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLEE_LINENR), "Callee - Line number is source code artifact");
            #endregion

            #region Caller event Location
            ATTR_CALLER_PACKAGE = factory.CreateAttributeLiteral(KEY_CALLER_PACKAGE, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_PACKAGE, (XAttribute)ATTR_CALLER_PACKAGE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_PACKAGE), "Caller - Package");

            ATTR_CALLER_CLASS = factory.CreateAttributeLiteral(KEY_CALLER_CLASS, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_CLASS, (XAttribute)ATTR_CALLER_CLASS.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_CLASS), "Caller - Class");

            ATTR_CALLER_METHOD = factory.CreateAttributeLiteral(KEY_CALLER_METHOD, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_METHOD, (XAttribute)ATTR_CALLER_METHOD.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_METHOD), "Caller - Method");

            ATTR_CALLER_PARAMSIG = factory.CreateAttributeLiteral(KEY_CALLER_PARAMSIG, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_PARAMSIG, (XAttribute)ATTR_CALLER_PARAMSIG.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_PARAMSIG), "Caller - Parameter signature");

            ATTR_CALLER_RETURNSIG = factory.CreateAttributeLiteral(KEY_CALLER_RETURNSIG, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_RETURNSIG, (XAttribute)ATTR_CALLER_RETURNSIG.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_RETURNSIG), "Caller - Return signature");

            ATTR_CALLER_ISCONSTRUCTOR = factory.CreateAttributeBoolean(KEY_CALLER_ISCONSTRUCTOR, false, this);
            this.eventAttributes.Add(KEY_CALLER_ISCONSTRUCTOR, (XAttribute)ATTR_CALLER_ISCONSTRUCTOR.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_ISCONSTRUCTOR), "Caller - Is a class constructor");

            ATTR_CALLER_INSTANCEID = factory.CreateAttributeLiteral(KEY_CALLER_INSTANCEID, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_INSTANCEID, (XAttribute)ATTR_CALLER_INSTANCEID.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_INSTANCEID), "Caller - Instance id of class instance");

            ATTR_CALLER_FILENAME = factory.CreateAttributeLiteral(KEY_CALLER_FILENAME, "__INVALID__", this);
            this.eventAttributes.Add(KEY_CALLER_FILENAME, (XAttribute)ATTR_CALLER_FILENAME.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_FILENAME), "Caller - File name source code artifact");

            ATTR_CALLER_LINENR = factory.CreateAttributeDiscrete(KEY_CALLER_LINENR, -1L, this);
            this.eventAttributes.Add(KEY_CALLER_LINENR, (XAttribute)ATTR_CALLER_LINENR.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_CALLER_LINENR), "Caller - Line number is source code artifact");
            #endregion

            #region Exception Information
            ATTR_HAS_EXCEPTION = factory.CreateAttributeBoolean(KEY_HAS_EXCEPTION, false, this);
            this.logAttributes.Add(KEY_HAS_EXCEPTION, (XAttribute)ATTR_HAS_EXCEPTION.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_HAS_EXCEPTION), "Has exception data");

            ATTR_EX_CAUGHT = factory.CreateAttributeLiteral(KEY_EX_CAUGHT, "__INVALID__", this);
            this.eventAttributes.Add(KEY_EX_CAUGHT, (XAttribute)ATTR_EX_CAUGHT.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_EX_CAUGHT), "Caught exception type");

            ATTR_EX_THROWN = factory.CreateAttributeLiteral(KEY_EX_THROWN, "__INVALID__", this);
            this.eventAttributes.Add(KEY_EX_THROWN, (XAttribute)ATTR_EX_THROWN.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_EX_THROWN), "Thrown exception type");
            #endregion

            #region Runtime Information
            ATTR_NANOTIME = factory.CreateAttributeDiscrete(KEY_NANOTIME, -1L, this);
            this.eventAttributes.Add(KEY_NANOTIME, (XAttribute)ATTR_NANOTIME.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_NANOTIME), "Elapsed nanotime");

            ATTR_THREAD_ID = factory.CreateAttributeLiteral(KEY_THREAD_ID, "__INVALID__", this);
            this.eventAttributes.Add(KEY_THREAD_ID, (XAttribute)ATTR_THREAD_ID.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_THREAD_ID), "Thread id for generated event");
            #endregion

            #region Method Data
            ATTR_HAS_DATA = factory.CreateAttributeBoolean(KEY_HAS_DATA, false, this);
            this.logAttributes.Add(KEY_HAS_DATA, (XAttribute)ATTR_HAS_DATA.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_HAS_DATA), "Has method data");

            ATTR_RETURN_VALUE = factory.CreateAttributeLiteral(KEY_RETURN_VALUE, "__INVALID__", this);
            this.eventAttributes.Add(KEY_RETURN_VALUE, (XAttribute)ATTR_RETURN_VALUE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_RETURN_VALUE), "Return value for the returning method");

            ATTR_PARAMS = factory.CreateAttributeList(KEY_PARAMS, this);
            this.eventAttributes.Add(KEY_PARAMS, (XAttribute)ATTR_PARAMS.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_PARAMS), "List of parameters for the called method");

            ATTR_PARAM_VALUE = factory.CreateAttributeLiteral(KEY_PARAM_VALUE, "__INVALID__", this);
            this.metaAttributes.Add(KEY_PARAM_VALUE, (XAttribute)ATTR_PARAM_VALUE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_PARAM_VALUE), "A parameter value in the list params");

            ATTR_VALUE_TYPE = factory.CreateAttributeLiteral(KEY_VALUE_TYPE, "__INVALID__", this);
            this.metaAttributes.Add(KEY_VALUE_TYPE, (XAttribute)ATTR_VALUE_TYPE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_VALUE_TYPE), "A runtime value type for a return or parameter value");
            #endregion

            #region Event type and lifecycle
            ATTR_TYPE = factory.CreateAttributeLiteral(KEY_TYPE, "__INVALID__", this);
            this.eventAttributes.Add(KEY_TYPE, (XAttribute)ATTR_TYPE.Clone());
            XGlobalAttributeNameMap.Instance.RegisterMapping("EN", QualifiedName(KEY_TYPE), "Event type");
            #endregion
        }
Beispiel #17
-1
        /// <summary>
        /// Composes the appropriate attribute type from the string-based information
        /// found, e.g., in XML serializations.
        /// </summary>
        /// <returns>An appropriate attribute.</returns>
        /// <param name="factory">Factory to use for creating the attribute.</param>
        /// <param name="key">Key of the attribute.</param>
        /// <param name="value">Value of the attribute.</param>
        /// <param name="type">Type string of the attribute.</param>
        /// <param name="extension">Extension of the attribute (can be <code>null</code>).</param>
        public static XAttribute ComposeAttribute(IXFactory factory, string key, string value, string type,
                                                  XExtension extension)
        {
            type = type.Trim();
            if (type.Equals("LIST", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeList attr = factory.CreateAttributeList(key, extension);
                return(attr);
            }
            if (type.Equals("CONTAINER", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeContainer attr = factory.CreateAttributeContainer(key, extension);
                return(attr);
            }
            if (type.Equals("LITERAL", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeLiteral attr = factory.CreateAttributeLiteral(key, value, extension);

                return(attr);
            }
            if (type.Equals("BOOLEAN", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeBoolean attr = factory.CreateAttributeBoolean(key, bool.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("CONTINUOUS", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeContinuous attr = factory.CreateAttributeContinuous(key, double.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("DISCRETE", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeDiscrete attr = factory.CreateAttributeDiscrete(key, long.Parse(value), extension);

                return(attr);
            }
            if (type.Equals("TIMESTAMP", StringComparison.CurrentCultureIgnoreCase))
            {
                IXAttributeTimestamp attr;
                try
                {
                    attr = factory.CreateAttributeTimestamp(key, DateTime.Parse(value), extension);
                }
                catch (FormatException)
                {
                    throw new InvalidOperationException("OpenXES: could not parse date-time attribute. Value: " + value);
                }

                return((XAttributeTimestamp)attr);
            }
            if (type.Equals("ID", StringComparison.CurrentCultureIgnoreCase))
            {
                XAttributeID attr = factory.CreateAttributeID(key, XID.Parse(value), extension);
                return(attr);
            }
            throw new InvalidOperationException("OpenXES: could not parse attribute type!");
        }