- Timestamp:
- 12/01/08 14:42:57 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Communication/ServiceLocator.cs
r840 r882 13 13 proxy = new ClientCommunicatorClient( 14 14 new NetTcpBinding(), 15 new EndpointAddress("net.tcp://1 0.20.53.3:9000/HiveServer/ClientCommunicator")15 new EndpointAddress("net.tcp://192.168.132.1:9000/HiveServer/ClientCommunicator") 16 16 ); 17 17 } -
trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs
r843 r882 50 50 Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>(); 51 51 52 public static StrongName CreateStrongName(Assembly assembly) {53 if (assembly == null)54 throw new ArgumentNullException("assembly");55 56 AssemblyName assemblyName = assembly.GetName();57 Debug.Assert(assemblyName != null, "Could not get assembly name");58 59 // get the public key blob60 byte[] publicKey = assemblyName.GetPublicKey();61 if (publicKey == null || publicKey.Length == 0)62 throw new InvalidOperationException("Assembly is not strongly named");63 64 StrongNamePublicKeyBlob keyBlob = new StrongNamePublicKeyBlob(publicKey);65 66 // and create the StrongName67 return new StrongName(keyBlob, assemblyName.Name, assemblyName.Version);68 }69 70 52 private ClientCommunicatorClient clientCommunicator; 71 53 72 54 public void Start() { 73 DiscoveryService discService =55 /*DiscoveryService discService = 74 56 new DiscoveryService(); 75 57 IClientConsoleCommunicator[] clientCommunicatorInstances = … … 99 81 100 82 serviceHost.Open(); 101 } 83 }*/ 102 84 103 85 clientCommunicator = ServiceLocator.GetClientCommunicator(); … … 105 87 clientCommunicator.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(ClientCommunicator_PullJobCompleted); 106 88 clientCommunicator.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(ClientCommunicator_SendJobResultCompleted); 107 clientCommunicator.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo());89 //clientCommunicator.LoginAsync(ConfigurationManager.GetInstance().GetClientInfo()); 108 90 109 91 Heartbeat beat = new Heartbeat { Interval = 5000 }; … … 127 109 } else 128 110 Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage); 129 }130 131 private AppDomain CreateNewAppDomain(bool sandboxed) {132 PermissionSet pset;133 if (sandboxed) {134 pset = new PermissionSet(PermissionState.None);135 pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));136 } else {137 pset = new PermissionSet(PermissionState.Unrestricted);138 }139 AppDomainSetup setup = new AppDomainSetup();140 setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;141 //Temp Fix!142 setup.PrivateBinPath = "plugins";143 return System.AppDomain.CreateDomain("appD", AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly()));144 145 111 } 146 112 … … 188 154 bool sandboxed = false; 189 155 190 //IJob job = new TestJob { JobId = e.Result.JobId }; 191 192 PluginManager pm = PluginManager.Manager; 193 AppDomain appDomain = pm.CreateAndInitAppDomain("AppDomain"); 194 195 //AppDomain appDomain = CreateNewAppDomain(sandboxed); 156 AppDomain appDomain = PluginManager.Manager.CreateAndInitAppDomainWithSandbox(e.Result.JobId.ToString(), sandboxed); 157 196 158 appDomains.Add(e.Result.JobId, appDomain); 197 159 -
trunk/sources/HeuristicLab.Hive.Client.Core/Properties/AssemblyInfo.frame
r714 r882 23 23 using System.Runtime.CompilerServices; 24 24 using System.Runtime.InteropServices; 25 using System.Security; 25 26 using HeuristicLab.PluginInfrastructure; 26 27 … … 36 37 [assembly: AssemblyTrademark("")] 37 38 [assembly: AssemblyCulture("")] 39 [assembly: AllowPartiallyTrustedCallers] 38 40 39 41 // Setting ComVisible to false makes the types in this assembly not visible -
trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs
r766 r882 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Security.Policy; 25 using System.Reflection; 26 using System.Diagnostics; 27 using System.Security.Permissions; 28 using System.Security; 24 29 25 30 namespace HeuristicLab.PluginInfrastructure { … … 132 137 } 133 138 139 /// <summary> 140 /// Creates a new AppDomain with all plugins preloaded and Sandboxing capability 141 /// </summary> 142 /// <param name="assembly">Assembly reference</param> 143 /// <returns>the strongname of the assembly</returns> 144 private StrongName CreateStrongName(Assembly assembly) { 145 if (assembly == null) 146 throw new ArgumentNullException("assembly"); 147 148 AssemblyName assemblyName = assembly.GetName(); 149 Debug.Assert(assemblyName != null, "Could not get assembly name"); 150 151 // get the public key blob 152 byte[] publicKey = assemblyName.GetPublicKey(); 153 if (publicKey == null || publicKey.Length == 0) 154 throw new InvalidOperationException("Assembly is not strongly named"); 155 156 StrongNamePublicKeyBlob keyBlob = new StrongNamePublicKeyBlob(publicKey); 157 158 // and create the StrongName 159 return new StrongName(keyBlob, assemblyName.Name, assemblyName.Version); 160 } 161 162 public AppDomain CreateAndInitAppDomainWithSandbox(string friendlyName, bool sandboxed) { 163 164 PermissionSet pset; 165 if (sandboxed) { 166 pset = new PermissionSet(PermissionState.None); 167 pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); 168 } else { 169 pset = new PermissionSet(PermissionState.Unrestricted); 170 } 171 AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation; 172 setup.PrivateBinPath = pluginDir; 173 setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; 174 AppDomain applicationDomain = AppDomain.CreateDomain(friendlyName, AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly())); 175 176 Runner remoteRunner = (Runner)applicationDomain.CreateInstanceAndUnwrap(typeof(Runner).Assembly.GetName().Name, typeof(Runner).FullName); 177 NotifyListeners(PluginManagerAction.Initializing, "All plugins"); 178 if (remoteLoader != null) { 179 remoteRunner.LoadPlugins(remoteLoader.ActivePlugins); 180 } else if (LoadedPlugins != null && LoadedPlugins.Count > 0) { 181 remoteRunner.LoadPlugins(LoadedPlugins); 182 } 183 NotifyListeners(PluginManagerAction.Initialized, "All plugins"); 184 return applicationDomain; 185 } 134 186 135 187 /// <summary>
Note: See TracChangeset
for help on using the changeset viewer.