示例#1
0
        public BenchmarkStartup()
        {
            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(_culture);

            #region Start REST, WebDAV and WebAdmin services, send GraphDS notification

            var GraphDB = new SonesGraphDB(null, true, new CultureInfo(_culture));

            #region Configure PlugIns
            // Plugins are loaded by the GraphDS with their according PluginDefinition and only if they are listed
            // below - there is no auto-discovery for plugin types in GraphDS (!)

            #region Query Languages
            // the GQL Query Language Plugin needs the GraphDB instance as a parameter
            List<PluginDefinition> QueryLanguages = new List<PluginDefinition>();
            Dictionary<string, object> GQL_Parameters = new Dictionary<string, object>();
            GQL_Parameters.Add("GraphDB", GraphDB);

            QueryLanguages.Add(new PluginDefinition("sones.gql", GQL_Parameters));
            #endregion

            #endregion

            GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(myIGraphQLPlugins: QueryLanguages);

            _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters);

            #region pre-configure REST Service
            Dictionary<string, object> RestParameter = new Dictionary<string, object>();
            RestParameter.Add("IPAddress", IPAddress.Any);
            RestParameter.Add("Port", _listeningPort);
            RestParameter.Add("Username", _userName);
            RestParameter.Add("Password", _password);
            _dsServer.StartService("sones.RESTService", RestParameter);
            #endregion

            _dsServer.StartService("sones.RESTService", RestParameter);

            #endregion

            #region start grammar and console

            Grammar benchmarkGrammar = new BenchmarkGrammar(_dsServer, _listeningPort, _userName, _password);

            var commandLine = new CommandLine(benchmarkGrammar);
              		commandLine.Run();

            #endregion

            _dsServer.Shutdown(null);
        }