[1044] | 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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Text;
|
---|
| 25 | using System.Windows.Forms;
|
---|
| 26 | using HeuristicLab.PluginInfrastructure;
|
---|
| 27 | using System.Net;
|
---|
| 28 | using System.ServiceModel;
|
---|
| 29 | using System.ServiceModel.Description;
|
---|
[2058] | 30 | using HeuristicLab.Grid;
|
---|
| 31 | using HeuristicLab.Grid.HiveBridge;
|
---|
[2088] | 32 | using HeuristicLab.Core;
|
---|
[2223] | 33 | using HeuristicLab.Modeling.Database;
|
---|
| 34 | using HeuristicLab.Modeling.Database.SQLServerCompact;
|
---|
[2375] | 35 | using HeuristicLab.DataAnalysis;
|
---|
[1044] | 36 |
|
---|
| 37 | namespace HeuristicLab.CEDMA.Server {
|
---|
[2088] | 38 | public class Server : IViewable {
|
---|
[2223] | 39 | private static readonly string sqlServerCompactFile = AppDomain.CurrentDomain.BaseDirectory + "HeuristicLab.Modeling.database.sdf";
|
---|
[2050] | 40 |
|
---|
[2223] | 41 | private DatabaseService database;
|
---|
[2050] | 42 | private IDispatcher dispatcher;
|
---|
[2088] | 43 | public IDispatcher Dispatcher { get { return dispatcher; } }
|
---|
[2050] | 44 | private IExecuter executer;
|
---|
[2088] | 45 | public IExecuter Executer { get { return executer; } }
|
---|
[2375] | 46 | //private Problem problem;
|
---|
| 47 | //public Problem Problem { get { return problem; } }
|
---|
| 48 | private Dataset dataset;
|
---|
| 49 | public Dataset Dataset { get { return dataset; } }
|
---|
[1044] | 50 |
|
---|
| 51 | private string gridServiceUrl;
|
---|
| 52 | public string GridServiceUrl {
|
---|
| 53 | get { return gridServiceUrl; }
|
---|
| 54 | set { gridServiceUrl = value; }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
[2050] | 57 | public Server() {
|
---|
[2451] | 58 | database = new DatabaseService(sqlServerCompactFile);
|
---|
| 59 | database.Connect();
|
---|
[2398] | 60 | dataset = database.GetDataset();
|
---|
| 61 | if (dataset == null)
|
---|
[2451] | 62 | dataset = new Dataset();
|
---|
| 63 | database.Disconnect();
|
---|
[1044] | 64 | }
|
---|
[2050] | 65 |
|
---|
| 66 | internal void Connect(string serverUrl) {
|
---|
[2375] | 67 | dispatcher = new SimpleDispatcher(database, dataset);
|
---|
[2058] | 68 | IGridServer gridServer = null;
|
---|
[2050] | 69 | if (serverUrl.Contains("ExecutionEngine")) {
|
---|
[2058] | 70 | gridServer = new HiveGridServerWrapper(serverUrl);
|
---|
[2050] | 71 | } else {
|
---|
| 72 | // default is grid backend
|
---|
[2058] | 73 | gridServer = new GridServerProxy(serverUrl);
|
---|
[2050] | 74 | }
|
---|
[2223] | 75 | executer = new GridExecuter(dispatcher, gridServer, database);
|
---|
[2050] | 76 | executer.Start();
|
---|
| 77 | }
|
---|
[2088] | 78 | #region IViewable Members
|
---|
| 79 |
|
---|
| 80 | public IView CreateView() {
|
---|
[2824] | 81 | return null;
|
---|
[2088] | 82 | }
|
---|
| 83 | #endregion
|
---|
[1044] | 84 | }
|
---|
| 85 | }
|
---|