Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/16/09 11:15:34 (15 years ago)
Author:
gkronber
Message:

trivial refactoring of CEDMA server and server form. #644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs

    r1529 r2050  
    3333namespace HeuristicLab.CEDMA.Server {
    3434  public class Server {
     35    private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3";
     36    private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\"";
     37
    3538    private ServiceHost host;
    36     private IStore store;
     39    private Store store;
     40    private IDispatcher dispatcher;
     41    private IExecuter executer;
    3742
    3843    private string gridServiceUrl;
    39 
    4044    public string GridServiceUrl {
    4145      get { return gridServiceUrl; }
     
    4448
    4549    private string cedmaServiceUrl;
    46 
    4750    public string CedmaServiceUrl {
    4851      get { return cedmaServiceUrl; }
     
    5053    }
    5154
    52     public Server(IStore store) {
     55    private int maxActiveJobs;
     56    public int MaxActiveJobs {
     57      get { return maxActiveJobs; }
     58      set {
     59        if (value > 0 && value <= 64) {
     60          maxActiveJobs = value;
     61        }
     62      }
     63    }
     64
     65    public Server() {
    5366      IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName());
    5467      // windows XP returns the external ip on index 0 while windows vista returns the external ip as one of the last entries
     
    6174      }
    6275      cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA";
    63       this.store = store;
     76      store = new Store(rdfConnectionString);
     77      maxActiveJobs = 10;
    6478    }
    6579
     
    8397      }
    8498    }
     99
     100    internal string[] GetActiveJobDescriptions() {
     101      if (executer != null) return executer.GetJobs();
     102      else return new string[] { };
     103    }
     104
     105    internal void Connect(string serverUrl) {
     106      dispatcher = new SimpleDispatcher(store);
     107      if (serverUrl.Contains("ExecutionEngine")) {
     108        executer = new HiveExecuter(dispatcher, store, serverUrl);
     109      } else {
     110        // default is grid backend
     111        executer = new GridExecuter(dispatcher, store, serverUrl);
     112      }
     113      executer.Start();
     114    }
    85115  }
    86116}
Note: See TracChangeset for help on using the changeset viewer.