public AnnotationDecoration(System.Attribute ann, Net.Vpc.Upa.Config.DecorationSourceType locationType, Net.Vpc.Upa.Config.DecorationTarget targetType, string type, string location, int position, Net.Vpc.Upa.Config.ConfigInfo configInfo)
 {
     this.ann = ann;
     this.decorationSourceType = locationType;
     this.targetType           = targetType;
     this.type       = type;
     this.location   = location;
     this.configInfo = configInfo;
     this.position   = position;
 }
Example #2
0
 public SimpleDecoration(string name, Net.Vpc.Upa.Config.DecorationSourceType locationType, Net.Vpc.Upa.Config.DecorationTarget targetType, string type, string location, int position, Net.Vpc.Upa.Config.ConfigInfo configInfo, System.Collections.Generic.IDictionary <string, Net.Vpc.Upa.Config.DecorationValue> attr)
 {
     this.name = name;
     this.decorationSourceType = locationType;
     this.targetType           = targetType;
     this.type       = type;
     this.location   = location;
     this.configInfo = configInfo;
     this.values     = attr;
     this.position   = position;
 }
Example #3
0
        public virtual void Visit(Net.Vpc.Upa.Config.Decoration d)
        {
            string typeName = d.GetLocationType();

            try {
                if (enableLog && typeName.ToLower().Contains("upalock"))
                {
                    log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("\t[{0}] unexpected registration of {1}", null, new object[] { name, typeName }));
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
            }
            string methodOrFieldName = d.GetLocation();

            Net.Vpc.Upa.Config.DecorationTarget targetType = d.GetTarget();
            if (enableLog && /*IsLoggable=*/ true)
            {
                log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 40, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("\t[{0}] register Decoration {1}", null, new object[] { name, d }));
            }
            Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo typeInfo = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo>(decorationsByType, typeName);
            if (typeInfo == null)
            {
                typeInfo                    = new Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo();
                typeInfo.typeName           = typeName;
                decorationsByType[typeName] = typeInfo;
            }
            if (targetType != default(Net.Vpc.Upa.Config.DecorationTarget))
            {
                switch (targetType)
                {
                case Net.Vpc.Upa.Config.DecorationTarget.TYPE:
                {
                    if (typeInfo.decorations == null)
                    {
                        typeInfo.decorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>(3);
                    }
                    System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = typeInfo.decorations;
                    int found = -1;
                    for (int i = 0; i < (m).Count; i++)
                    {
                        Net.Vpc.Upa.Config.Decoration m1 = m[i];
                        if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                        {
                            found = i;
                            break;
                        }
                    }
                    if (found < 0)
                    {
                        m.Add(d);
                    }
                    break;
                }

                case Net.Vpc.Upa.Config.DecorationTarget.METHOD:
                {
                    if (typeInfo.methods == null)
                    {
                        typeInfo.methods = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >();
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                        typeInfo.methods[methodOrFieldName] = m;
                        m.Add(d);
                    }
                    else
                    {
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >(typeInfo.methods, methodOrFieldName);
                        if (m == null)
                        {
                            m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                            typeInfo.methods[methodOrFieldName] = m;
                        }
                        int found = -1;
                        for (int i = 0; i < (m).Count; i++)
                        {
                            Net.Vpc.Upa.Config.Decoration m1 = m[i];
                            if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                            {
                                found = i;
                                break;
                            }
                        }
                        if (found < 0)
                        {
                            m.Add(d);
                        }
                    }
                    break;
                }

                case Net.Vpc.Upa.Config.DecorationTarget.FIELD:
                {
                    if (typeInfo.fields == null)
                    {
                        typeInfo.fields = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >();
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                        typeInfo.fields[methodOrFieldName] = m;
                        m.Add(d);
                    }
                    else
                    {
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >(typeInfo.fields, methodOrFieldName);
                        if (m == null)
                        {
                            m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                            typeInfo.fields[methodOrFieldName] = m;
                        }
                        int found = -1;
                        for (int i = 0; i < (m).Count; i++)
                        {
                            Net.Vpc.Upa.Config.Decoration m1 = m[i];
                            if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                            {
                                found = i;
                                break;
                            }
                        }
                        if (found < 0)
                        {
                            m.Add(d);
                        }
                    }
                    break;
                }
                }
            }
            System.Collections.Generic.ISet <string> tt = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.ISet <string> >(typesByDecoration, d.GetName());
            if (tt == null)
            {
                tt = new System.Collections.Generic.HashSet <string>();
                typesByDecoration[d.GetName()] = tt;
            }
            tt.Add(typeName);
        }
 public AnnotationDecoration(System.Attribute ann, Net.Vpc.Upa.Config.DecorationSourceType locationType, Net.Vpc.Upa.Config.DecorationTarget targetType, string type, string location, int position)  : this(ann, locationType, targetType, type, location, position, null)
 {
 }