Index: /trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs	(revision 2592)
@@ -138,5 +138,5 @@
     /// </summary>
     /// <param name="plugins">bytearray of all assemblies that should be loaded</param>
-    public void LoadAssemblies(IEnumerable<byte[]> assemblies) {
+    internal void LoadAssemblies(IEnumerable<byte[]> assemblies) {
       foreach (byte[] asm in assemblies) {
         Assembly loadedAsm = Assembly.Load(asm);
@@ -156,5 +156,5 @@
     /// <typeparam name="T">Most general type.</typeparam>
     /// <returns>Enumerable of the created instances.</returns>
-    public static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
+    internal static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
       return from t in GetTypes(typeof(T), plugin)
              select (T)Activator.CreateInstance(t);
@@ -175,5 +175,5 @@
     /// <typeparam name="T">Most general type.</typeparam>
     /// <returns>Enumerable of the created instances.</returns>
-    public static IEnumerable<T> GetInstances<T>() where T : class {
+    internal static IEnumerable<T> GetInstances<T>() where T : class {
       return from i in GetInstances(typeof(T))
              select (T)i;
@@ -185,5 +185,5 @@
     /// <typeparam name="type">Most general type.</typeparam>
     /// <returns>Enumerable of the created instances.</returns>
-    public static IEnumerable<object> GetInstances(Type type) {
+    internal static IEnumerable<object> GetInstances(Type type) {
       return from t in GetTypes(type)
              select Activator.CreateInstance(t);
@@ -195,5 +195,5 @@
     /// <param name="type">Most general type for which to find matching types.</param>
     /// <returns>Enumerable of the discovered types.</returns>
-    public static IEnumerable<Type> GetTypes(Type type) {
+    internal static IEnumerable<Type> GetTypes(Type type) {
       return from asm in AppDomain.CurrentDomain.GetAssemblies()
              from t in GetTypes(type, asm)
@@ -208,5 +208,5 @@
     /// <param name="plugin">The plugin the subtypes must be part of.</param>
     /// <returns>Enumerable of the discovered types.</returns>
-    public static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
+    internal static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {
       PluginDescription pluginDesc = (PluginDescription)pluginDescription;
       return from asm in AppDomain.CurrentDomain.GetAssemblies()
@@ -252,5 +252,4 @@
     #region IApplicationManager Members
 
-
     IEnumerable<T> IApplicationManager.GetInstances<T>(IPluginDescription plugin) {
       return GetInstances<T>(plugin);
@@ -261,4 +260,8 @@
     }
 
+    IEnumerable<object> IApplicationManager.GetInstances(Type type) {
+      return GetInstances(type);
+    }
+
     IEnumerable<Type> IApplicationManager.GetTypes(Type type) {
       return GetTypes(type);
@@ -269,4 +272,15 @@
     }
 
+    /// <summary>
+    /// Finds the plugin that declares the <paramref name="type">type</paramref>.
+    /// </summary>
+    /// <param name="type">The type of interest.</param>
+    /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
+    public IPluginDescription GetDeclaringPlugin(Type type) {
+      foreach (PluginDescription info in Plugins) {
+        if (info.Assemblies.Contains(Path.GetFullPath(type.Assembly.Location))) return info;
+      }
+      return null;
+    }
     #endregion
   }
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs	(revision 2592)
@@ -35,5 +35,5 @@
     /// Initializes a new instance of <see cref="PluginBase"/>.
     /// </summary>
-    protected PluginBase() { }
+    public PluginBase() { }
 
     private PluginAttribute PluginAttribute {
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj	(revision 2592)
@@ -149,4 +149,6 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
+    <Compile Include="Sandboxing\ISandboxManager.cs" />
+    <Compile Include="Sandboxing\SandboxManager.cs" />
     <Compile Include="Service References\UpdateLocationReference\Reference.cs">
       <AutoGen>True</AutoGen>
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplicationManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplicationManager.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IApplicationManager.cs	(revision 2592)
@@ -41,10 +41,4 @@
 
     /// <summary>
-    /// Dynamically loads assemblies given in binary form.
-    /// </summary>
-    /// <param name="assemblies">Assemblies that should be loaded in binary form.</param>
-    void LoadAssemblies(IEnumerable<byte[]> assemblies);
-
-    /// <summary>
     /// Discovers and creates instances of <typeparamref name="T"/> and all types implementing or inheriting <typeparamref name="T"/> (directly and indirectly) declared in any assembly of <paramref name="plugin"/>.
     /// </summary>
@@ -61,4 +55,11 @@
 
     /// <summary>
+    /// Discovers and creates instances of <paramref name="type"/> and all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
+    /// </summary>
+    /// <param name="type">The type or super-type to discover.</typeparam>
+    /// <returns>An enumerable of instances of the discovered types.</returns>
+    IEnumerable<object> GetInstances(Type type);
+
+    /// <summary>
     /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
     /// </summary>
@@ -73,4 +74,10 @@
     /// <returns>An enumerable of discovered types.</returns>
     IEnumerable<Type> GetTypes(Type type, IPluginDescription plugin);
+    /// <summary>
+    /// Finds the plugin that declares the <paramref name="type">type</paramref>.
+    /// </summary>
+    /// <param name="type">The type of interest.</param>
+    /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
+    IPluginDescription GetDeclaringPlugin(Type type);
   }
 }
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs	(revision 2592)
@@ -32,4 +32,20 @@
     /// </summary>
     string Name { get; }
+    /// <summary>
+    /// Gets the version of the plugin.
+    /// </summary>
+    Version Version { get; }
+    /// <summary>
+    /// Gets the build date of the plugin.
+    /// </summary>
+    DateTime BuildDate { get; }
+    /// <summary>
+    /// Gets the dependencies of the plugin.
+    /// </summary>
+    IEnumerable<IPluginDescription> Dependencies { get; }
+    /// <summary>
+    /// Gets the file names of files that are part of the plugin.
+    /// </summary>
+    IEnumerable<string> Files { get; }
   }
 }
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs	(revision 2592)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Text;
+using System.Linq;
 
 namespace HeuristicLab.PluginInfrastructure.Manager {
@@ -35,5 +36,5 @@
     private string name;
     /// <summary>
-    /// Gets or sets the name of the plugin.
+    /// Gets the name of the plugin.
     /// </summary>
     public string Name {
@@ -52,17 +53,17 @@
     private Version version;
     /// <summary>
-    /// Gets or sets the version of the plugin.
+    /// Gets the version of the plugin.
     /// </summary>
-    internal Version Version {
+    public Version Version {
       get { return version; }
-      set { version = value; }
+      internal set { version = value; }
     }
     private DateTime buildDate;
     /// <summary>
-    /// Gets or sets the build date of the plugin.
+    /// Gets the build date of the plugin.
     /// </summary>
-    internal DateTime BuildDate {
+    public DateTime BuildDate {
       get { return buildDate; }
-      set { buildDate = value; }
+      internal set { buildDate = value; }
     }
 
@@ -81,5 +82,5 @@
     /// These files are deleted when the plugin is removed or updated.
     /// </summary>
-    internal IEnumerable<string> Files {
+    public IEnumerable<string> Files {
       get { return files; }
     }
@@ -90,9 +91,12 @@
 
     private List<PluginDescription> dependencies = new List<PluginDescription>();
+    internal IEnumerable<PluginDescription> Dependencies {
+      get { return dependencies; }
+    }
     /// <summary>
     /// Gets all dependencies of the plugin.
     /// </summary>
-    internal IEnumerable<PluginDescription> Dependencies {
-      get { return dependencies; }
+    IEnumerable<IPluginDescription> IPluginDescription.Dependencies {
+      get { return dependencies.Cast<IPluginDescription>(); }
     }
 
@@ -100,5 +104,4 @@
       dependencies.Add(dependency);
     }
-
 
     private List<string> assemblies = new List<string>();
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginManager.cs	(revision 2591)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginManager.cs	(revision 2592)
@@ -112,6 +112,6 @@
 
     /// <summary>
-    /// Starts and application in a separate AppDomain.
-    /// Loads all enabled plugins and starts the application via a PluginRunner instance activated in the new AppDomain.
+    /// Starts an application in a separate AppDomain.
+    /// Loads all enabled plugins and starts the application via an ApplicationManager instance activated in the new AppDomain.
     /// </summary>
     /// <param name="appInfo">application to run</param>
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/ISandboxManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/ISandboxManager.cs	(revision 2592)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/ISandboxManager.cs	(revision 2592)
@@ -0,0 +1,36 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Reflection;
+
+namespace HeuristicLab.PluginInfrastructure.Sandboxing {
+  /// <summary>
+  /// Interface for sandbox managers.
+  /// </summary>
+  public interface ISandboxManager {
+    AppDomain CreateAndInitSandbox(string name);
+    AppDomain CreateAndInitSandbox(string name, IEnumerable<byte[]> files);
+  }
+}
Index: /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/SandboxManager.cs
===================================================================
--- /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/SandboxManager.cs	(revision 2592)
+++ /trunk/sources/HeuristicLab.PluginInfrastructure/Sandboxing/SandboxManager.cs	(revision 2592)
@@ -0,0 +1,82 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.PluginInfrastructure.Manager;
+using System.IO;
+using System.ComponentModel;
+using HeuristicLab.PluginInfrastructure.UpdateLocationReference;
+using System.Security;
+using System.Security.Permissions;
+using System.Security.Policy;
+using System.Reflection;
+using System.Diagnostics;
+
+namespace HeuristicLab.PluginInfrastructure.Sandboxing {
+  public class SandboxManager {
+
+    private static StrongName CreateStrongName(Assembly assembly) {
+      if (assembly == null)
+        throw new ArgumentNullException("assembly");
+
+      AssemblyName assemblyName = assembly.GetName();
+      Trace.Assert(assemblyName != null, "Could not get assembly name");
+
+      // get the public key blob
+      byte[] publicKey = assemblyName.GetPublicKey();
+      if (publicKey == null || publicKey.Length == 0)
+        throw new InvalidOperationException("Assembly is not strongly named");
+
+      StrongNamePublicKeyBlob keyBlob = new StrongNamePublicKeyBlob(publicKey);
+
+      // and create the StrongName
+      return new StrongName(keyBlob, assemblyName.Name, assemblyName.Version);
+    }
+
+    #region ISandboxManager Members
+
+    public static AppDomain CreateAndInitSandbox(string name) {
+      return CreateAndInitSandbox(name, Enumerable.Empty<byte[]>());
+    }
+
+
+    public static AppDomain CreateAndInitSandbox(string name, IEnumerable<byte[]> files) {
+      PermissionSet pset;
+
+      #region permission set for sandbox
+      // Uncomment code for sandboxed appdomain
+      //pset = new PermissionSet(PermissionState.None);
+      //pset.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
+      //pset.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
+      //FileIOPermission fPerm = new FileIOPermission(PermissionState.None);
+
+      //foreach (IPluginDescription plugin in ApplicationManager.Manager.Plugins) {
+      //  fPerm.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.PathDiscovery, plugin.Files.ToArray());
+      //}
+
+      //pset.AddPermission(fPerm);
+      #endregion
+
+      #region permission set of unrestricted appdomain
+      // unrestricted appdomain 
+      pset = new PermissionSet(PermissionState.Unrestricted);
+      #endregion 
+
+      AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
+      //setup.PrivateBinPath = pluginDir;
+      setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
+      AppDomain applicationDomain = AppDomain.CreateDomain(name, AppDomain.CurrentDomain.Evidence, setup, pset, CreateStrongName(Assembly.GetExecutingAssembly()));
+      Type applicationManagerType = typeof(ApplicationManager);
+      ApplicationManager applicationManager =
+        (ApplicationManager)applicationDomain.CreateInstanceAndUnwrap(applicationManagerType.Assembly.FullName, applicationManagerType.FullName, true, BindingFlags.NonPublic | BindingFlags.Instance, null, null, null, null, null);
+      ApplicationDescription[] apps = ApplicationManager.Manager.Applications.Cast<ApplicationDescription>().ToArray();
+      PluginDescription[] plugins = ApplicationManager.Manager.Plugins.Cast<PluginDescription>().ToArray();
+      applicationManager.PrepareApplicationDomain(apps, plugins);
+      if (files != null && files.Count() > 0)
+        applicationManager.LoadAssemblies(files);
+      return applicationDomain;
+    }
+
+    #endregion
+  }
+}
