Ejemplo n.º 1
0
        public ComponentInfo GetComponentInfo(ComponentKey key)
        {
            ComponentInfo info;

            if (_infoMap.TryGetValue(key, out info))
            {
                return(info);
            }
            throw new OpenGammaException(string.Format("ComponentRepository did not include service {0}, {1}", key, this));
        }
        private ComponentRepository GetComponentRepository(IFudgeFieldContainer configMsg)
        {
            var componentInfos = new Dictionary <ComponentKey, ComponentInfo>();

            foreach (var userDataField in configMsg.GetMessage("infos"))
            {
                if (!(userDataField.Value is IFudgeFieldContainer))
                {
                    continue;
                }

                var component    = (IFudgeFieldContainer)userDataField.Value;
                var uri          = new Uri(_rootUri, component.GetString("uri"));
                var componentKey = new ComponentKey(component.GetString("type"), component.GetString("classifier"));
                Dictionary <string, string> attributes = component.GetMessage("attributes").ToDictionary(f => f.Name, f => (string)f.Value);
                componentInfos.Add(componentKey, new ComponentInfo(componentKey, uri, attributes));
            }
            return(new ComponentRepository(componentInfos));
        }
Ejemplo n.º 3
0
 public ComponentInfo(ComponentKey key, Uri uri, Dictionary <string, string> attributes)
 {
     _key        = key;
     _attributes = attributes;
     _uri        = uri;
 }