Index: /branches/OaaS/HeuristicLab 3.3 Services.sln
===================================================================
--- /branches/OaaS/HeuristicLab 3.3 Services.sln	(revision 8505)
+++ /branches/OaaS/HeuristicLab 3.3 Services.sln	(revision 8506)
@@ -39,5 +39,5 @@
 		Release.AspNetCompiler.FixedNames = "false"
 		Release.AspNetCompiler.Debug = "False"
-		VWDPort = "4591"
+		VWDPort = "1512"
 		VWDVirtualPath = "/Hive-3.3"
 		DefaultWebSiteLanguage = "Visual C#"
Index: /branches/OaaS/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs	(revision 8506)
@@ -49,4 +49,13 @@
     }
 
+    private string endpointConfigurationName;
+
+    public string EndpointConfigurationName
+    {
+      get { return endpointConfigurationName; }
+      set { endpointConfigurationName = value; }
+    }
+
+
     private string remoteAddress;
     public string RemoteAddress {
@@ -59,5 +68,5 @@
       get { return identityCertificate; }
       set { identityCertificate = value; }
-    }
+    }    
 
     private HiveServiceClient NewServiceClient() {
@@ -66,5 +75,5 @@
         cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>();
       else {
-        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(null, null, username, password);
+        cl = ClientFactory.CreateClient<HiveServiceClient, IHiveService>(endpointConfigurationName, null, username, password);
       }
 
Index: /branches/OaaS/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs	(revision 8506)
@@ -27,4 +27,5 @@
     string Password { get; set; }
     string RemoteAddress { get; set; }
+    string EndpointConfigurationName { get; set; }
     string IdentityCertificate { get; set; }
     void CallHiveService(Action<IHiveService> call);
Index: /branches/OaaS/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs	(revision 8506)
@@ -101,5 +101,5 @@
           throw new PersistenceException("Could not load persistence settings.", e);
         } else {
-          Logger.Warn("Could not load settings.", e);
+          //Logger.Warn("Could not load settings.", e);
         }
       }
Index: /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ApplicationManager.cs
===================================================================
--- /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ApplicationManager.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ApplicationManager.cs	(revision 8506)
@@ -37,5 +37,5 @@
       get {
         if (appManager == null)
-          appManager = new LightweightApplicationManager();
+          appManager = new WebApplicationManager();
         return appManager;
       }
Index: /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj	(revision 8505)
+++ /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj	(revision 8506)
@@ -231,4 +231,5 @@
     <Compile Include="BaseClasses\ApplicationBase.cs" />
     <Compile Include="BaseClasses\PluginBase.cs" />
+    <Compile Include="WebApplicationManager.cs" />
     <Compile Include="SandboxApplicationManager.cs" />
     <Compile Include="DefaultApplicationManager.cs" />
Index: /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs
===================================================================
--- /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs	(revision 8506)
+++ /branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs	(revision 8506)
@@ -0,0 +1,567 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.IO;
+using System.Linq;
+using System.Reflection;
+using HeuristicLab.PluginInfrastructure.Manager;
+using System.Text;
+
+namespace HeuristicLab.PluginInfrastructure {
+
+  /// <summary>
+  /// The SandboxApplicationManager provides properties to retrieve the list of available plugins and applications.
+  /// It also provides methods for type discovery and instantiation for types declared in plugins.
+  /// The SandboxApplicationManager is used in sandboxed Application Domains where permissions are restricted and
+  /// only partially-trusted code can be executed. 
+  /// </summary>
+  internal class WebApplicationManager : MarshalByRefObject, IApplicationManager {
+    // private class to store plugin dependency declarations while reflecting over plugins
+    private class PluginDependency
+    {
+      public string Name { get; private set; }
+      public Version Version { get; private set; }
+
+      public PluginDependency(string name, Version version)
+      {
+        this.Name = name;
+        this.Version = version;
+      }
+    }
+
+    /// <summary>
+    /// Fired when a plugin is loaded.
+    /// </summary>
+    internal event EventHandler<PluginInfrastructureEventArgs> PluginLoaded;
+    /// <summary>
+    /// Fired when a plugin is unloaded (when the application terminates).
+    /// </summary>
+    internal event EventHandler<PluginInfrastructureEventArgs> PluginUnloaded;
+
+    // cache for the AssemblyResolveEvent 
+    // which must be handled when assemblies are loaded dynamically after the application start
+    protected internal Dictionary<string, Assembly> loadedAssemblies;
+
+    private List<IPlugin> loadedPlugins;
+
+    private List<PluginDescription> plugins;
+    /// <summary>
+    /// Gets all plugins.
+    /// </summary>
+    public IEnumerable<IPluginDescription> Plugins {
+      get { return plugins.Cast<IPluginDescription>(); }
+    }
+
+    private List<ApplicationDescription> applications;
+    /// <summary>
+    /// Gets all installed applications.
+    /// </summary>
+    public IEnumerable<IApplicationDescription> Applications {
+      get { return applications.Cast<IApplicationDescription>(); }
+    }
+
+    internal WebApplicationManager()
+      : base() {
+      loadedAssemblies = new Dictionary<string, Assembly>();
+      loadedPlugins = new List<IPlugin>();
+      plugins = GatherPluginDescriptions();
+    }
+
+    // find all types implementing IPlugin in the reflectionOnlyAssemblies and create a list of plugin descriptions
+    // the dependencies in the plugin descriptions are not yet set correctly because we need to create
+    // the full list of all plugin descriptions first
+    private List<PluginDescription> GatherPluginDescriptions()
+    {
+      List<PluginDescription> pluginDescriptions = new List<PluginDescription>();
+      foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
+      {
+        // GetExportedTypes throws FileNotFoundException when a referenced assembly
+        // of the current assembly is missing.
+        try {
+          // loadedAssemblies.Add(assembly.GetName().Name, assembly);
+          // if there is a type that implements IPlugin
+          // use AssemblyQualifiedName to compare the types because we can't directly 
+          // compare ReflectionOnly types and execution types
+          var assemblyPluginDescriptions = from t in assembly.GetExportedTypes()
+                                           where !t.IsAbstract && t.GetInterfaces().Any(x => x.AssemblyQualifiedName == typeof(IPlugin).AssemblyQualifiedName)
+                                           select GetPluginDescription(t);
+          pluginDescriptions.AddRange(assemblyPluginDescriptions);
+        }
+        // ignore exceptions. Just don't yield a plugin description when an exception is thrown
+        catch (NotSupportedException) {
+        }
+        catch (FileNotFoundException) {
+        }
+        catch (FileLoadException) {
+        }
+        catch (InvalidPluginException) {
+        }
+        catch (TypeLoadException) {
+        }
+        catch (MissingMemberException) {
+        }
+      }
+      return pluginDescriptions;
+    }
+
+    /// <summary>
+    /// Extracts plugin information for this type.
+    /// Reads plugin name, list and type of files and dependencies of the plugin. This information is necessary for
+    /// plugin dependency checking before plugin activation.
+    /// </summary>
+    /// <param name="pluginType"></param>
+    private PluginDescription GetPluginDescription(Type pluginType)
+    {
+
+      string pluginName, pluginDescription, pluginVersion;
+      string contactName, contactAddress;
+      GetPluginMetaData(pluginType, out pluginName, out pluginDescription, out pluginVersion);
+      GetPluginContactMetaData(pluginType, out contactName, out contactAddress);
+      var pluginFiles = GetPluginFilesMetaData(pluginType);
+      var pluginDependencies = GetPluginDependencyMetaData(pluginType);
+
+      // minimal sanity check of the attribute values
+      if (!string.IsNullOrEmpty(pluginName) &&
+          pluginFiles.Count() > 0 &&                                 // at least one file
+          pluginFiles.Any(f => f.Type == PluginFileType.Assembly))
+      { // at least one assembly
+        // create a temporary PluginDescription that contains the attribute values
+        PluginDescription info = new PluginDescription();
+        info.Name = pluginName;
+        info.Description = pluginDescription;
+        info.Version = new Version(pluginVersion);
+        info.ContactName = contactName;
+        info.ContactEmail = contactAddress;
+        info.LicenseText = ReadLicenseFiles(pluginFiles);
+        info.AddFiles(pluginFiles);
+
+        //this.pluginDependencies[info] = pluginDependencies;
+        return info;
+      }
+      else
+      {
+        throw new InvalidPluginException("Invalid metadata in plugin " + pluginType.ToString());
+      }
+    }
+
+    private static string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles)
+    {
+      // combine the contents of all plugin files 
+      var licenseFiles = from file in pluginFiles
+                         where file.Type == PluginFileType.License
+                         select file;
+      if (licenseFiles.Count() == 0) return string.Empty;
+      StringBuilder licenseTextBuilder = new StringBuilder();
+      licenseTextBuilder.AppendLine(File.ReadAllText(licenseFiles.First().Name));
+      foreach (var licenseFile in licenseFiles.Skip(1))
+      {
+        licenseTextBuilder.AppendLine().AppendLine(); // leave some empty space between multiple license files
+        licenseTextBuilder.AppendLine(File.ReadAllText(licenseFile.Name));
+      }
+      return licenseTextBuilder.ToString();
+    }
+
+    private static IEnumerable<PluginDependency> GetPluginDependencyMetaData(Type pluginType)
+    {
+      // get all attributes of type PluginDependency
+      var dependencyAttributes = from attr in CustomAttributeData.GetCustomAttributes(pluginType)
+                                 where IsAttributeDataForType(attr, typeof(PluginDependencyAttribute))
+                                 select attr;
+
+      foreach (var dependencyAttr in dependencyAttributes)
+      {
+        string name = (string)dependencyAttr.ConstructorArguments[0].Value;
+        Version version = new Version("0.0.0.0"); // default version
+        // check if version is given for now
+        // later when the constructor of PluginDependencyAttribute with only one argument has been removed
+        // this conditional can be removed as well
+        if (dependencyAttr.ConstructorArguments.Count > 1)
+        {
+          try
+          {
+            version = new Version((string)dependencyAttr.ConstructorArguments[1].Value); // might throw FormatException
+          }
+          catch (FormatException ex)
+          {
+            throw new InvalidPluginException("Invalid version format of dependency " + name + " in plugin " + pluginType.ToString(), ex);
+          }
+        }
+        yield return new PluginDependency(name, version);
+      }
+    }
+
+    private static bool IsAttributeDataForType(CustomAttributeData attributeData, Type attributeType)
+    {
+      return attributeData.Constructor.DeclaringType.AssemblyQualifiedName == attributeType.AssemblyQualifiedName;
+    }
+
+    private static void GetPluginContactMetaData(Type pluginType, out string contactName, out string contactAddress)
+    {
+      // get attribute of type ContactInformation if there is any
+      var contactInfoAttribute = (from attr in CustomAttributeData.GetCustomAttributes(pluginType)
+                                  where IsAttributeDataForType(attr, typeof(ContactInformationAttribute))
+                                  select attr).SingleOrDefault();
+
+      if (contactInfoAttribute != null)
+      {
+        contactName = (string)contactInfoAttribute.ConstructorArguments[0].Value;
+        contactAddress = (string)contactInfoAttribute.ConstructorArguments[1].Value;
+      }
+      else
+      {
+        contactName = string.Empty;
+        contactAddress = string.Empty;
+      }
+    }
+
+    // not static because we need the PluginDir property
+    private IEnumerable<PluginFile> GetPluginFilesMetaData(Type pluginType)
+    {
+      // get all attributes of type PluginFileAttribute
+      var pluginFileAttributes = from attr in CustomAttributeData.GetCustomAttributes(pluginType)
+                                 where IsAttributeDataForType(attr, typeof(PluginFileAttribute))
+                                 select attr;
+      foreach (var pluginFileAttribute in pluginFileAttributes)
+      {
+        string pluginFileName = (string)pluginFileAttribute.ConstructorArguments[0].Value;
+        PluginFileType fileType = (PluginFileType)pluginFileAttribute.ConstructorArguments[1].Value;
+        yield return new PluginFile(Path.GetFullPath(Path.Combine(@"C:\dev\Heuristiclab\branches\OaaS\bin", pluginFileName)), fileType);
+      }
+    }
+
+    private static void GetPluginMetaData(Type pluginType, out string pluginName, out string pluginDescription, out string pluginVersion)
+    {
+      // there must be a single attribute of type PluginAttribute
+      var pluginMetaDataAttr = (from attr in CustomAttributeData.GetCustomAttributes(pluginType)
+                                where IsAttributeDataForType(attr, typeof(PluginAttribute))
+                                select attr).Single();
+
+      pluginName = (string)pluginMetaDataAttr.ConstructorArguments[0].Value;
+
+      // default description and version
+      pluginVersion = "0.0.0.0";
+      pluginDescription = string.Empty;
+      if (pluginMetaDataAttr.ConstructorArguments.Count() == 2)
+      {
+        // if two arguments are given the second argument is the version
+        pluginVersion = (string)pluginMetaDataAttr.ConstructorArguments[1].Value;
+      }
+      else if (pluginMetaDataAttr.ConstructorArguments.Count() == 3)
+      {
+        // if three arguments are given the second argument is the description and the third is the version
+        pluginDescription = (string)pluginMetaDataAttr.ConstructorArguments[1].Value;
+        pluginVersion = (string)pluginMetaDataAttr.ConstructorArguments[2].Value;
+      }
+    }
+
+    /// <summary>
+    /// Prepares the application domain for the execution of an HL application.
+    /// Pre-loads all <paramref name="plugins"/>.
+    /// </summary>
+    /// <param name="apps">Enumerable of available HL applications.</param>
+    /// <param name="plugins">Enumerable of plugins that should be pre-loaded.</param>  
+    internal void PrepareApplicationDomain(IEnumerable<ApplicationDescription> apps, IEnumerable<PluginDescription> plugins) {
+      this.plugins = new List<PluginDescription>(plugins);
+      this.applications = new List<ApplicationDescription>(apps);
+      ApplicationManager.RegisterApplicationManager(this);
+      LoadPlugins(plugins);
+    }
+
+    /// <summary>
+    /// Loads the <paramref name="plugins"/> into this application domain.
+    /// </summary>
+    /// <param name="plugins">Enumerable of plugins that should be loaded.</param>
+    private void LoadPlugins(IEnumerable<PluginDescription> plugins) {
+      // load all loadable plugins (all dependencies available) into the execution context
+      foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
+        foreach (string fileName in desc.AssemblyLocations) {
+          // load assembly reflection only first to get the full assembly name
+          var reflectionOnlyAssembly = Assembly.ReflectionOnlyLoadFrom(fileName);
+          // load the assembly into execution context using full assembly name
+          var asm = Assembly.Load(reflectionOnlyAssembly.FullName);
+          RegisterLoadedAssembly(asm);
+          // instantiate and load all plugins in this assembly
+          foreach (var plugin in GetInstances<IPlugin>(asm)) {
+            plugin.OnLoad();
+            loadedPlugins.Add(plugin);
+          }
+        }
+        OnPluginLoaded(new PluginInfrastructureEventArgs(desc));
+        desc.Load();
+      }
+    }
+
+    /// <summary>
+    /// Runs the application declared in <paramref name="appInfo"/>.
+    /// This is a synchronous call. When the application is terminated all plugins are unloaded.
+    /// </summary>
+    /// <param name="appInfo">Description of the application to run</param>
+    internal void Run(ApplicationDescription appInfo) {
+      IApplication runnablePlugin = (IApplication)Activator.CreateInstance(appInfo.DeclaringAssemblyName, appInfo.DeclaringTypeName).Unwrap();
+      try {
+        runnablePlugin.Run();
+      }
+      finally {
+        // unload plugins in reverse order
+        foreach (var plugin in loadedPlugins.Reverse<IPlugin>()) {
+          plugin.OnUnload();
+        }
+        foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) {
+          desc.Unload();
+          OnPluginUnloaded(new PluginInfrastructureEventArgs(desc));
+        }
+      }
+    }
+
+    // register assembly in the assembly cache for the AssemblyResolveEvent
+    private void RegisterLoadedAssembly(Assembly asm) {
+      if (loadedAssemblies.ContainsKey(asm.FullName) || loadedAssemblies.ContainsKey(asm.GetName().Name)) {
+        throw new ArgumentException("An assembly with the name " + asm.GetName().Name + " has been registered already.", "asm");
+      }
+      loadedAssemblies.Add(asm.FullName, asm);
+      loadedAssemblies.Add(asm.GetName().Name, asm); // add short name
+    }
+
+    /// <summary>
+    /// Creates an instance of all types that are subtypes or the same type of the specified type and declared in <paramref name="plugin"/>
+    /// </summary>
+    /// <typeparam name="T">Most general type.</typeparam>
+    /// <returns>Enumerable of the created instances.</returns>
+    internal static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {
+      List<T> instances = new List<T>();
+      foreach (Type t in GetTypes(typeof(T), plugin, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
+        T instance = null;
+        try { instance = (T)Activator.CreateInstance(t); }
+        catch { }
+        if (instance != null) instances.Add(instance);
+      }
+      return instances;
+    }
+    /// <summary>
+    /// Creates an instance of all types declared in assembly <paramref name="asm"/> that are subtypes or the same type of the specified <typeparamref name="type"/>. 
+    /// </summary>
+    /// <typeparam name="T">Most general type.</typeparam>
+    /// <param name="asm">Declaring assembly.</param>
+    /// <returns>Enumerable of the created instances.</returns>
+    private static IEnumerable<T> GetInstances<T>(Assembly asm) where T : class {
+      List<T> instances = new List<T>();
+      foreach (Type t in GetTypes(typeof(T), asm, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
+        T instance = null;
+        try { instance = (T)Activator.CreateInstance(t); }
+        catch { }
+        if (instance != null) instances.Add(instance);
+      }
+      return instances;
+    }
+    /// <summary>
+    /// Creates an instance of all types that are subtypes or the same type of the specified type
+    /// </summary>
+    /// <typeparam name="T">Most general type.</typeparam>
+    /// <returns>Enumerable of the created instances.</returns>
+    internal static IEnumerable<T> GetInstances<T>() where T : class {
+      return from i in GetInstances(typeof(T))
+             select (T)i;
+    }
+
+    /// <summary>
+    /// Creates an instance of all types that are subtypes or the same type of the specified type
+    /// </summary>
+    /// <param name="type">Most general type.</param>
+    /// <returns>Enumerable of the created instances.</returns>
+    internal static IEnumerable<object> GetInstances(Type type) {
+      List<object> instances = new List<object>();
+      foreach (Type t in GetTypes(type, onlyInstantiable: true, includeGenericTypeDefinitions: false)) {
+        object instance = null;
+        try { instance = Activator.CreateInstance(t); }
+        catch { }
+        if (instance != null) instances.Add(instance);
+      }
+      return instances;
+    }
+
+    /// <summary>
+    /// Finds all types that are subtypes or equal to the specified type.
+    /// </summary>
+    /// <param name="type">Most general type for which to find matching types.</param>
+    /// <param name="onlyInstantiable">Return only types that are instantiable 
+    /// <param name="includeGenericTypeDefinitions">Specifies if generic type definitions shall be included</param>
+    /// (interfaces, abstract classes... are not returned)</param>
+    /// <returns>Enumerable of the discovered types.</returns>
+    internal static IEnumerable<Type> GetTypes(Type type, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
+      return from asm in AppDomain.CurrentDomain.GetAssemblies()
+             from t in GetTypes(type, asm, onlyInstantiable, includeGenericTypeDefinitions)
+             select t;
+    }
+
+    internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool includeGenericTypeDefinitions, bool assignableToAllTypes) {
+      IEnumerable<Type> result = GetTypes(types.First(), onlyInstantiable, includeGenericTypeDefinitions);
+      foreach (Type type in types.Skip(1)) {
+        IEnumerable<Type> discoveredTypes = GetTypes(type, onlyInstantiable, includeGenericTypeDefinitions);
+        if (assignableToAllTypes) result = result.Intersect(discoveredTypes);
+        else result = result.Union(discoveredTypes);
+      }
+      return result;
+    }
+
+    /// <summary>
+    /// Finds all types that are subtypes or equal to the specified type if they are part of the given
+    /// <paramref name="pluginDescription"/>.
+    /// </summary>
+    /// <param name="type">Most general type for which to find matching types.</param>
+    /// <param name="pluginDescription">The plugin the subtypes must be part of.</param>
+    /// <param name="onlyInstantiable">Return only types that are instantiable 
+    /// <param name="includeGenericTypeDefinitions">Specifies if generic type definitions shall be included</param>
+    /// (interfaces, abstract classes... are not returned)</param>
+    /// <returns>Enumerable of the discovered types.</returns>
+    internal static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
+      PluginDescription pluginDesc = (PluginDescription)pluginDescription;
+      return from asm in AppDomain.CurrentDomain.GetAssemblies()
+             where !asm.IsDynamic && !string.IsNullOrEmpty(asm.Location)
+             where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase))
+             from t in GetTypes(type, asm, onlyInstantiable, includeGenericTypeDefinitions)
+             select t;
+    }
+
+    internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription pluginDescription, bool onlyInstantiable, bool includeGenericTypeDefinitions, bool assignableToAllTypes) {
+      IEnumerable<Type> result = GetTypes(types.First(), pluginDescription, onlyInstantiable, includeGenericTypeDefinitions);
+      foreach (Type type in types.Skip(1)) {
+        IEnumerable<Type> discoveredTypes = GetTypes(type, pluginDescription, onlyInstantiable, includeGenericTypeDefinitions);
+        if (assignableToAllTypes) result = result.Intersect(discoveredTypes);
+        else result = result.Union(discoveredTypes);
+      }
+      return result;
+    }
+
+    /// <summary>
+    /// Gets types that are assignable (same of subtype) to the specified type only from the given assembly.
+    /// </summary>
+    /// <param name="type">Most general type we want to find.</param>
+    /// <param name="assembly">Assembly that should be searched for types.</param>
+    /// <param name="onlyInstantiable">Return only types that are instantiable 
+    /// (interfaces, abstract classes...  are not returned)</param>
+    /// <param name="includeGenericTypeDefinitions">Specifies if generic type definitions shall be included</param>
+    /// <returns>Enumerable of the discovered types.</returns>
+    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
+      var buildTypes = from t in assembly.GetTypes()
+                       where CheckTypeCompatibility(type, t)
+                       where !IsNonDiscoverableType(t)
+                       where onlyInstantiable == false ||
+                             (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
+                       select BuildType(t, type);
+
+      return from t in buildTypes
+             where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
+             select t;
+    }
+
+
+    private static bool IsNonDiscoverableType(Type t) {
+      return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
+    }
+
+    private static bool CheckTypeCompatibility(Type type, Type other) {
+      if (type.IsAssignableFrom(other))
+        return true;
+      if (type.IsGenericType && other.IsGenericType) {
+        var otherGenericArguments = other.GetGenericArguments();
+        var typeGenericArguments = type.GetGenericArguments();
+
+        //check type arguments count
+        if (otherGenericArguments.Length != typeGenericArguments.Length)
+          return false;
+
+        //check type arguments & constraints
+        int i = 0;
+        foreach (var genericArgument in typeGenericArguments) {
+          if (otherGenericArguments[i].IsGenericParameter) {
+            foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
+              if (!constraint.IsAssignableFrom(genericArgument)) return false;
+          } else if (genericArgument != otherGenericArguments[i]) return false;
+          i++;
+        }
+        //check types
+        try {
+          var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
+          if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
+            return true;
+        }
+        catch (Exception) { }
+      }
+      return false;
+    }
+    private static Type BuildType(Type type, Type protoType) {
+      if (type.IsGenericType && protoType.IsGenericType)
+        return type.GetGenericTypeDefinition().MakeGenericType(protoType.GetGenericArguments());
+      else
+        return type;
+    }
+
+    private void OnPluginLoaded(PluginInfrastructureEventArgs e) {
+      if (PluginLoaded != null) PluginLoaded(this, e);
+    }
+
+    private void OnPluginUnloaded(PluginInfrastructureEventArgs e) {
+      if (PluginUnloaded != null) PluginUnloaded(this, e);
+    }
+
+    #region IApplicationManager Members
+
+    IEnumerable<T> IApplicationManager.GetInstances<T>() {
+      return GetInstances<T>();
+    }
+
+    IEnumerable<object> IApplicationManager.GetInstances(Type type) {
+      return GetInstances(type);
+    }
+
+    IEnumerable<Type> IApplicationManager.GetTypes(Type type, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
+      return GetTypes(type, onlyInstantiable, includeGenericTypeDefinitions);
+    }
+    IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, bool onlyInstantiable, bool includeGenericTypeDefinitions, bool assignableToAllTypes) {
+      return GetTypes(types, onlyInstantiable, includeGenericTypeDefinitions, assignableToAllTypes);
+    }
+
+    IEnumerable<Type> IApplicationManager.GetTypes(Type type, IPluginDescription plugin, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
+      return GetTypes(type, plugin, onlyInstantiable, includeGenericTypeDefinitions);
+    }
+    IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable, bool includeGenericTypeDefinitions, bool assignableToAllTypes) {
+      return GetTypes(types, plugin, onlyInstantiable, includeGenericTypeDefinitions, assignableToAllTypes);
+    }
+
+    /// <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) {
+      if (type == null) throw new ArgumentNullException("type");
+      var name = type.Assembly.GetName().Name;
+      foreach (PluginDescription info in Plugins) {
+        var f = Path.GetFileNameWithoutExtension(info.Files.ElementAt(0).Name);
+        if (f.Contains(name)) return info;
+      }
+      return null;
+    }
+    #endregion
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Hive.WebRole/HeuristicLab.Services.Hive.WebRole.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Hive.WebRole/HeuristicLab.Services.Hive.WebRole.csproj	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Hive.WebRole/HeuristicLab.Services.Hive.WebRole.csproj	(revision 8506)
@@ -129,5 +129,7 @@
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Web.config" />
+    <Content Include="Web.config">
+      <SubType>Designer</SubType>
+    </Content>
     <Content Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
Index: /branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveService.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 8506)
@@ -80,8 +80,7 @@
     public Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
-        task.ParentTaskId = parentTaskId;
-        return AddTask(task, taskData, dao.GetAssignedResources(parentTaskId).Select(x => x.Id));
-      }, false, true);
+      var assignedResources = dao.GetAssignedResources(parentTaskId).Select(x => x.Id);
+      task.ParentTaskId = parentTaskId;
+      return AddTask(task, taskData, assignedResources);      
     }
 
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj	(revision 8506)
@@ -32,4 +32,93 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
+      <HintPath>..\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Clients.Hive-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Clients.Hive-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\bin\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\bin\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>..\bin\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
+      <HintPath>..\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3">
+      <HintPath>..\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3">
+      <HintPath>..\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding.Views-3.3">
+      <HintPath>..\bin\HeuristicLab.Encodings.PermutationEncoding.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3">
+      <HintPath>..\bin\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
+      <HintPath>..\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4">
+      <HintPath>..\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Hive-3.3">
+      <HintPath>..\bin\HeuristicLab.Hive-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>..\HeuristicLab.Optimization\3.3\obj\Debug\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances-3.3">
+      <HintPath>..\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TravelingSalesman-3.3">
+      <HintPath>..\bin\HeuristicLab.Problems.TravelingSalesman-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Selection-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Selection-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\bin\HeuristicLab.Tracing-3.3.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -43,8 +132,14 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="HiveScenarioManager.cs" />
     <Compile Include="Interfaces\IControllerService.cs" />
+    <Compile Include="Interfaces\IScenarioManager.cs" />
     <Compile Include="Model\ControllerModel.cs" />
     <Compile Include="PlaceholderControllerService.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Utility.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/HiveScenarioManager.cs	(revision 8506)
@@ -0,0 +1,147 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
+using HeuristicLab.Optimization;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
+using HeuristicLab.Problems.TravelingSalesman;
+using HeuristicLab;
+using System.Reflection;
+using HeuristicLab.Services.Optimization.ControllerService.Model;
+using HeuristicLab.Core;
+using System.Collections;
+using HeuristicLab.Clients.Hive;
+using System.Threading;
+
+namespace HeuristicLab.Services.Optimization.ControllerService {
+  public class HiveScenarioManager : IScenarioManager {
+    public object MapControllerDataType(object model, Parameter param) {
+      switch (param.Type) {
+        case ParameterType.Boolean:
+          return (param.Value as Model.BoolValue).Value;
+        case ParameterType.Integer:
+          return Convert.ToInt32((param.Value as Model.DecimalValue).Value);          
+        case ParameterType.Percent:        
+        case ParameterType.Decimal:
+          return (param.Value as Model.DecimalValue).Value;
+        case ParameterType.DecimalMatrix:
+          return Utility.ToMultiD(((param.Value as Model.DecimalMatrix).Value));
+        case ParameterType.DecimalVector:
+          return (param.Value as Model.DecimalVector).Value;
+        case ParameterType.Type:
+          //TODO handle type correctly!
+          var typeValue = param.Value as Model.TypeValue;
+          
+          IProblem problem = model as IProblem;
+          IAlgorithm algoModel = model as IAlgorithm;
+          if (problem == null && algoModel != null) {
+            problem = algoModel.Problem;
+          }
+
+          if (problem != null) {
+            var toselect = problem.Operators.OfType<IOperator>().FirstOrDefault(x => x.Name == typeValue.Value);
+            if (toselect != null) {
+              return toselect;
+            }
+          }
+          
+          string parameterPropertyName = typeValue.Name.EndsWith("Parameter") ? typeValue.Name : typeValue.Name + "Parameter";
+          var parameterProperty = model.GetType().GetProperty(parameterPropertyName);
+          if (parameterProperty != null) {
+            var parameterPropertyValue = parameterProperty.GetGetMethod().Invoke(model, null);
+            var vvProp = parameterPropertyValue.GetType().GetProperty("ValidValues");
+            if (vvProp != null) {
+              //http://stackoverflow.com/questions/245607/how-is-generic-covariance-contra-variance-implemented-in-c-sharp-4-0 because of covariance declared in IEnumerable
+              var options = vvProp.GetGetMethod().Invoke(parameterPropertyValue, null) as IEnumerable<IItem>;
+              if (options != null) {
+                var result = options.FirstOrDefault(x => x.ItemName == typeValue.Value);
+                if (result != null)
+                  return result;
+              }
+            }
+          }
+
+          Type type = null;
+          foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
+            type = asm.GetType(typeValue.Value);
+            if (type != null)
+              break;
+          }
+          
+          return Activator.CreateInstance(type);
+      }
+      return null;
+    }
+
+    public object CreateHLObjectForType(object obj, Type type, Parameter prop) {
+      var value = MapControllerDataType(obj, prop);
+      if (prop.Type == ParameterType.Type)
+        return value;
+
+      if (type == typeof(HeuristicLab.Encodings.PermutationEncoding.Permutation)) {
+        double[] input = value as double[];
+        int[] arr = new int[input.Length];
+        for (int i = 0; i < input.Length; i++) {
+          arr[i] = Convert.ToInt32(input[i]);
+        }
+        var valueObj = new HeuristicLab.Encodings.PermutationEncoding.Permutation(Encodings.PermutationEncoding.PermutationTypes.RelativeUndirected, arr);
+        return valueObj;
+      }
+      var propertyGetter = obj.GetType().GetProperty(prop.Value.Name).GetGetMethod();        
+      return Activator.CreateInstance(propertyGetter.ReturnType, value);
+    }
+
+    private void MapProperty(object model, Parameter prop) {
+      var propertyGetter = model.GetType().GetProperty(prop.Value.Name).GetGetMethod();
+      var propertySetter = model.GetType().GetProperty(prop.Value.Name).GetSetMethod();
+      var value = propertyGetter.Invoke(model, null);
+      var valueProperty = value != null ? value.GetType().GetProperty("Value") : null;
+      if (propertySetter != null) {
+        var instance = CreateHLObjectForType(model, propertyGetter.ReturnType, prop);
+        propertySetter.Invoke(model, new object[] { instance });
+      }
+      else if (valueProperty != null) {        
+        valueProperty.GetSetMethod().Invoke(value, new object[] { MapControllerDataType(model, prop) });
+      }
+      else {
+        Console.WriteLine("Failed to handle property!");
+      }
+    }
+
+    public void DispatchScenario(Model.OptimizationScenario scenario) {
+      Experiment experiment = new Experiment();
+      var problem = new TravelingSalesmanProblem();
+      foreach (var prop in scenario.InputParameters.Items) {
+        MapProperty(problem, prop);
+      }
+
+      var algo = new GeneticAlgorithm();
+      algo.Problem = problem;      
+      foreach (var prop in scenario.AlgorithmParameters.Items) {
+        MapProperty(algo, prop);
+      }
+
+      experiment.Optimizers.Add(algo);
+      SendExperimentToHive(experiment);
+    }
+
+    private void SendExperimentToHive(Experiment exp) {
+      var job = new RefreshableJob();
+      job.IsAllowedPrivileged = true;      
+      job.Job.Name = "Web Scheduled Traveling Salesman Job";
+      job.Job.ResourceNames = "TESTGROUP";
+      job.RefreshAutomatically = false;
+      job.HiveTasks.Add(new OptimizerHiveTask(exp));
+      HiveServiceLocator.Instance.Username = "fschoeppl";
+      HiveServiceLocator.Instance.Password = "fschoeppl";
+      HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
+      
+      HiveClient.StartJob((ex) => { 
+        Console.WriteLine(ex.StackTrace); 
+      }, job, new CancellationToken());
+
+      job.StopResultPolling();
+    }
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs	(revision 8506)
@@ -15,4 +15,7 @@
     [OperationContract]
     OptimizationScenario GetOptimizationScenarioByName(string name);
+
+    [OperationContract]
+    void ScheduleOptimizationScenario(OptimizationScenario scenario);
   }
 }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs	(revision 8506)
@@ -0,0 +1,11 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Services.Optimization.ControllerService.Model;
+
+namespace HeuristicLab.Services.Optimization.ControllerService.Interfaces {
+  public interface IScenarioManager {
+    void DispatchScenario(OptimizationScenario scenario);
+  }
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/Model/ControllerModel.cs	(revision 8506)
@@ -4,4 +4,6 @@
 using System.Text;
 using System.Runtime.Serialization;
+using System.Globalization;
+using System.Xml;
 
 namespace HeuristicLab.Services.Optimization.ControllerService.Model {
@@ -25,5 +27,93 @@
 
   [DataContract]
-  public abstract class Value {    
+  public abstract class Value {
+    [DataMember]
+    public string Name { get; set; }
+
+    public abstract bool TrySetFromString(string input);
+  }
+
+
+  [DataContract]
+  public class DecimalMatrix : Value {
+    [DataMember]
+    public double[][] Value { get; set; }
+
+    public override bool TrySetFromString(string input) {
+      var splitted = input.Split(':');
+      int i, j;
+      if (splitted.Length != 3)
+        return false;
+
+      if (!int.TryParse(splitted[0], out i))
+        return false;
+
+      if (!int.TryParse(splitted[1], out j))
+        return false;
+
+      double value;
+      if (!double.TryParse(splitted[2], out value))
+        return false;
+      // very, very buggy
+      if (i >= Value.Length || j >= Value[0].Length ) {
+        double[][] valueArr = new double[i >= Value.GetLength(0) ? i : Value.GetLength(0)][];        
+        for (int k = 0; k < Value.Length; k++) {
+          valueArr[k] = new double[j >= Value.GetLength(1) ? j : Value.GetLength(1)];
+          for (int l = 0; l < Value[k].Length; l++) {
+            valueArr[k][l] = Value[k][l];
+          }
+        }
+        Value = valueArr;
+      }
+
+      Value[i][j] = value;
+      return true;
+    }
+  }
+
+  [DataContract]
+  public class DecimalVector : Value {
+    [DataMember]
+    public double[] Value { get; set; }
+
+    public override bool TrySetFromString(string input) {
+      var splitted = input.Split(':');
+      int index;
+      if (splitted.Length != 2)
+        return false;
+
+      if (!int.TryParse(splitted[0], out index))
+        return false;
+
+      double value;
+      if (!double.TryParse(splitted[1], out value))
+        return false;
+
+      if (index >= Value.Length) {
+        double[] valueArr = new double[index + 1];
+        Array.Copy(Value, valueArr, Value.Length);
+        Value = valueArr;
+      }
+
+      Value[index] = value;
+      return true;
+    }
+  }
+
+  [DataContract]
+  public class TypeValue : Value {
+    [DataMember]
+    public string Value { get; set; }
+
+    [DataMember]
+    public string[] Options { get; set; }
+
+    public override bool TrySetFromString(string input) {
+      if (Options.Contains(input)) {
+        Value = input;
+        return true;
+      }
+      return false;
+    }
   }
 
@@ -32,4 +122,13 @@
     [DataMember]
     public double Value { get; set; }
+
+    public override bool TrySetFromString(string input) {
+      double result;
+      if (double.TryParse(input, out result)) {
+        Value = result;
+        return true;
+      }
+      return false;
+    }
   }
 
@@ -38,4 +137,15 @@
     [DataMember]
     public bool Value { get; set; }
+
+    public override bool TrySetFromString(string input) {
+      bool result;
+      if (input.Contains(","))
+        input = input.Split(',')[0].Trim();
+      if (bool.TryParse(input, out result)) {
+        Value = result;
+        return true;
+      }
+      return false;
+    }
   }
 
@@ -43,8 +153,8 @@
   [KnownType(typeof(BoolValue))]
   [KnownType(typeof(DecimalValue))]
-  public class Parameter {
-    [DataMember]
-    public string Name { get; set; }
-    
+  [KnownType(typeof(TypeValue))]
+  [KnownType(typeof(DecimalVector))]
+  [KnownType(typeof(DecimalMatrix))]
+  public class Parameter {        
     // some kind of value type
     [DataMember]
@@ -52,6 +162,5 @@
     
     [DataMember]
-    public Value Value { get; set; }
-
+    public Value Value { get; set; }    
     /*
     //[DataMember]
@@ -60,23 +169,47 @@
 
   [DataContract]
+  public class InputParameters {
+    private IList<Parameter> items = new List<Parameter>();
+
+    [DataMember]
+    public IList<Parameter> Items {
+      get { return items; }
+      set { items = value; }
+    }
+  }
+
+  [DataContract]
+  public class AlgorithmParameters {
+    private IList<Parameter> items = new List<Parameter>();
+
+    [DataMember]
+    public IList<Parameter> Items {
+      get { return items; }
+      set { items = value; }
+    }
+  }
+
+  [DataContract]
   public class OptimizationScenario {
     [DataMember]
     public string Name { get; set; }
 
-    private IList<Parameter> inputParameters = new List<Parameter>();
-
-    [DataMember]
-    public IList<Parameter> InputParameters {
-      get { return inputParameters; }
-      set { inputParameters = value; }
-    }
-
-    private IList<Parameter> algorithmParameters = new List<Parameter>();
-
-    [DataMember]
-    public IList<Parameter> AlgorithmParameters {
+    private InputParameters inputParams = new InputParameters();
+
+    [DataMember]
+    public InputParameters InputParameters {
+      get { return inputParams; }
+      set { inputParams = value; }
+    }
+
+
+    private AlgorithmParameters algorithmParameters = new AlgorithmParameters();
+
+    [DataMember]
+    public AlgorithmParameters AlgorithmParameters {
       get { return algorithmParameters; }
       set { algorithmParameters = value; }
     }
+
   }
 }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs	(revision 8506)
@@ -4,4 +4,5 @@
 using System.Text;
 using System.ServiceModel;
+using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
 
 namespace HeuristicLab.Services.Optimization.ControllerService {
@@ -11,25 +12,40 @@
     private IList<Model.OptimizationScenario> scenarios;
 
+    private IScenarioManager hiveManager;
+
     public PlaceholderControllerService() {
-      var tsp = new Model.OptimizationScenario() { Name = "Travelling Salesman Problem" };
-      tsp.InputParameters.Add(new Model.Parameter() { Name = "BestKnownQuality", Type = Model.ParameterType.Decimal, Value = new Model.DecimalValue() { Value = 6110.0d } });
-      tsp.InputParameters.Add(new Model.Parameter() { Name = "BestKnownSolution", Type = Model.ParameterType.DecimalMatrix }); //, Value = 
-        //new double[]{0,40,38,116,111,114,27,61,104,127,15,44,4,10,75,108,60,128,123,63,68,85,87,25,6,96,69,106,126,103,42,33,16,30,26,18,99,14,28,23,115,94,78,86,11,80,102,76,93,88,109,97,67,62,47,24,112,31,35,83,118,110,122,100,81,56,8,55,64,51,74,73,98,72,91,37,105,52,119,57,48,71,90,5,101,9,13,66,12,95,121,54,59,50,41,43,92,36,21,46,39,22,32,20,125,120,77,65,84,124,89,58,29,82,2,113,107,7,17,45,79,117,19,3,34,53,1,49,129,70}});
-      tsp.InputParameters.Add(new Model.Parameter() { Name = "Coordinates", Type = Model.ParameterType.DecimalMatrix }); //, Value =
-        //new double[,]{{334.5909245845, 161.7809319139},{334.5909245845, 161.7809319139},{503.8741827107,172.8741151168}}});
-      tsp.InputParameters.Add(new Model.Parameter() { Name = "Evaluator", Type = Model.ParameterType.Type });//, Value = "TSPRoundedEuclideanPathEvaluator", Choices = new string[]{ "TSPRoundedEuclideanPathEvaluator", "TSPGeoPathEvaluator", "TSPEuclideanPathEvaluator" } });
+      var tsp = new Model.OptimizationScenario() { Name = "Traveling Salesman Problem" };
+      hiveManager = new HiveScenarioManager();
+      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Decimal, Value = new Model.DecimalValue() { Name = "BestKnownQuality", Value = 6110.0d } });
+      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.DecimalVector
+      ,Value = 
+        new Model.DecimalVector() {
+          Name = "BestKnownSolution",
+          Value = new double[]{
+            0,40,38//,116,111,114,27,61,104,127,15,44,4,10,75,108,60,128,123,63,68,85,87,25,6,96,69,106,126,103,42,33,16,30,26,18,99,14,28,23,115,94,78,86,11,80,102,76,93,88,109,97,67,62,47,24,112,31,35,83,118,110,122,100,81,56,8,55,64,51,74,73,98,72,91,37,105,52,119,57,48,71,90,5,101,9,13,66,12,95,121,54,59,50,41,43,92,36,21,46,39,22,32,20,125,120,77,65,84,124,89,58,29,82,2,113,107,7,17,45,79,117,19,3,34,53,1,49,129,70
+      }}});
+      tsp.InputParameters.Items.Add(new Model.Parameter() {        
+        Type = Model.ParameterType.DecimalMatrix,
+        Value =
+          new Model.DecimalMatrix() {
+            Name = "Coordinates",
+            Value = Utility.ToJagged(new double[,] { { 334.5909245845, 161.7809319139 }, { 334.5909245845, 161.7809319139 }, { 503.8741827107, 172.8741151168 } })
+          }
+      });
+      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "EvaluatorParameter", Value = "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator", Options = new string[] { "HeuristicLab.Problems.TravelingSalesman.TSPRoundedEuclideanPathEvaluator", "HeuristicLab.Problems.TravelingSalesman.TSPGeoPathEvaluator", "HeuristicLab.Problems.TravelingSalesman.TSPEuclideanPathEvaluator" } } });
       //tsp.InputParameters.Add(new Model.Parameter() { Name = "SolutionCreator" });
-      tsp.InputParameters.Add(new Model.Parameter() { Name = "UseDistanceMatrix", Type = Model.ParameterType.Boolean});//, Value = true });
+      tsp.InputParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Boolean, Value = new Model.BoolValue() { Name = "UseDistanceMatrix", Value = true } });
 
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Crossover", Type = Model.ParameterType.Type});//, Value = "OrderCrossover2", Choices = new string[] { "OrderCrossover2", "CosaCrossover" } });
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Elites", Type = Model.ParameterType.Integer});//, Value = 1});
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "MaximumGenerations", Type = Model.ParameterType.Integer });//, Value = 1000});
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "MutationProbability", Type = Model.ParameterType.Percent });//, Value = 5});
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Mutator", Type = Model.ParameterType.Type});//, Value = "InversionManipulator", Choices = new string[]{"InversionManipulator", "ScrambleManipulator"} });
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "PopulationSize", Type = Model.ParameterType.Integer});//, Value = 100 });
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Seed", Type = Model.ParameterType.Integer});//, Value = 100 });
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "Selector", Type = Model.ParameterType.Type });//,  Value = "ProportionalSelector", Choices = new string[]{"ProportionalSelector", "BestSelector"} });
-      tsp.AlgorithmParameters.Add(new Model.Parameter() { Name = "SetSeedRandomly", Type = Model.ParameterType.Boolean });//, Value = true });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "CrossoverParameter", Value = "OrderCrossover2", Options = new string[] { "OrderCrossover2", "CosaCrossover" } } });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "Elites", Value = 1 } });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "MaximumGenerations", Value = 1000 } });//, Value = 1000});
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Percent, Value = new Model.DecimalValue() { Name = "MutationProbability", Value = 5 } });//, Value = 5});
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "Mutator", Value = "InversionManipulator", Options = new string[] { "InversionManipulator", "ScrambleManipulator" } } });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "PopulationSize", Value = 100 } });//, Value = 100 });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Integer, Value = new Model.DecimalValue() { Name = "Seed", Value = 100 } });//, Value = 100 });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Type, Value = new Model.TypeValue() { Name = "Selector", Value = "ProportionalSelector", Options = new string[] { "ProportionalSelector", "BestSelector" } } });
+      tsp.AlgorithmParameters.Items.Add(new Model.Parameter() { Type = Model.ParameterType.Boolean, Value = new Model.BoolValue() { Name = "SetSeedRandomly", Value = true } });//, Value = true });
       this.scenarios = new List<Model.OptimizationScenario>() { tsp };
+      //hiveManager.DispatchScenario(tsp);
     }
 
@@ -44,4 +60,10 @@
       return null;
     }
+
+    public void ScheduleOptimizationScenario(Model.OptimizationScenario scenario) {
+      hiveManager.DispatchScenario(scenario);
+    }
+
+    
   }
 }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OptimizationController.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OptimizationController.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OptimizationController.cs	(revision 8506)
@@ -33,5 +33,5 @@
 
         public ActionResult ProblemParameters(string scenario) {
-          OptimizationScenario optScenario;
+          OptimizationScenario optScenario;          
           using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
             var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
@@ -40,16 +40,44 @@
             var controllerProxy = cf.CreateChannel();
             optScenario = controllerProxy.GetOptimizationScenarioByName(scenario);
+            Session["scenario"] = optScenario;
           }
-          return View(optScenario);
+          return View(optScenario.InputParameters);
         }
 
         [HttpPost]
-        public ActionResult ProblemParameters(OptimizationScenario scenario) {
+        public ActionResult ProblemParameters(InputParameters parameters) {
           if (ModelState.IsValid) {
-            // store it... maybe
-          }
-          return View(scenario);
+            return RedirectToAction("AlgorithmParameters", parameters);
+          } 
+          return View(parameters);        
         }
 
+        public ActionResult AlgorithmParameters() {
+          return View((Session["scenario"] as OptimizationScenario).AlgorithmParameters);
+        }
+
+        [HttpPost]
+        public ActionResult AlgorithmParameters(AlgorithmParameters parameters) {
+          if (ModelState.IsValid) {
+            return RedirectToAction("ScheduleJob");
+          }
+          return View(parameters);
+        }
+
+        public ActionResult ScheduleJob() {
+          return View(Session["scenario"]);
+        }
+
+        [HttpPost]
+        public ActionResult ScheduleJob(OptimizationScenario scenario) {
+          using (var cf = new ChannelFactory<IControllerService>(OptimizationController.DEFAULT_CONTROLLER_ENDPOINT)) {
+            var credentialBehaviour = cf.Endpoint.Behaviors.Find<ClientCredentials>();
+            credentialBehaviour.UserName.UserName = Membership.GetUser().UserName;
+            credentialBehaviour.UserName.Password = Session["pw"] as string;
+            var controllerProxy = cf.CreateChannel();
+            controllerProxy.ScheduleOptimizationScenario(Session["scenario"] as OptimizationScenario);
+          }
+          return RedirectToAction("Index");
+        }
     }
 }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Global.asax.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Global.asax.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Global.asax.cs	(revision 8506)
@@ -32,5 +32,6 @@
       RegisterGlobalFilters(GlobalFilters.Filters);
       RegisterRoutes(RouteTable.Routes);
-      ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.OptimizationScenario), new OptimizationModelBinder());
+      ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.InputParameters), new ProblemParametersModelBinder());
+      ModelBinders.Binders.Add(typeof(Optimization.ControllerService.Model.AlgorithmParameters), new AlgorithmParametersModelBinder());
     }
   }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj	(revision 8506)
@@ -194,4 +194,55 @@
     <Content Include="Views\Optimization\ProblemParameters.cshtml" />
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Optimization\AlgorithmParameters.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Optimization\ScheduleJob.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\InputParameters.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\DecimalValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\BoolValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\TypeValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\DecimalMatrix.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\DecimalVector.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\EditorTemplates\AlgorithmParameters.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\AlgorithmParameters.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\TypeValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\BoolValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\DecimalMatrix.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\DecimalValue.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\DecimalVector.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Views\Shared\DisplayTemplates\InputParameters.cshtml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="HeuristicLab 3.3.exe.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OptimizationModels.cs
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OptimizationModels.cs	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OptimizationModels.cs	(revision 8506)
@@ -7,12 +7,43 @@
 
 namespace HeuristicLab.Services.Optimization.Web.Models {
-  public class OptimizationModelBinder : IModelBinder {
+
+  public class ProblemParametersModelBinder : IModelBinder {
     public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
-      var scenario = new Optimization.ControllerService.Model.OptimizationScenario();
+      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
       foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
-        var value = bindingContext.ValueProvider.GetValue(key);        
-        scenario.InputParameters.Add(new HeuristicLab.Services.Optimization.ControllerService.Model.Parameter() { });
+        var value = bindingContext.ValueProvider.GetValue(key);
+        string realKey = key;
+        string realValue = value.AttemptedValue;
+
+        if (key.Contains("_")) {
+          var tableEntry = key.Split('_');
+          realKey = tableEntry[0];
+          //var param2 = (from par in scenario.InputParameters.Items where par.Name == tableEntry[0] select par).FirstOrDefault();
+          realValue = "";
+          for (int i = 1; i < tableEntry.Length; i++) {
+            realValue += tableEntry[i] + ":";
+          }
+          realValue += value.AttemptedValue;
+        }
+        var param = (from par in scenario.InputParameters.Items where par.Value.Name == realKey select par).FirstOrDefault();
+        if (!param.Value.TrySetFromString(realValue)) {
+          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
+        }
       }
-      return new Optimization.ControllerService.Model.OptimizationScenario();
+      return scenario.InputParameters;
+    }
+  }
+
+  public class AlgorithmParametersModelBinder : IModelBinder {
+    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) {
+      var scenario = controllerContext.HttpContext.Session["scenario"] as OptimizationScenario;
+      foreach (var key in controllerContext.RequestContext.HttpContext.Request.Form.AllKeys) {
+        var value = bindingContext.ValueProvider.GetValue(key);
+        var param = (from par in scenario.AlgorithmParameters.Items where par.Value.Name == key select par).FirstOrDefault();
+        if (!param.Value.TrySetFromString(value.AttemptedValue)) {
+          bindingContext.ModelState.AddModelError(bindingContext.ModelName, new Exception(string.Format("Unable to parse {0} into destination type {1}", value, param.Type)));
+        }
+      }
+      return scenario.AlgorithmParameters;
     }
   }
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/AlgorithmParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/AlgorithmParameters.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/AlgorithmParameters.cshtml	(revision 8506)
@@ -0,0 +1,16 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.AlgorithmParameters
+
+@{
+    ViewBag.Title = "AlgorithmParameters";
+}
+
+<h2>Adjust algorithm parameters:</h2>
+@using (Html.BeginForm()) {
+    @Html.ValidationSummary(true)
+    <fieldset>
+    @Html.EditorFor(model => Model)
+    <p>
+        <input type="submit" value="Proceed to overview" />
+    </p>
+    </fieldset>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/Index.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/Index.cshtml	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/Index.cshtml	(revision 8506)
@@ -12,4 +12,2 @@
 }
 </ul>
-
-<p>TSP</p>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ProblemParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ProblemParameters.cshtml	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ProblemParameters.cshtml	(revision 8506)
@@ -1,3 +1,3 @@
-﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.OptimizationScenario
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.InputParameters
 
 @{
@@ -10,23 +10,5 @@
     @Html.ValidationSummary(true)
     <fieldset>
-    @foreach (var itm in Model.InputParameters) {
-        <div class="editor-label">
-            @Html.Label(itm.Name, itm.Name)
-        </div>
-        <div class="editor-field">
-          @switch(itm.Type) {
-            case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Decimal:
-            case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Integer:
-              @Html.Raw(Html.TextBoxFor(model => ((HeuristicLab.Services.Optimization.ControllerService.Model.DecimalValue)itm.Value).Value).ToString().Replace("Value", itm.Name));
-              break;
-            case HeuristicLab.Services.Optimization.ControllerService.Model.ParameterType.Boolean:
-              //@Html.CheckBoxFor(model => itm.Value);
-              break;
-            default:               
-              @Html.EditorFor(model => itm.Value, new { id = itm.Name });
-              break;
-          } 
-        </div>
-    }
+    @Html.EditorFor(model => Model)
     <p>
         <input type="submit" value="Proceed to algorithm parameters" />
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ScheduleJob.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ScheduleJob.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Optimization/ScheduleJob.cshtml	(revision 8506)
@@ -0,0 +1,20 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.OptimizationScenario
+
+@{
+    ViewBag.Title = "ScheduleJob";
+}
+
+<h2>Do you really want to schedule the following job?</h2>
+
+
+<h3>Problem Parameters:</h3>
+@Html.DisplayFor(model => Model.InputParameters)
+
+<h3>Algorithm Parameters:</h3>
+@Html.DisplayFor(model => Model.AlgorithmParameters)
+
+@using (Html.BeginForm()) {    
+    <p>
+        <input type="submit" value="Schedule job!" />
+    </p>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/AlgorithmParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/AlgorithmParameters.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/AlgorithmParameters.cshtml	(revision 8506)
@@ -0,0 +1,10 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.AlgorithmParameters
+
+@foreach (var itm in Model.Items) {
+    <div class="editor-label">
+        @Html.Label(itm.Value.Name, itm.Value.Name)
+    </div>
+    <div class="editor-label">
+        @Html.DisplayFor(model => itm.Value)
+    </div>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/BoolValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/BoolValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/BoolValue.cshtml	(revision 8506)
@@ -0,0 +1,3 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.BoolValue
+
+@Model.Value
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalMatrix.cshtml	(revision 8506)
@@ -0,0 +1,16 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalMatrix
+
+<table>
+  <tr>
+    <th>@Model.Name</th>
+  </tr>
+  @for (int i = 0; i < Model.Value.Length; i++) {
+  <tr>
+    @for (int j = 0; j < Model.Value[j].Length; j++) {                      
+    <td>
+      @Model.Value[i][j]
+    </td>
+    }
+  </tr>
+  }
+</table> 
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalValue.cshtml	(revision 8506)
@@ -0,0 +1,3 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalValue
+
+@Model.Value
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalVector.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalVector.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/DecimalVector.cshtml	(revision 8506)
@@ -0,0 +1,14 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalVector
+ 
+<table>
+  <tr>
+    <th>@Model.Name</th>
+  </tr>
+  @for (int i = 0; i < Model.Value.Length; i++) {
+  <tr>
+    <td>
+      @Model.Value[i]
+    </td>
+  </tr>
+  }
+</table>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/InputParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/InputParameters.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/InputParameters.cshtml	(revision 8506)
@@ -0,0 +1,10 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.InputParameters
+
+@foreach (var itm in Model.Items) {
+    <div class="editor-label">
+        @Html.Label(itm.Value.Name, itm.Value.Name)
+    </div>
+    <div class="editor-label">
+        @Html.DisplayFor(model => itm.Value)
+    </div>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/TypeValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/TypeValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/DisplayTemplates/TypeValue.cshtml	(revision 8506)
@@ -0,0 +1,3 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.TypeValue
+           
+@Model.Value
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/AlgorithmParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/AlgorithmParameters.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/AlgorithmParameters.cshtml	(revision 8506)
@@ -0,0 +1,10 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.AlgorithmParameters
+
+@foreach (var itm in Model.Items) {
+    <div class="editor-label">
+        @Html.Label(itm.Value.Name, itm.Value.Name)
+    </div>
+    <div class="editor-field">
+        @Html.EditorFor(model => itm.Value)
+    </div>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/BoolValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/BoolValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/BoolValue.cshtml	(revision 8506)
@@ -0,0 +1,3 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.BoolValue
+
+@Html.Raw(Html.CheckBoxFor(model => Model.Value).ToString().Replace("itm.Value.Value", Model.Name))
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalMatrix.cshtml	(revision 8506)
@@ -0,0 +1,16 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalMatrix
+
+<table>
+  <tr>
+    <th>@Model.Name</th>
+  </tr>
+  @for (int i = 0; i < Model.Value.Length; i++) {
+  <tr>
+    @for (int j = 0; j < Model.Value[j].Length; j++) {                      
+    <td>
+      @Html.Raw(Html.TextBoxFor(model => Model.Value[i][j]).ToString().Replace("itm.Value.Value[" + i + "][" + j + "]", Model.Name + "_" + i + "_" + j))
+    </td>
+    }
+  </tr>
+  }
+</table> 
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalValue.cshtml	(revision 8506)
@@ -0,0 +1,4 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalValue
+
+@Html.Raw(Html.TextBoxFor(model => Model.Value).ToString().Replace("itm.Value.Value", Model.Name))
+@Html.Raw(Html.ValidationMessageFor(model => Model.Value).ToString().Replace("itm.Value.Value", Model.Name))
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalVector.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalVector.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/DecimalVector.cshtml	(revision 8506)
@@ -0,0 +1,14 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.DecimalVector
+ 
+<table>
+  <tr>
+    <th>@Model.Name</th>
+  </tr>
+  @for (int i = 0; i < Model.Value.Length; i++) {
+  <tr>
+    <td>
+      @Html.Raw(Html.TextBoxFor(model => Model.Value[i]).ToString().Replace("itm.Value.Value[" + i + "]", Model.Name + "_" + i))
+    </td>
+  </tr>
+  }
+</table>
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/InputParameters.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/InputParameters.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/InputParameters.cshtml	(revision 8506)
@@ -0,0 +1,10 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.InputParameters
+
+@foreach (var itm in Model.Items) {
+    <div class="editor-label">
+        @Html.Label(itm.Value.Name, itm.Value.Name)
+    </div>
+    <div class="editor-field">
+        @Html.EditorFor(model => itm.Value)
+    </div>
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/TypeValue.cshtml
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/TypeValue.cshtml	(revision 8506)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/EditorTemplates/TypeValue.cshtml	(revision 8506)
@@ -0,0 +1,5 @@
+﻿@model HeuristicLab.Services.Optimization.ControllerService.Model.TypeValue
+@{
+var list = new SelectList(Model.Options, Model.Value);
+@Html.Raw(Html.DropDownListFor(model => list, list).ToString().Replace("itm.Value.list", Model.Name))
+}
Index: /branches/OaaS/HeuristicLab.Services.Optimization.Web/Web.config
===================================================================
--- /branches/OaaS/HeuristicLab.Services.Optimization.Web/Web.config	(revision 8505)
+++ /branches/OaaS/HeuristicLab.Services.Optimization.Web/Web.config	(revision 8506)
@@ -13,5 +13,32 @@
       </listeners>
     </trace>
+    <sources>
+      <source name="System.ServiceModel"
+              switchValue="Information, ActivityTracing"
+              propagateActivity="true" >
+        <listeners>
+          <add name="xml"/>
+        </listeners>
+      </source>
+      <source name="System.ServiceModel.MessageLogging">
+        <listeners>
+          <add name="xml"/>
+        </listeners>
+      </source>
+      <source name="myUserTraceSource"
+              switchValue="Information, ActivityTracing">
+        <listeners>
+          <add name="xml"/>
+        </listeners>
+      </source>
+    </sources>
+    <sharedListeners>
+      <add name="xml"
+           type="System.Diagnostics.XmlWriterTraceListener"
+                 initializeData="C:\logs\Traces.svclog" />
+    </sharedListeners>
   </system.diagnostics>
+  
+  
   <connectionStrings>
     <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
@@ -107,4 +134,11 @@
         <binding name="WSHttpBinding_IControllerService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
           <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
+          <security mode="Message">
+            <transport clientCredentialType="Certificate"/>
+            <message clientCredentialType="UserName"/>
+          </security>
+        </binding>
+        <binding name="WSHttpBinding_IHiveService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
+          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
           <security mode="Message">
             <transport clientCredentialType="Certificate"/>
@@ -150,5 +184,5 @@
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
     <client>
-      <endpoint address="http://localhost:2092/ControllerService.svc" behaviorConfiguration="LocalCertValidation"
+      <endpoint address="http://localhost:8080/ControllerService.svc" behaviorConfiguration="LocalCertValidation"
           binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IControllerService"
           contract="HeuristicLab.Services.Optimization.ControllerService.IControllerService" name="WSHttpBinding_IControllerService">
@@ -157,4 +191,18 @@
         </identity>
       </endpoint>
+      <endpoint address="http://127.0.0.1:81/HiveService.svc" behaviorConfiguration="LocalCertValidation"
+         binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="WSHttpBinding_IHiveService">
+        <identity>
+          <certificate encodedValue="ADJUST_ME" />
+        </identity>
+      </endpoint>
+      <!--
+      <endpoint address="http://optimization.cloudapp.net/HiveService.svc" behaviorConfiguration="LocalCertValidation"
+         binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="WSHttpBinding_IHiveService">
+        <identity>
+          <certificate encodedValue="ADJUST_ME" />
+        </identity>
+      </endpoint>
+      -->
     </client>
   </system.serviceModel>
