- Timestamp:
- 12/15/08 01:22:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/ServerForm.cs
r556 r988 43 43 public partial class ServerForm : Form { 44 44 private ServiceHost host; 45 private ServiceHost rdfHost;46 private Database database;47 45 private Store store; 48 private static readonly string dbFile = AppDomain.CurrentDomain.BaseDirectory + "/test.db3";49 private static readonly string connectionString = "Data Source=\"" + dbFile + "\";Pooling=False";50 46 private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3"; 51 47 private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\""; … … 63 59 JobManager jobManager = new JobManager(gridAddress.Text); 64 60 jobManager.Reset(); 65 RunScheduler scheduler = new RunScheduler(database, jobManager, addressTextBox.Text);66 Thread runSchedulerThread = new Thread(scheduler.Run);67 runSchedulerThread.Start();68 }69 70 private void InitDatabase() {71 DbProviderFactory fact;72 fact = DbProviderFactories.GetFactory("System.Data.SQLite");73 if(!System.IO.File.Exists(dbFile)) {74 database = new Database(connectionString);75 database.CreateNew();76 } else {77 database = new Database(connectionString);78 }79 61 } 80 62 … … 84 66 85 67 private void Start() { 86 InitDatabase();87 68 InitRdfStore(); 88 69 InitRunScheduler(); 89 70 90 host = new ServiceHost(database, new Uri(addressTextBox.Text)); 91 rdfHost = new ServiceHost(store, new Uri(addressTextBox.Text+"/RdfStore")); 71 host = new ServiceHost(store, new Uri(addressTextBox.Text)); 92 72 ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior(); 93 73 throttlingBehavior.MaxConcurrentSessions = 20; 94 74 host.Description.Behaviors.Add(throttlingBehavior); 95 rdfHost.Description.Behaviors.Add(throttlingBehavior);96 75 try { 97 76 NetTcpBinding binding = new NetTcpBinding(); … … 101 80 binding.Security.Mode = SecurityMode.None; 102 81 103 host.AddServiceEndpoint(typeof(I Database), binding, addressTextBox.Text);82 host.AddServiceEndpoint(typeof(IStore), binding, addressTextBox.Text); 104 83 host.Open(); 105 rdfHost.AddServiceEndpoint(typeof(IStore), binding, addressTextBox.Text+"/RdfStore");106 rdfHost.Open();107 84 } catch(CommunicationException ex) { 108 85 MessageBox.Show("An exception occurred: " + ex.Message); 109 86 host.Abort(); 110 rdfHost.Abort();111 87 } 112 88 }
Note: See TracChangeset
for help on using the changeset viewer.