Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs @ 2380

Last change on this file since 2380 was 2375, checked in by gkronber, 15 years ago

Refactored CEDMA dispatcher and CEDMA server view to allow different modeling scenarios for each variable. #754

File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Windows.Forms;
26using HeuristicLab.PluginInfrastructure;
27using System.Net;
28using System.ServiceModel;
29using System.ServiceModel.Description;
30using HeuristicLab.Grid;
31using HeuristicLab.Grid.HiveBridge;
32using HeuristicLab.Core;
33using HeuristicLab.Modeling.Database;
34using HeuristicLab.Modeling.Database.SQLServerCompact;
35using HeuristicLab.DataAnalysis;
36
37namespace HeuristicLab.CEDMA.Server {
38  public class Server : IViewable {
39    private static readonly string sqlServerCompactFile = AppDomain.CurrentDomain.BaseDirectory + "HeuristicLab.Modeling.database.sdf";
40    private static readonly string sqlServerCompactConnectionString = @"Data Source=" + sqlServerCompactFile;
41
42    private DatabaseService database;
43    private IDispatcher dispatcher;
44    public IDispatcher Dispatcher { get { return dispatcher; } }
45    private IExecuter executer;
46    public IExecuter Executer { get { return executer; } }
47    //private Problem problem;
48    //public Problem Problem { get { return problem; } }
49    private Dataset dataset;
50    public Dataset Dataset { get { return dataset; } }
51
52    private string gridServiceUrl;
53    public string GridServiceUrl {
54      get { return gridServiceUrl; }
55      set { gridServiceUrl = value; }
56    }
57
58    public Server() {
59      database = new DatabaseService(sqlServerCompactConnectionString);
60      dataset = new Dataset();
61      try {
62        dataset = database.GetDataset();
63      }
64      catch (InvalidOperationException) {
65      }
66    }
67
68    internal void Connect(string serverUrl) {
69      dispatcher = new SimpleDispatcher(database, dataset);
70      IGridServer gridServer = null;
71      if (serverUrl.Contains("ExecutionEngine")) {
72        gridServer = new HiveGridServerWrapper(serverUrl);
73      } else {
74        // default is grid backend
75        gridServer = new GridServerProxy(serverUrl);
76      }
77      executer = new GridExecuter(dispatcher, gridServer, database);
78      executer.Start();
79    }
80    #region IViewable Members
81
82    public IView CreateView() {
83      return new ServerView(this);
84    }
85    #endregion
86  }
87}
Note: See TracBrowser for help on using the repository browser.