Пример #1
0
        internal DeploymentNode AddDeploymentNode(DeploymentNode parent, string environment, string name, string description, string technology, int instances, Dictionary <string, string> properties)
        {
            if ((parent == null && GetDeploymentNodeWithName(name, environment) == null) || (parent != null && parent.GetDeploymentNodeWithName(name) == null))
            {
                DeploymentNode deploymentNode = new DeploymentNode
                {
                    Name        = name,
                    Description = description,
                    Technology  = technology,
                    Parent      = parent,
                    Instances   = instances,
                    Environment = environment
                };

                if (properties != null)
                {
                    deploymentNode.Properties = properties;
                }

                if (parent == null)
                {
                    DeploymentNodes.Add(deploymentNode);
                }

                deploymentNode.Id = _idGenerator.GenerateId(deploymentNode);
                AddElementToInternalStructures(deploymentNode);

                return(deploymentNode);
            }
            else
            {
                throw new ArgumentException("A deployment node named '" + name + "' already exists.");
            }
        }
Пример #2
0
        internal void Hydrate()
        {
            // add all of the elements to the model
            foreach (Person person in People)
            {
                AddElementToInternalStructures(person);
            }

            foreach (SoftwareSystem softwareSystem in SoftwareSystems)
            {
                AddElementToInternalStructures(softwareSystem);
                foreach (Container container in softwareSystem.Containers)
                {
                    softwareSystem.Add(container);
                    AddElementToInternalStructures(container);
                    container.Parent = softwareSystem;
                    foreach (Component component in container.Components)
                    {
                        container.Add(component);
                        AddElementToInternalStructures(component);
                        component.Parent = container;
                    }
                }
            }

            DeploymentNodes.ToList().ForEach(dn => HydrateDeploymentNode(dn, null));

            // now hydrate the relationships
            foreach (Person person in People)
            {
                HydrateRelationships(person);
            }

            foreach (SoftwareSystem softwareSystem in SoftwareSystems)
            {
                HydrateRelationships(softwareSystem);
                foreach (Container container in softwareSystem.Containers)
                {
                    HydrateRelationships(container);
                    foreach (Component component in container.Components)
                    {
                        HydrateRelationships(component);
                    }
                }
            }

            DeploymentNodes.ToList().ForEach(HydrateDeploymentNodeRelationships);
        }
Пример #3
0
 /// <summary>
 /// Gets the DeploymentNode with the specified name.
 /// </summary>
 /// <param name="name">the name of the deployment node</param>
 /// <param name="environment">the name of the deployment environment</param>
 /// <returns>the DeploymentNode instance with the specified name (or null if it doesn't exist)</returns>
 public DeploymentNode GetDeploymentNodeWithName(string name, string environment)
 {
     return(DeploymentNodes.FirstOrDefault(dn => dn.Environment.Equals(environment) && dn.Name.Equals(name)));
 }
Пример #4
0
 /// <summary>
 /// Gets the DeploymentNode with the specified name.
 /// </summary>
 /// <param name="name">the name of the deployment node</param>
 /// <returns>the DeploymentNode instance with the specified name (or null if it doesn't exist)</returns>
 public DeploymentNode GetDeploymentNodeWithName(string name)
 {
     return(DeploymentNodes.FirstOrDefault(dn => dn.Name.Equals(name)));
 }