1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using HeuristicLab.Common;
|
---|
25 | using HeuristicLab.Core;
|
---|
26 | namespace HeuristicLab.Clients.Hive.CloudManager.Model {
|
---|
27 | public class Deployment : Item {
|
---|
28 | public string Name { get; set; }
|
---|
29 | public string DeploymentSlot { get; set; }
|
---|
30 | public string PrivateID { get; set; }
|
---|
31 | public string Status { get; set; }
|
---|
32 | public string Label { get; set; }
|
---|
33 | public string Url { get; set; }
|
---|
34 | public string Configuration { get; set; }
|
---|
35 | public List<RoleInstance> RoleInstanceList { get; set; }
|
---|
36 | public UpgradeStatus UpgradeStatus { get; set; }
|
---|
37 | public int UpgradeDomainCount;
|
---|
38 | public List<Role> RoleList { get; set; }
|
---|
39 | public Subscription Subscription { get; set; }
|
---|
40 | public bool Modified { get; set; }
|
---|
41 | public int NewInstanceCount { get; set; }
|
---|
42 |
|
---|
43 | public Deployment() {
|
---|
44 | this.Modified = false;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public Deployment(Deployment original, Cloner cloner) {
|
---|
48 | this.Name = original.Name;
|
---|
49 | this.DeploymentSlot = original.DeploymentSlot;
|
---|
50 | this.PrivateID = original.PrivateID;
|
---|
51 | this.Status = original.Status;
|
---|
52 | this.Label = original.Label;
|
---|
53 | this.Url = original.Label;
|
---|
54 | this.Configuration = original.Configuration;
|
---|
55 | this.RoleInstanceList = new List<RoleInstance>(original.RoleInstanceList);
|
---|
56 | this.UpgradeStatus = cloner.Clone(original.UpgradeStatus);
|
---|
57 | this.UpgradeDomainCount = original.UpgradeDomainCount;
|
---|
58 | this.RoleList = new List<Role>(original.RoleList);
|
---|
59 | this.Subscription = cloner.Clone(original.Subscription);
|
---|
60 | this.Modified = original.Modified;
|
---|
61 | this.NewInstanceCount = original.NewInstanceCount;
|
---|
62 |
|
---|
63 | }
|
---|
64 |
|
---|
65 | public override bool Equals(object obj) {
|
---|
66 | if (obj == null)
|
---|
67 | return false;
|
---|
68 | Deployment dep = obj as Deployment;
|
---|
69 | if ((this.Name == dep.Name))
|
---|
70 | return true;
|
---|
71 | else
|
---|
72 | return false;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public override string ToString() {
|
---|
76 | return string.Format("Deployment: Name={0}, DeploymentSlot={1}, Label={2}, Status={3}", Name, DeploymentSlot, Label, Status);
|
---|
77 | }
|
---|
78 |
|
---|
79 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
80 | return new Deployment(this, cloner);
|
---|
81 | }
|
---|
82 |
|
---|
83 | public void Merge(Deployment deployment) {
|
---|
84 | if (!this.Equals(deployment)) {
|
---|
85 | throw new ArgumentException("Objects must be equal to be merged.", "subscription");
|
---|
86 | }
|
---|
87 | this.Name = deployment.Name;
|
---|
88 | this.DeploymentSlot = deployment.DeploymentSlot;
|
---|
89 | this.PrivateID = deployment.PrivateID;
|
---|
90 | this.Status = deployment.Status;
|
---|
91 | this.Label = deployment.Label;
|
---|
92 | this.Url = deployment.Label;
|
---|
93 | this.Configuration = deployment.Configuration;
|
---|
94 | this.RoleInstanceList = deployment.RoleInstanceList;
|
---|
95 | this.UpgradeStatus = deployment.UpgradeStatus;
|
---|
96 | this.UpgradeDomainCount = deployment.UpgradeDomainCount;
|
---|
97 | this.RoleList = deployment.RoleList;
|
---|
98 | this.Subscription = deployment.Subscription;
|
---|
99 | //this.Modified = deployment.Modified;
|
---|
100 | //this.NewInstanceCount = deployment.NewInstanceCount;
|
---|
101 |
|
---|
102 | if (!this.Modified) {
|
---|
103 | this.Modified = deployment.Modified;
|
---|
104 | this.NewInstanceCount = deployment.NewInstanceCount;
|
---|
105 | }
|
---|
106 | }
|
---|
107 | }
|
---|
108 | }
|
---|