Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/26/10 00:48:11 (13 years ago)
Author:
swagner
Message:

Adapted deployment service (#1165)

Location:
trunk/sources/HeuristicLab.Services.Deployment/3.3
Files:
3 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/AdminService.cs

    r4493 r4494  
    2323
    2424namespace HeuristicLab.Services.Deployment {
    25   public class Admin : IAdmin {
    26     #region IAdmin Members
     25  public class AdminService : IAdminService {
     26    #region IAdminService Members
    2727    [PrincipalPermission(SecurityAction.Demand, Role = "Deployment Administrator")]
    2828    public void DeployProduct(ProductDescription product) {
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/App.config

    r4307 r4494  
    11<?xml version="1.0" encoding="utf-8"?>
    22<configuration>
    3   <configSections>
    4   </configSections>
    53  <system.diagnostics>
    64    <!-- for logging. Make sure the IIS application user has write access rights for the output directory -->
     
    4139    </sharedListeners-->
    4240  </system.diagnostics>
     41
    4342  <connectionStrings>
    44     <remove name="LocalSqlServer" />
    45     <add connectionString="Server=SERVICES;Database=HeuristicLab.Deployment;Integrated Security=SSPI" name="HeuristicLab.Services.Deployment.DataAccess.Properties.Settings.HeuristicLab_PluginStoreConnectionString" />
    46     <add name="HeuristicLab.Authentication" connectionString="Initial Catalog=HeuristicLab.Authentication;data source=localhost;Integrated Security=SSPI;" />
     43    <add name="HeuristicLab.Authentication"
     44         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication" />
     45    <add name="HeuristicLab.Services.Deployment.DataAccess.Properties.Settings.HeuristicLab_DeploymentConnectionString"
     46         connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Deployment" />
    4747  </connectionStrings>
     48
    4849  <system.webServer>
    4950    <security>
     
    5354    </security>
    5455  </system.webServer>
     56
    5557  <system.web>
    56     <compilation debug="false" />
     58    <compilation debug="true" />
    5759    <httpRuntime maxRequestLength="2097151" />
    5860    <membership defaultProvider="AspNetSqlMembershipProvider">
    5961      <providers>
    6062        <clear />
    61         <add name="AspNetSqlMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" enablePasswordReset="false" enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"  minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="8" />
     63        <add name="AspNetSqlMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
     64             connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" enablePasswordReset="false"
     65             enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
     66             minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="8" />
    6267      </providers>
    6368    </membership>
     
    6671      <providers>
    6772        <clear />
    68         <add name="AspNetSqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     73        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
     74             connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication" />
    6975      </providers>
    7076    </roleManager>
    7177  </system.web>
     78
    7279  <!-- When deploying the service library project, the content of the config file must be added to the host's
    7380  app.config file. System.Configuration does not support config files for libraries. -->
     
    8693      </mexHttpBinding>
    8794    </bindings>
     95
    8896    <diagnostics performanceCounters="Default">
    8997      <!--<messageLogging logMalformedMessages="false" logMessagesAtTransportLevel="false" />-->
    9098    </diagnostics>
     99
     100    <behaviors>
     101      <endpointBehaviors>
     102        <behavior name="DefaultEndpointBehavior">
     103          <dataContractSerializer maxItemsInObjectGraph="1000000" />
     104        </behavior>
     105      </endpointBehaviors>
     106
     107      <serviceBehaviors>
     108        <behavior name="DefaultServiceBehavior">
     109          <serviceMetadata httpGetEnabled="true" />
     110          <serviceDebug includeExceptionDetailInFaults="true" />
     111          <serviceCredentials>
     112            <serviceCertificate findValue="localhost" storeLocation="LocalMachine"
     113                                storeName="My" x509FindType="FindBySubjectName" />
     114            <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
     115                                    membershipProviderName="AspNetSqlMembershipProvider" />
     116          </serviceCredentials>
     117          <serviceAuthorization principalPermissionMode="UseAspNetRoles"
     118                                roleProviderName="AspNetSqlRoleProvider" />
     119        </behavior>
     120      </serviceBehaviors>
     121    </behaviors>
     122
    91123    <services>
    92       <service behaviorConfiguration="HeuristicLab.Services.Deployment.UpdateBehavior"
    93         name="HeuristicLab.Services.Deployment.Update">
    94         <endpoint address="" behaviorConfiguration="SerializationBehavior"
    95           binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
    96           contract="HeuristicLab.Services.Deployment.IUpdate" />
    97         <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
    98           contract="IMetadataExchange" />
     124      <service name="HeuristicLab.Services.Deployment.UpdateService" behaviorConfiguration="DefaultServiceBehavior">
     125        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding" contract="IMetadataExchange" />
     126        <endpoint behaviorConfiguration="DefaultEndpointBehavior" binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
     127                  contract="HeuristicLab.Services.Deployment.IUpdateService" />
    99128        <host>
    100129          <baseAddresses>
    101             <add baseAddress="http://localhost:8732/Design_Time_Addresses/Deployment-3.3/Update" />
     130            <add baseAddress="http://localhost:8732/Design_Time_Addresses/Deployment-3.3/UpdateService" />
    102131          </baseAddresses>
    103132        </host>
    104133      </service>
    105       <service behaviorConfiguration="HeuristicLab.Services.Deployment.AdminBehavior"
    106         name="HeuristicLab.Services.Deployment.Admin">
    107         <endpoint address="" behaviorConfiguration="SerializationBehavior"
    108           binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
    109           contract="HeuristicLab.Services.Deployment.IAdmin" />
    110         <endpoint address="mex" behaviorConfiguration="SerializationBehavior"
    111           binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
    112           contract="IMetadataExchange" />
     134
     135      <service name="HeuristicLab.Services.Deployment.AdminService" behaviorConfiguration="DefaultServiceBehavior">
     136        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding" contract="IMetadataExchange" />
     137        <endpoint behaviorConfiguration="DefaultEndpointBehavior" binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
     138                  contract="HeuristicLab.Services.Deployment.IAdminService" />
    113139        <host>
    114140          <baseAddresses>
    115             <add baseAddress="http://localhost:8732/Design_Time_Addresses/Deployment-3.3/Admin" />
     141            <add baseAddress="http://localhost:8732/Design_Time_Addresses/Deployment-3.3/AdminService" />
    116142          </baseAddresses>
    117143        </host>
    118144      </service>
    119145    </services>
    120     <behaviors>
    121       <endpointBehaviors>
    122         <behavior name="SerializationBehavior">
    123           <dataContractSerializer maxItemsInObjectGraph="1000000" />
    124         </behavior>
    125       </endpointBehaviors>
    126       <serviceBehaviors>
    127         <behavior name="HeuristicLab.Services.Deployment.UpdateBehavior">
    128           <serviceMetadata httpGetEnabled="true" />
    129           <serviceDebug includeExceptionDetailInFaults="false" />
    130           <serviceCredentials>
    131             <serviceCertificate findValue="localhost" storeLocation="LocalMachine"
    132              storeName="My" x509FindType="FindBySubjectName" />
    133             <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
    134              membershipProviderName="AspNetSqlMembershipProvider" />
    135           </serviceCredentials>
    136           <serviceAuthorization principalPermissionMode="UseAspNetRoles"
    137            roleProviderName="AspNetSqlRoleProvider" />
    138         </behavior>
    139         <behavior name="HeuristicLab.Services.Deployment.AdminBehavior">
    140           <serviceMetadata httpGetEnabled="true" />
    141           <serviceDebug includeExceptionDetailInFaults="false" />
    142           <serviceCredentials>
    143             <serviceCertificate findValue="localhost" storeLocation="LocalMachine"
    144              storeName="My" x509FindType="FindBySubjectName" />
    145             <userNameAuthentication userNamePasswordValidationMode="MembershipProvider"
    146              membershipProviderName="AspNetSqlMembershipProvider" />
    147           </serviceCredentials>
    148           <serviceAuthorization principalPermissionMode="UseAspNetRoles"
    149            roleProviderName="AspNetSqlRoleProvider" />
    150         </behavior>
    151       </serviceBehaviors>
    152     </behaviors>
    153146  </system.serviceModel>
    154147</configuration>
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/HeuristicLab.Services.Deployment-3.3.csproj

    r4307 r4494  
    9898  </ItemGroup>
    9999  <ItemGroup>
    100     <Compile Include="Admin.cs" />
    101     <Compile Include="IAdmin.cs" />
    102     <Compile Include="IUpdate.cs" />
     100    <Compile Include="AdminService.cs" />
     101    <Compile Include="IAdminService.cs" />
     102    <Compile Include="IUpdateService.cs" />
    103103    <Compile Include="PluginDescription.cs" />
    104104    <Compile Include="PluginStore.cs" />
     
    110110      <DependentUpon>Settings.settings</DependentUpon>
    111111    </Compile>
    112     <Compile Include="Update.cs" />
     112    <Compile Include="UpdateService.cs" />
    113113  </ItemGroup>
    114114  <ItemGroup>
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/IAdminService.cs

    r4493 r4494  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Runtime.Serialization;
    2622using System.ServiceModel;
    27 using System.Text;
    28 using HeuristicLab.Services.Deployment.DataAccess;
    2923
    3024namespace HeuristicLab.Services.Deployment {
    3125  [ServiceContract]
    32   public interface IAdmin {
     26  public interface IAdminService {
    3327    [OperationContract]
    3428    void DeployProduct(ProductDescription product);
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/IUpdateService.cs

    r4493 r4494  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Runtime.Serialization;
    2623using System.ServiceModel;
    27 using System.Text;
    28 using HeuristicLab.Services.Deployment.DataAccess;
    2924
    3025namespace HeuristicLab.Services.Deployment {
    3126  [ServiceContract]
    32   public interface IUpdate {
     27  public interface IUpdateService {
    3328    [OperationContract]
    3429    byte[] GetPlugin(PluginDescription description);
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/PluginStore.cs

    r3612 r4494  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Data.SqlClient;
    2425using System.Linq;
    25 using System.Text;
    26 using System.Data.Common;
    2726using System.Transactions;
    28 using System.Data.SqlClient;
    2927using HeuristicLab.Services.Deployment.DataAccess;
    3028
     
    3836    public IEnumerable<ProductDescription> Products {
    3937      get {
    40         using (var ctx = new PluginStoreClassesDataContext()) {
     38        using (var ctx = new DeploymentDataContext()) {
    4139          return (from p in ctx.Products
    4240                  let plugins = from pair in ctx.ProductPlugins
     
    5250    public IEnumerable<PluginDescription> Plugins {
    5351      get {
    54         using (var ctx = new PluginStoreClassesDataContext()) {
     52        using (var ctx = new DeploymentDataContext()) {
    5553          return (from plugin in ctx.Plugins
    5654                  select MakePluginDescription(ctx, plugin)).ToList();
     
    6058
    6159    public byte[] PluginFile(PluginDescription pluginDescription) {
    62       using (var ctx = new PluginStoreClassesDataContext()) {
     60      using (var ctx = new DeploymentDataContext()) {
    6361        return GetExistingPlugin(ctx, pluginDescription.Name, pluginDescription.Version).PluginPackage.Data.ToArray();
    6462      }
     
    6664
    6765    public void Persist(PluginDescription pluginDescription, byte[] pluginPackage) {
    68       using (var ctx = new PluginStoreClassesDataContext()) {
     66      using (var ctx = new DeploymentDataContext()) {
    6967        try {
    7068          using (var transaction = new TransactionScope()) {
     
    9189
    9290    public void Persist(ProductDescription productDescription) {
    93       using (var ctx = new PluginStoreClassesDataContext()) {
     91      using (var ctx = new DeploymentDataContext()) {
    9492        try {
    9593          using (var transaction = new TransactionScope()) {
     
    112110    }
    113111    public void Delete(ProductDescription productDescription) {
    114       using (var ctx = new PluginStoreClassesDataContext()) {
     112      using (var ctx = new DeploymentDataContext()) {
    115113        try {
    116114          using (var transaction = new TransactionScope()) {
     
    136134
    137135    #region insert/update/delete product
    138     private void InsertOrUpdateProduct(PluginStoreClassesDataContext ctx, ProductDescription product) {
     136    private void InsertOrUpdateProduct(DeploymentDataContext ctx, ProductDescription product) {
    139137      var productEntity = (from p in ctx.Products
    140138                           where p.Name == product.Name
     
    158156    }
    159157
    160     private void DeleteProductPlugins(PluginStoreClassesDataContext ctx, Product productEntity) {
     158    private void DeleteProductPlugins(DeploymentDataContext ctx, Product productEntity) {
    161159      var oldPlugins = (from p in ctx.ProductPlugins
    162160                        where p.ProductId == productEntity.Id
     
    168166
    169167    #region insert/update plugins
    170     private Plugin InsertOrUpdatePlugin(PluginStoreClassesDataContext ctx, PluginDescription pluginDescription) {
     168    private Plugin InsertOrUpdatePlugin(DeploymentDataContext ctx, PluginDescription pluginDescription) {
    171169      var pluginEntity = (from p in ctx.Plugins
    172170                          where p.Name == pluginDescription.Name
     
    183181    }
    184182
    185     private void UpdatePlugin(PluginStoreClassesDataContext ctx, Plugin pluginEntity, PluginDescription pluginDescription) {
     183    private void UpdatePlugin(DeploymentDataContext ctx, Plugin pluginEntity, PluginDescription pluginDescription) {
    186184      // update plugin data
    187185      pluginEntity.License = pluginDescription.LicenseText;
     
    205203
    206204
    207     private void DeleteOldDependencies(PluginStoreClassesDataContext ctx, Plugin pluginEntity) {
     205    private void DeleteOldDependencies(DeploymentDataContext ctx, Plugin pluginEntity) {
    208206      var oldDependencies = (from dep in ctx.Dependencies
    209207                             where dep.PluginId == pluginEntity.Id
     
    216214
    217215    #region product <-> productDescription transformation
    218     private ProductDescription MakeProductDescription(PluginStoreClassesDataContext ctx, Product p, IEnumerable<Plugin> plugins) {
     216    private ProductDescription MakeProductDescription(DeploymentDataContext ctx, Product p, IEnumerable<Plugin> plugins) {
    219217      var desc = new ProductDescription(p.Name, new Version(p.Version), from plugin in plugins
    220218                                                                        select MakePluginDescription(ctx, plugin));
     
    232230    // cache for plugin descriptions
    233231    private Dictionary<long, PluginDescription> pluginDescriptions = new Dictionary<long, PluginDescription>();
    234     private PluginDescription MakePluginDescription(PluginStoreClassesDataContext ctx, Plugin plugin) {
     232    private PluginDescription MakePluginDescription(DeploymentDataContext ctx, Plugin plugin) {
    235233      if (!pluginDescriptions.ContainsKey(plugin.Id)) {
    236234        // no cached description -> create new
     
    267265
    268266    #region helper queries
    269     private Plugin GetExistingPlugin(PluginStoreClassesDataContext ctx, string name, Version version) {
     267    private Plugin GetExistingPlugin(DeploymentDataContext ctx, string name, Version version) {
    270268      return (from p in ctx.Plugins
    271269              where p.Name == name
     
    274272    }
    275273
    276     private Product GetExistingProduct(PluginStoreClassesDataContext ctx, string name, Version version) {
     274    private Product GetExistingProduct(DeploymentDataContext ctx, string name, Version version) {
    277275      return (from p in ctx.Products
    278276              where p.Name == name
     
    281279    }
    282280
    283     private IEnumerable<Plugin> GetDependencies(PluginStoreClassesDataContext ctx, Plugin plugin) {
     281    private IEnumerable<Plugin> GetDependencies(DeploymentDataContext ctx, Plugin plugin) {
    284282      return from pair in ctx.Dependencies
    285283             from dependency in ctx.Plugins
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/UpdateService.cs

    r4493 r4494  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Runtime.Serialization;
    26 using System.ServiceModel;
    27 using System.Text;
    28 using HeuristicLab.Services.Deployment.DataAccess;
    2923
    3024namespace HeuristicLab.Services.Deployment {
    31   public class Update : IUpdate {
    32     #region IUpdate Members
     25  public class UpdateService : IUpdateService {
     26    #region IUpdateService Members
    3327
    3428    public byte[] GetPlugin(PluginDescription description) {
Note: See TracChangeset for help on using the changeset viewer.