Free cookie consent management tool by TermsFeed Policy Generator

Changeset 770


Ignore:
Timestamp:
11/17/08 10:59:37 (16 years ago)
Author:
kgrading
Message:

finished most of the sandbox, finetuning is still needed (#365)

Location:
trunk/sources
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Common/JobBase.cs

    r768 r770  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    829
    930namespace HeuristicLab.Hive.Client.Common {
    10 
     31  [Serializable]
    1132  abstract public class JobBase {
    1233
  • trunk/sources/HeuristicLab.Hive.Client.Common/MessageContainer.cs

    r768 r770  
    3030  /// the actual message itself and the JobId, refered by the message
    3131  /// </summary>
     32  [Serializable]
    3233  public class MessageContainer {
    3334
  • trunk/sources/HeuristicLab.Hive.Client.Common/TestJob.cs

    r768 r770  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    526
    627namespace HeuristicLab.Hive.Client.Common {
     28  [Serializable]
    729  public class TestJob: JobBase {
    830    public override void Run() {
  • trunk/sources/HeuristicLab.Hive.Client.Core/ConfigurationManager.cs

    r742 r770  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
  • trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs

    r768 r770  
    2727using HeuristicLab.Hive.Client.Common;
    2828using System.Threading;
     29using System.Reflection;
     30using System.Diagnostics;
     31using System.Security.Permissions;
     32using System.Security.Policy;
     33using System.Security;
    2934
    3035
     
    3338
    3439    Dictionary<long, Executor> engines = new Dictionary<long, Executor>();
    35    
     40    Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>();
     41
     42    public static StrongName CreateStrongName(Assembly assembly) {
     43      if (assembly == null)
     44        throw new ArgumentNullException("assembly");
     45
     46      AssemblyName assemblyName = assembly.GetName();
     47      Debug.Assert(assemblyName != null, "Could not get assembly name");
     48
     49      // get the public key blob
     50      byte[] publicKey = assemblyName.GetPublicKey();
     51      if (publicKey == null || publicKey.Length == 0)
     52        throw new InvalidOperationException("Assembly is not strongly named");
     53
     54      StrongNamePublicKeyBlob keyBlob = new StrongNamePublicKeyBlob(publicKey);
     55
     56      // and create the StrongName
     57      return new StrongName(keyBlob, assemblyName.Name, assemblyName.Version);
     58    }
     59
    3660    public void Start() {
    3761      Logging.getInstance().Info(this.ToString(), "Info Message");
     
    4569      MessageQueue queue = MessageQueue.GetInstance();
    4670     
    47       JobBase job = new TestJob();
     71      TestJob job = new TestJob();
     72
     73      AppDomain appDomain = CreateNewAppDomain(false);
    4874     
    49       ExecutionEngine.Executor engine = new ExecutionEngine.Executor();
     75      //This is a HACK. remove static directory ASAP
     76      //Executor engine = (Executor)appDomain.CreateInstanceFromAndUnwrap(@"C:\Program Files\HeuristicLab 3.0\plugins\HeuristicLab.Hive.Client.ExecutionEngine-3.2.dll", "HeuristicLab.Hive.Client.ExecutionEngine.Executor");
     77     
     78      Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName);
     79      //ExecutionEngine.Executor engine = new ExecutionEngine.Executor();
    5080      engine.Job = job;
    5181      engine.JobId = 1L;
     
    6595    }
    6696
     97    Assembly appDomain_TypeResolve(object sender, ResolveEventArgs args) {
     98      throw new NotImplementedException();
     99    }
     100
     101    private AppDomain CreateNewAppDomain(bool sandboxed) {
     102      PermissionSet pset;
     103      if (sandboxed) {
     104        pset = new PermissionSet(PermissionState.None);
     105        pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
     106      } else {
     107        pset = new PermissionSet(PermissionState.Unrestricted);
     108      }
     109      AppDomainSetup setup = new AppDomainSetup();
     110      setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
     111      //Temp Fix!
     112      setup.PrivateBinPath = "plugins";
     113      return System.AppDomain.CreateDomain("appD", AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly()));
     114
     115    }
     116
    67117    private void DetermineAction(MessageContainer container) {
    68118      if(container.Message == MessageContainer.MessageType.AbortJob)
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/ExecutionEnginePlugin.cs

    r762 r770  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
Note: See TracChangeset for help on using the changeset viewer.