Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/MessageContainer.cs @ 4629

Last change on this file since 4629 was 4629, checked in by cneumuel, 13 years ago
  • worked on new hive structure
  • created IIS hostable website for hive (old structure)

(#1233)

File size: 2.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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
22using System;
23using HeuristicLab.Common;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
26namespace HeuristicLab.Services.Hive.Common {
27  /// <summary>
28  /// The MessageContainer is a container class for Messages. Its two parts are:
29  /// the actual message itself and the JobId, refered by the message
30  /// </summary>
31  [StorableClass]
32  [Serializable]
33  public class MessageContainer : IDeepCloneable {
34
35    public enum MessageType {
36      FetchJob,
37      AbortJob,
38      JobAborted,
39      FinishedJob,
40      NoMessage,
41      SnapshotReady,
42      Shutdown,
43      JobFailed,
44      UptimeLimitDisconnect,
45      UpdateCalendar,
46      AddChildJob,
47      PauseJob,
48      GetChildJobs,
49      DeleteChildJobs,
50
51      /// <summary>
52      /// Slave should add itself
53      /// </summary>
54      AddSlaveInfo
55    };
56
57    [Storable]
58    public MessageType Message { get; set; }
59    [Storable]
60    public Guid JobId { get; set; }
61
62    public MessageContainer(MessageType message) {
63      Message = message;
64      JobId = Guid.Empty;
65    }
66
67    public MessageContainer(MessageType message, Guid jobId) {
68      Message = message;
69      JobId = jobId;
70    }
71
72    public virtual IDeepCloneable Clone(Cloner cloner) {
73      MessageContainer clone = (MessageContainer)Activator.CreateInstance(this.GetType(), true);
74      cloner.RegisterClonedObject(this, clone);
75      clone.Message = this.Message;
76      clone.JobId = this.JobId;
77      return clone;
78    }
79
80    public object Clone() {
81      return Clone(new Cloner());
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.