/// <summary>
        /// Faz um dump do component
        /// </summary>
        /// <param name="component"></param>
        private void DumpComponent(ComponentContext component)
        {
            ComponentId   componentId = component.GetComponentId();
            StringBuilder builder     = new StringBuilder();

            builder.AppendFormat("Componente {0}:{1}.{2}.{3} criado com sucesso.\n", componentId.name,
                                 componentId.major_version, componentId.minor_version, componentId.patch_version);

            IDictionary <String, Facet>      facets      = component.GetFacets();
            IDictionary <String, Receptacle> receptacles = component.GetReceptacles();

            if (facets.Count > 0)
            {
                builder.AppendLine("Facetas:");
            }
            foreach (Facet facet in facets.Values)
            {
                builder.AppendFormat("  {0} : {1}\n", facet.Name, facet.InterfaceName);
            }

            if (receptacles.Count > 0)
            {
                builder.AppendLine("Receptáculos:");
            }
            foreach (Receptacle receptacle in receptacles.Values)
            {
                builder.AppendFormat("  {0} : {1}\n", receptacle.Name, receptacle.InterfaceName);
            }
            logger.Info(builder.Remove(builder.Length - 1, 1));
        }
Esempio n. 2
0
        /// <see cref="Equals" />
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            ComponentContext            objContext = (ComponentContext)obj;
            IDictionary <string, Facet> objFacets  = objContext.GetFacets();

            if (this.facets.Count != objFacets.Count)
            {
                return(false);
            }
            foreach (Facet facet in this.facets.Values)
            {
                if (!objFacets.ContainsKey(facet.Name))
                {
                    return(false);
                }
                Facet objFacet = objFacets[facet.Name];
                if (!facet.Equals(objFacet))
                {
                    return(false);
                }
            }

            IDictionary <string, Receptacle> objReceptacles = objContext.GetReceptacles();

            if (this.receptacles.Count != objReceptacles.Count)
            {
                return(false);
            }
            foreach (Receptacle receptacle in this.receptacles.Values)
            {
                if (!objReceptacles.ContainsKey(receptacle.Name))
                {
                    return(false);
                }
                Receptacle objReceptacle = objReceptacles[receptacle.Name];
                if (!receptacle.Equals(objReceptacle))
                {
                    return(false);
                }
            }

            if (this.componentId.name != objContext.GetComponentId().name)
            {
                return(false);
            }
            if (this.componentId.major_version != objContext.GetComponentId().major_version)
            {
                return(false);
            }
            if (this.componentId.minor_version != objContext.GetComponentId().minor_version)
            {
                return(false);
            }
            if (this.componentId.patch_version != objContext.GetComponentId().patch_version)
            {
                return(false);
            }
            if (this.componentId.platform_spec != objContext.GetComponentId().platform_spec)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
 /// <summary>
 /// Obtém o identificador do componente.
 /// </summary>
 /// <returns>O identificador do componente.</returns>
 public ComponentId getComponentId()
 {
     return(context.GetComponentId());
 }