Changeset 4796


Ignore:
Timestamp:
11/15/10 14:27:27 (8 years ago)
Author:
cneumuel
Message:

#1233 applied new cloning mechanism

Location:
branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New
Files:
1 added
2 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj

    r4649 r4796  
    8888    <Compile Include="PersistenceUtil.cs" />
    8989    <Compile Include="ServiceClients\ServiceClientFactory.cs" />
    90     <Compile Include="ServiceClients\ServiceClientFactoryException.cs" />
     90    <Compile Include="Exceptions\ServiceClientFactoryException.cs" />
    9191    <Compile Include="ServiceLocator.cs" />
    9292    <Compile Include="Properties\Settings.Designer.cs">
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Clients.Hive/3.3/HiveExperiment/HiveClient.cs

    r4649 r4796  
    3131  using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
    3232  using HeuristicLab.Common;
     33  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3334
    3435  [Item("Hive Client", "Connects to Hive and lists all submitted experiments by the current user.")]
     
    6768    }
    6869
     70    public HiveClient() { }
     71    protected HiveClient(HiveClient original, Cloner cloner)
     72      : base(original, cloner) {
     73      this.hiveExperiments = cloner.Clone(original.hiveExperiments);
     74    }
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new HiveClient(this, cloner);
     77    }
     78
    6979    private void RegisterHiveExperimentsEvent() {
    7080      if (hiveExperiments != null) {
     
    7787        hiveExperiments.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<HiveExperimentClient>>(hiveExperiments_ItemsRemoved);
    7888      }
    79     }
    80 
    81     public HiveClient() {
    82      
    83     }
    84 
    85     public override IDeepCloneable Clone(Cloner cloner) {
    86       HiveClient clone = (HiveClient)base.Clone(cloner);
    87       clone.hiveExperiments = (ItemList<HiveExperimentClient>)cloner.Clone(this.hiveExperiments);
    88       return clone;
    8989    }
    9090
     
    135135      if (handler != null) handler(this, EventArgs.Empty);
    136136    }
    137    
     137
    138138    void hiveExperiments_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<HiveExperimentClient>> e) {
    139139      if (!currentlyUpdating) {
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Clients.Hive/3.3/HiveExperiment/HiveExperimentClient.cs

    r4649 r4796  
    113113    private JobResultPoller jobResultPoller;
    114114
     115
    115116    public HiveExperimentClient()
    116117      : base(itemName, itemDescription) {
     
    120121      InitTimer();
    121122    }
    122 
    123123    public HiveExperimentClient(DT.HiveExperiment hiveExperimentDto)
    124124      : this() {
    125125      UpdateFromDto(hiveExperimentDto);
    126126    }
     127    protected HiveExperimentClient(HiveExperimentClient original, Cloner cloner)
     128      : base(original, cloner) {
     129      this.resourceIds = original.resourceIds;
     130      this.executionState = original.executionState;
     131      this.executionTime = original.executionTime;
     132      this.log = cloner.Clone(original.log);
     133      this.lastUpdateTime = original.lastUpdateTime;
     134      this.rootJobId = original.rootJobId;
     135    }
     136    public override IDeepCloneable Clone(Cloner cloner) {
     137      return new HiveExperimentClient(this, cloner);
     138    }
     139
    127140
    128141    public void UpdateFromDto(DT.HiveExperiment hiveExperimentDto) {
     
    142155        RootJobId = this.rootJobId
    143156      };
    144     }
    145 
    146     public override IDeepCloneable Clone(Cloner cloner) {
    147       LogMessage("I am beeing cloned");
    148       HiveExperimentClient clone = (HiveExperimentClient)base.Clone(cloner);
    149       clone.resourceIds = this.resourceIds;
    150       clone.executionState = this.executionState;
    151       clone.executionTime = this.executionTime;
    152       clone.log = (ILog)cloner.Clone(log);
    153       clone.lastUpdateTime = this.lastUpdateTime;
    154       clone.rootJobId = this.rootJobId;
    155       return clone;
    156157    }
    157158
     
    417418      }
    418419      if (HiveJob != null) {
    419         jobResultPoller = new JobResultPoller(HiveJob, ApplicationConstants.RESULT_POLLING_INTERVAL);
     420        jobResultPoller = new JobResultPoller(HiveJob, ApplicationConstants.ResultPollingInterval);
    420421        RegisterResultPollingEvents();
    421422      }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Clients.Hive/3.3/HiveExperiment/HiveJobClient.cs

    r4649 r4796  
    3333
    3434namespace HeuristicLab.Clients.Hive {
    35   [StorableClass]
     35
    3636  public class HiveJob : Item {
    3737    private static object locker = new object();
     
    5353    }
    5454
    55     [Storable]
    5655    private Job job;
    5756    public Job Job {
     
    6766    }
    6867
    69     [Storable]
    7068    private OptimizerJob optimizerJob;
    7169    public OptimizerJob OptimizerJob {
     
    8785    }
    8886
    89     [Storable]
    9087    private ItemList<HiveJob> childHiveJobs;
    9188    public ReadOnlyItemList<HiveJob> ChildHiveJobs {
     
    9390    }
    9491
    95     [Storable]
    9692    private bool isFinishedOptimizerDownloaded;
    9793    public bool IsFinishedOptimizerDownloaded {
     
    105101    }
    106102
    107     [Storable]
    108103    private bool syncJobsWithOptimizers = true;
    109104
     
    138133    public HiveJob(IOptimizer optimizer)
    139134      : this() {
    140         this.OptimizerJob = new OptimizerJob(optimizer);
     135      this.OptimizerJob = new OptimizerJob(optimizer);
    141136    }
    142137
     
    147142      this.OptimizerJob = PersistenceUtil.Deserialize<OptimizerJob>(serializedJob.Data);
    148143      this.syncJobsWithOptimizers = true;
     144    }
     145
     146    protected HiveJob(HiveJob original, Cloner cloner)
     147      : base(original, cloner) {
     148      this.Job = cloner.Clone(original.job);
     149      this.OptimizerJob = cloner.Clone(original.OptimizerJob);
     150    }
     151    public override IDeepCloneable Clone(Cloner cloner) {
     152      return new HiveJob(this, cloner);
    149153    }
    150154
     
    212216      }
    213217    }
    214        
     218
    215219    void batchRun_AlgorithmChanged(object sender, EventArgs e) {
    216220      if (syncJobsWithOptimizers) {
     
    484488    }
    485489
    486     public override IDeepCloneable Clone(Cloner cloner) {
    487       LogMessage("I am beeing cloned");
    488       HiveJob clone = (HiveJob)base.Clone(cloner);
    489       clone.job = (Job)cloner.Clone(this.job);
    490       clone.optimizerJob = (OptimizerJob)cloner.Clone(this.optimizerJob);
    491       return clone;
    492     }
    493 
    494490    /// <summary>
    495491    /// Returns a list of HiveJobs including this and all its child-jobs recursively
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Clients.Hive/3.3/Jobs/OptimizerJob.cs

    r4629 r4796  
    2929
    3030namespace HeuristicLab.Clients.Hive.Jobs {
     31  [Item("Optimizer Job", "Represents Job which executes a IOptimizer object.")]
    3132  [StorableClass]
    32   public class OptimizerJob : IJob {
     33  public class OptimizerJob : DeepCloneable, IJob {
    3334    [Storable]
    3435    protected IOptimizer optimizer;
     
    7071    }
    7172
    72 
    7373    [Storable]
    7474    private bool collectChildJobs;
     
    8181      this.log = new Log();
    8282    }
    83 
    8483    public OptimizerJob(IOptimizer optimizer)
    8584      : this() {
     
    9392        this.ComputeInParallel = false;
    9493      }
     94    }
     95    [StorableConstructor]
     96    protected OptimizerJob(bool deserializing) { }
     97    protected OptimizerJob(OptimizerJob original, Cloner cloner)
     98      : base(original, cloner) {
     99      this.Optimizer = cloner.Clone(original.Optimizer);
     100      this.log = cloner.Clone(original.Log);
     101      this.ComputeInParallel = original.ComputeInParallel;
     102      this.IndexInParentOptimizerList = original.IndexInParentOptimizerList;
     103      this.CollectChildJobs = original.CollectChildJobs;
     104      this.RegisterEvents();
     105    }
     106    public override IDeepCloneable Clone(Cloner cloner) {
     107      return new OptimizerJob(this, cloner);
    95108    }
    96109
     
    310323    #endregion
    311324
    312     #region IDeepCloneable Members
    313 
    314     public IDeepCloneable Clone(Cloner cloner) {
    315       OptimizerJob clone = (OptimizerJob)Activator.CreateInstance(this.GetType());
    316       cloner.RegisterClonedObject(this, clone);
    317       clone.Optimizer = (IOptimizer)cloner.Clone(this.Optimizer);
    318       clone.log = (ILog)cloner.Clone(this.Log);
    319       clone.ComputeInParallel = this.ComputeInParallel;
    320       clone.IndexInParentOptimizerList = this.IndexInParentOptimizerList;
    321       clone.CollectChildJobs = this.CollectChildJobs;
    322       clone.RegisterEvents();
    323       return clone;
    324     }
    325 
    326     #endregion
    327 
    328     #region ICloneable Members
    329 
    330     public object Clone() {
    331       return Clone(new Cloner());
    332     }
    333 
    334     #endregion
    335 
    336325    /// <summary>
    337326    /// Gets the string representation of the current instance in the format: <c>Name: [null|Value]</c>.
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/ApplicationConstants.cs

    r4598 r4796  
    2626  public class ApplicationConstants {
    2727
    28     public static System.Data.IsolationLevel ISOLATION_LEVEL = IsolationLevel.ReadUncommitted;
     28    public static System.Data.IsolationLevel IsolationLevel = IsolationLevel.ReadUncommitted;
    2929
    3030    /// <summary>
    3131    /// ReadUncommitted to minimize deadlocks.
    3232    /// </summary>
    33     public static System.Transactions.IsolationLevel ISOLATION_LEVEL_SCOPE = System.Transactions.IsolationLevel.ReadUncommitted;
     33    public static System.Transactions.IsolationLevel IsolationLevelScope = System.Transactions.IsolationLevel.ReadUncommitted;
    3434
    35     public static int HEARTBEAT_TIMEOUT = 120; // value in seconds
     35    public static int HeartbeatTimeout = 120; // value in seconds
    3636   
    37     public static int JOB_TIME_TO_LIVE = 5;
     37    public static int JobTimeToLive = 5;
    3838
    3939    /// <summary>
    4040    /// Interval in which the HL.HiveExperiment will poll results from server
    4141    /// </summary>
    42     public static TimeSpan RESULT_POLLING_INTERVAL = new TimeSpan(0, 0, 5);
     42    public static TimeSpan ResultPollingInterval = new TimeSpan(0, 0, 5);
    4343
    4444    /// <summary>
    4545    /// Maximum number of jobs that the server should send/receive simultaniously
    4646    /// </summary>
    47     public static int MAX_JOB_TRANSFER_COUNT = 6;
     47    public static int MaxJobTransferCount = 6;
    4848  }
    4949}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/Appointment.cs

    r4629 r4796  
    4040    public Guid ResourceId { get; set; }
    4141
     42    protected Appointment(Appointment original, Cloner cloner) : base(original, cloner) {
     43      this.AllDayEvent = original.AllDayEvent;
     44      this.EndDate = original.EndDate;
     45      this.Recurring = original.Recurring;
     46      this.RecurringId = original.RecurringId;
     47      this.ResourceId = original.ResourceId;
     48      this.StartDate = original.StartDate;
     49    }
    4250    public override IDeepCloneable Clone(Cloner cloner) {
    43       Appointment clone = (Appointment)base.Clone(cloner);
    44       clone.AllDayEvent = this.AllDayEvent;
    45       clone.EndDate = this.EndDate;
    46       clone.Recurring = this.Recurring;
    47       clone.RecurringId = this.RecurringId;
    48       clone.ResourceId = this.ResourceId;
    49       clone.StartDate = this.StartDate;
    50       return clone;
     51      return new Appointment(this, cloner);
    5152    }
    5253  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/HiveExperiment.cs

    r4649 r4796  
    2525
    2626namespace HeuristicLab.Services.Hive.Common.DataTransfer {
    27 
    2827  [DataContract]
    2928  [Serializable]
     
    3433    public Guid? RootJobId { get; set; }
    3534
     35    public HiveExperiment() { }
     36    protected HiveExperiment(HiveExperiment original, Cloner cloner) : base(original, cloner) {
     37      this.RootJobId = original.RootJobId;
     38      this.UserId = original.UserId;
     39    }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new HiveExperiment(this, cloner);
     42    }
     43
    3644    public override string ToString() {
    3745      return base.ToString() + "Name: " + Name + ", Description: " + Description;
    3846    }
    39    
    40     public override IDeepCloneable Clone(Cloner cloner) {
    41       var clone = (HiveExperiment)base.Clone(cloner);
    42       clone.RootJobId = this.RootJobId;
    43       clone.UserId = this.UserId;
    44       return clone;
    45     }
    4647  }
    4748}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/HiveItem.cs

    r4649 r4796  
    55using System.Runtime.Serialization;
    66using HeuristicLab.Common;
     7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    78
    89namespace HeuristicLab.Services.Hive.Common.DataTransfer {
     
    1314    public Guid Id { get; set; }
    1415
    15     public virtual IDeepCloneable Clone(Cloner cloner) {
    16       HiveItem clone = (HiveItem)base.Clone(cloner);
    17       clone.Id = this.Id;
    18       return clone;
     16    public HiveItem() { }
     17    protected HiveItem(HiveItem original, Cloner cloner) : base(original, cloner) {
     18      this.Id = original.Id;
    1919    }
    2020  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/HiveItemBase.cs

    r4649 r4796  
    55using HeuristicLab.Common;
    66using System.Runtime.Serialization;
     7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    78
    89namespace HeuristicLab.Services.Hive.Common.DataTransfer {
    910  [DataContract]
    1011  [Serializable]
    11   public class HiveItemBase : IDeepCloneable {
    12     public virtual IDeepCloneable Clone(Cloner cloner) {
    13       HiveItem clone = (HiveItem)Activator.CreateInstance(this.GetType(), true);
    14       cloner.RegisterClonedObject(this, clone);
    15       return clone;
    16     }
    17 
    18     public object Clone() {
    19       return Clone(new Cloner());
    20     }
     12  public abstract class HiveItemBase : DeepCloneable {
     13    protected HiveItemBase() { }
     14    protected HiveItemBase(HiveItemBase original, Cloner cloner) : base(original, cloner) { }
    2115  }
    2216}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/HivePlugin.cs

    r4629 r4796  
    3535    public bool Update { get; set; }
    3636
     37    public HivePlugin() { }
     38    protected HivePlugin(HivePlugin original, Cloner cloner) : base(original, cloner) {
     39      this.Version = original.Version;
     40      this.Update = original.Update;
     41    }
    3742    public override IDeepCloneable Clone(Cloner cloner) {
    38       var clone = (HivePlugin)base.Clone(cloner);
    39       clone.Version = this.Version;
    40       clone.Update = this.Update;
    41       return clone;
     43      return new HivePlugin(this, cloner);
    4244    }
    4345  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/HivePluginData.cs

    r4629 r4796  
    3535      Name = name;
    3636    }
    37 
     37    public HivePluginData() { }
     38    protected HivePluginData(HivePluginData original, Cloner cloner) : base(original, cloner) {
     39      if (original.Data != null) this.Data = new byte[original.Data.Length]; Array.Copy(original.Data, this.Data, original.Data.Length);
     40    }
    3841    public override IDeepCloneable Clone(Cloner cloner) {
    39       var clone = (HivePluginData)base.Clone(cloner);
    40       if (this.Data != null) clone.Data = new byte[this.Data.Length]; Array.Copy(this.Data, clone.Data, this.Data.Length);
    41       return clone;
     42      return new HivePluginData(this, cloner);
    4243    }
    4344  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/Job.cs

    r4649 r4796  
    4141    public Guid? ProjectId { get; set; }
    4242
    43     public override string ToString() {
    44       return base.ToString() + "State: " + JobState + ", [SlaveId : " + SlaveId + " ] , DateCreated: " + DateCreated + ", DateCalculated: " + DateCalculated +
    45         "Priority: " + Priority + ", CoresNeeded: " + CoresNeeded;
     43    public Job() { }
     44    protected Job(Job original, Cloner cloner) : base(original, cloner) {
     45      this.UserId = original.UserId;
     46      this.Priority = original.Priority;
     47      this.CoresNeeded = original.CoresNeeded;
     48      this.MemoryNeeded = original.MemoryNeeded;
     49      this.ProjectId = original.ProjectId;
     50    }
     51    public override IDeepCloneable Clone(Cloner cloner) {
     52      return new Job(this, cloner);
    4653    }
    4754
    48     public Job() {
    49     }
    50 
    51     public override IDeepCloneable Clone(Cloner cloner) {
    52       var clone = (Job)base.Clone(cloner);
    53       clone.UserId = this.UserId;
    54       clone.Priority = this.Priority;
    55       clone.CoresNeeded = this.CoresNeeded;
    56       clone.MemoryNeeded = this.MemoryNeeded;
    57       clone.ProjectId = this.ProjectId;
    58       return clone;
     55    public override string ToString() {
     56      return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", JobState, SlaveId, DateCreated, DateCalculated, CoresNeeded, MemoryNeeded);
    5957    }
    6058  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/JobData.cs

    r4649 r4796  
    3434    public byte[] Data { get; set; }
    3535
     36    public JobData() { }
     37    protected JobData(JobData original, Cloner cloner) : base(original, cloner) {
     38      if (original.Data != null) this.Data = new byte[original.Data.Length]; Array.Copy(original.Data, this.Data, original.Data.Length);
     39    }
    3640    public override IDeepCloneable Clone(Cloner cloner) {
    37       var clone = (JobData)base.Clone(cloner);
    38       if (this.Data != null) clone.Data = new byte[this.Data.Length]; Array.Copy(this.Data, clone.Data, this.Data.Length);
    39       return clone;
     41      return new JobData(this, cloner);
    4042    }
    4143  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/LightweightJob.cs

    r4649 r4796  
    4848      JobState = DataTransfer.JobState.Offline;
    4949    }
    50 
    5150    public LightweightJob(Job job) {
    5251      this.SlaveId = job.SlaveId;
     
    5958      this.ParentJobId = job.ParentJobId;
    6059    }
    61 
     60    protected LightweightJob(LightweightJob original, Cloner cloner) : base(original, cloner) {
     61      this.SlaveId = original.SlaveId;
     62      this.JobState = original.JobState;
     63      this.ExecutionTime = original.ExecutionTime;
     64      this.Exception = original.Exception;
     65      this.DateCreated = original.DateCreated;
     66      this.DateCalculated = original.DateCalculated;
     67      this.DateFinished = original.DateFinished;
     68      this.ParentJobId = original.ParentJobId;
     69    }
    6270    public override IDeepCloneable Clone(Cloner cloner) {
    63       var clone = (LightweightJob)base.Clone(cloner);
    64       clone.SlaveId = this.SlaveId;
    65       clone.JobState = this.JobState;
    66       clone.ExecutionTime = this.ExecutionTime;
    67       clone.Exception = this.Exception;
    68       clone.DateCreated = this.DateCreated;
    69       clone.DateCalculated = this.DateCalculated;
    70       clone.DateFinished = this.DateFinished;
    71       clone.ParentJobId = this.ParentJobId;
    72       return clone;
     71      return new LightweightJob(this, cloner);
    7372    }
    7473  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/NamedHiveItem.cs

    r4629 r4796  
    1414    public string Description { get; set; }
    1515
    16     public override IDeepCloneable Clone(Cloner cloner) {
    17       var clone = (NamedHiveItem)base.Clone(cloner);
    18       clone.Name = this.Name;
    19       clone.Description = this.Description;
    20       return clone;
     16    protected NamedHiveItem() { }
     17    protected NamedHiveItem(NamedHiveItem original, Cloner cloner) : base(original, cloner) {
     18      this.Name = original.Name;
     19      this.Description = original.Description;
    2120    }
    2221  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/Project.cs

    r4593 r4796  
    2222using System;
    2323using System.Runtime.Serialization;
     24using HeuristicLab.Common;
    2425
    2526namespace HeuristicLab.Services.Hive.Common.DataTransfer {
     
    2728  [Serializable]
    2829  public class Project : NamedHiveItem {
     30
     31    public Project() { }
     32    protected Project(Project original, Cloner cloner) : base(original, cloner) { }
     33    public override IDeepCloneable Clone(Cloner cloner) {
     34      return new Project(this, cloner);
     35    }
    2936  }
    3037}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/Resource.cs

    r4593 r4796  
    2929  public class Resource : NamedHiveItem {
    3030
     31    public Resource() { }
     32    protected Resource(Resource original, Cloner cloner) : base(original, cloner) { }
     33    public override IDeepCloneable Clone(Cloner cloner) {
     34      return new Resource(this, cloner);
     35    }
    3136  }
    3237}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/Slave.cs

    r4649 r4796  
    5050      SlaveState = DataTransfer.SlaveState.Idle;
    5151    }
     52    protected Slave(Slave original, Cloner cloner) : base(original, cloner) {
     53      this.Cores = original.Cores;
     54      this.FreeCores = original.FreeCores;
     55      this.CpuSpeed = original.CpuSpeed;
     56      this.Memory = original.Memory;
     57      this.FreeMemory = original.FreeMemory;
     58      this.SlaveState = original.SlaveState;
     59      this.CalendarSyncState = original.CalendarSyncState;
     60      this.SlaveConfigId = original.SlaveConfigId;
     61      this.IsAllowedToCalculate = original.IsAllowedToCalculate;
     62    }
     63    public override IDeepCloneable Clone(Cloner cloner) {
     64      return new Slave(this, cloner);
     65    }
    5266
    5367    public override string ToString() {
    54       return base.ToString() + ", NrOfCores: " + Cores + ", NrOfFreeCores " + FreeCores + ", State: " + SlaveState;
    55     }
    56 
    57     public override IDeepCloneable Clone(Cloner cloner) {
    58       var clone = (Slave)base.Clone(cloner);
    59       clone.Cores = this.Cores;
    60       clone.FreeCores = this.FreeCores;
    61       clone.CpuSpeed = this.CpuSpeed;
    62       clone.Memory = this.Memory;
    63       clone.FreeMemory = this.FreeMemory;
    64       clone.SlaveState = this.SlaveState;
    65       clone.CalendarSyncState = this.CalendarSyncState;
    66       clone.SlaveConfigId = this.SlaveConfigId;
    67       clone.IsAllowedToCalculate = this.IsAllowedToCalculate;
    68       return clone;
     68      return string.Format("Cores: {0}, FreeCores: {1}", Cores, FreeCores);
    6969    }
    7070  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/SlaveConfig.cs

    r4629 r4796  
    3333    public int? HeartBeatIntervall { get; set; }
    3434
     35    public SlaveConfig() { }
     36    protected SlaveConfig(SlaveConfig original, Cloner cloner) : base(original, cloner) {
     37      this.UpDownTimeCalendar = original.UpDownTimeCalendar;
     38      this.HeartBeatIntervall = original.HeartBeatIntervall;
     39    }
    3540    public override IDeepCloneable Clone(Cloner cloner) {
    36       var clone = (SlaveConfig)base.Clone(cloner);
    37       clone.UpDownTimeCalendar = this.UpDownTimeCalendar;
    38       clone.HeartBeatIntervall = this.HeartBeatIntervall;
    39       return clone;
     41      return new SlaveConfig(this, cloner);
    4042    }
    4143  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/SlaveGroup.cs

    r4649 r4796  
    3737      ChildResourcesIds = new List<Guid>();
    3838    }
    39 
     39    protected SlaveGroup(SlaveGroup original, Cloner cloner) : base(original, cloner) {
     40      this.ChildResourcesIds = new List<Guid>(original.ChildResourcesIds);
     41      this.ParentResourcesIds = new List<Guid>(original.ParentResourcesIds);
     42    }
    4043    public override IDeepCloneable Clone(Cloner cloner) {
    41       var clone = (SlaveGroup)base.Clone(cloner);
    42       clone.ChildResourcesIds = new List<Guid>(this.ChildResourcesIds);
    43       clone.ParentResourcesIds = new List<Guid>(this.ParentResourcesIds);
    44       return clone;
     44      return new SlaveGroup(this, cloner);
    4545    }
    4646  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/DataTransfer/UpTimeStatistics.cs

    r4629 r4796  
    3434    public DateTime Logout { get; set; }
    3535
     36    public UpTimeStatistics() { }
     37    protected UpTimeStatistics(UpTimeStatistics original, Cloner cloner) : base(original, cloner) {
     38      this.SlaveId = original.SlaveId;
     39      this.Login = original.Login;
     40      this.Logout = original.Logout;
     41    }
    3642    public override IDeepCloneable Clone(Cloner cloner) {
    37       var clone = (UpTimeStatistics)base.Clone(cloner);
    38       clone.SlaveId = this.SlaveId;
    39       clone.Login = this.Login;
    40       clone.Logout = this.Logout;
    41       return clone;
     43      return new UpTimeStatistics(this, cloner);
    4244    }
    4345  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.Common/3.3/MessageContainer.cs

    r4629 r4796  
    3131  [StorableClass]
    3232  [Serializable]
    33   public class MessageContainer : IDeepCloneable {
     33  public class MessageContainer : DeepCloneable {
    3434
    3535    public enum MessageType {
     
    6060    public Guid JobId { get; set; }
    6161
     62    protected MessageContainer() { }
    6263    public MessageContainer(MessageType message) {
    6364      Message = message;
    6465      JobId = Guid.Empty;
    6566    }
    66 
    6767    public MessageContainer(MessageType message, Guid jobId) {
    6868      Message = message;
    6969      JobId = jobId;
    7070    }
    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;
     71    protected MessageContainer(MessageContainer original, Cloner cloner) : base(original, cloner) {
     72      this.Message = original.Message;
     73      this.JobId = original.JobId;
    7874    }
    79 
    80     public object Clone() {
    81       return Clone(new Cloner());
     75    public override IDeepCloneable Clone(Cloner cloner) {
     76      return new MessageContainer(this, cloner);
    8277    }
    8378  }
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj

    r4649 r4796  
    7272      <DependentUpon>HiveDataContext.dbml</DependentUpon>
    7373    </Compile>
    74     <Compile Include="Interfaces\IContextFactory.cs" />
    7574    <Compile Include="Interfaces\IHiveDao.cs" />
    7675    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive.New/HeuristicLab.Services.Hive.DataAccess/3.3/TransactionManager.cs

    r4649 r4796  
    1010  public class TransactionManager {
    1111    public Disposable<TransactionScope> OpenTransaction() {
    12       TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE });
     12      TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.IsolationLevelScope });
    1313      var disposable = new Disposable<TransactionScope>(transaction);
    1414      disposable.Disposing += disposable_Disposing;
Note: See TracChangeset for help on using the changeset viewer.