/// <summary> Конструктор класса GraphDBTest /// Создается база данных graphDB и сервер GraphDSServer /// </summary> public GraphDBTest() { var graphDB = new SonesGraphDB(); List<PluginDefinition> QueryLanguagePATH = new List<PluginDefinition>(); Dictionary<string, object> GQL_Parameters = new Dictionary<string, object>(); GQL_Parameters.Add("GraphDB", graphDB); QueryLanguagePATH.Add(new PluginDefinition("sones.gql", GQL_Parameters)); //adding the QueryLanguage as a GraphDSPlugin GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(QueryLanguagePATH); GraphDSServer = new GraphDS_Server(graphDB, PluginsAndParameters); SecToken = GraphDSServer.LogOn(new UserPasswordCredentials("User", "test")); TransactionID = GraphDSServer.BeginTransaction(SecToken); edge_list = new List<List< KeyValuePair<long, Int32> >>(); Dictionary<string, object> RestParameter = new Dictionary<string, object>(); RestParameter.Add("IPAddress", IPAddress.Any); RestParameter.Add("Port", 9975); RestParameter.Add("Username", "test"); RestParameter.Add("Password", "test"); GraphDSServer.StartService("sones.RESTService", RestParameter); }
public TagExampleWithGraphMappingFramework(String[] myArgs) { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-us"); if (myArgs.Count() > 0) { foreach (String parameter in myArgs) { if (parameter.ToUpper() == "--Q") quiet = true; } } #region Start RemoteAPI, WebDAV and WebAdmin services, send GraphDS notification IGraphDB GraphDB; GraphDB = new SonesGraphDB(null, true, new CultureInfo("en-us")); #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 #region GraphDS Service Plugins List<PluginDefinition> GraphDSServices = new List<PluginDefinition>(); #endregion List<PluginDefinition> UsageDataCollector = new List<PluginDefinition>(); #endregion GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(QueryLanguages); _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters); #region Start GraphDS Services #region Remote API Service Dictionary<string, object> RemoteAPIParameter = new Dictionary<string, object>(); RemoteAPIParameter.Add("IPAddress", IPAddress.Parse("127.0.0.1")); RemoteAPIParameter.Add("Port", (ushort)9970); _dsServer.StartService("sones.RemoteAPIService", RemoteAPIParameter); #endregion #endregion #endregion #endregion #region Some helping lines... if (!quiet) { Console.WriteLine("This GraphDB Instance offers the following options:"); Console.WriteLine(" * If you want to suppress console output add --Q as a"); Console.WriteLine(" parameter."); Console.WriteLine(); Console.WriteLine(" * the following GraphDS Service Plugins are initialized and started: "); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(" * " + Service.PluginName); } Console.WriteLine(); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(Service.ServiceDescription); Console.WriteLine(); } Console.WriteLine("Enter 'shutdown' to initiate the shutdown of this instance."); } Run(); Console.CancelKeyPress += OnCancelKeyPress; while (!shutdown) { String command = Console.ReadLine(); if (!_ctrlCPressed) { if (command != null) { if (command.ToUpper() == "SHUTDOWN") shutdown = true; } } } Console.WriteLine("Shutting down GraphDS Server"); _dsServer.Shutdown(null); Console.WriteLine("Shutdown complete"); #endregion }
public sonesGraphDBStartup(String[] myArgs) { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(Properties.Settings.Default.DatabaseCulture); if (myArgs.Count() > 0) { foreach (String parameter in myArgs) { if (parameter.ToUpper() == "--Q") { quiet = true; } } } #region Start REST, WebDAV and WebAdmin services, send GraphDS notification IGraphDB GraphDB; if (Properties.Settings.Default.UsePersistence) { if (!quiet) { Console.WriteLine("Initializing persistence layer..."); } Uri configuredLocation = new Uri(Properties.Settings.Default.PersistenceLocation, UriKind.RelativeOrAbsolute); string configuredPageSize = Properties.Settings.Default.PageSize; string configuredBufferSize = Properties.Settings.Default.BufferSizeInPages; string configuredUseVertexExtensions = Properties.Settings.Default.UseVertexExtensions; string configuredWriteStrategy = Properties.Settings.Default.WriteStrategy; /* Configure the location */ Uri location = null; if (configuredLocation.IsAbsoluteUri) { location = configuredLocation; } else { Uri rootPath = new Uri(System.Reflection.Assembly.GetAssembly((typeof(sones.Library.Commons.VertexStore.IVertexStore))).Location); location = new Uri(rootPath, configuredLocation); } /* Configuration for the page size */ int pageSize = Int32.Parse(configuredPageSize); /* Configuration for the buffer size */ int bufferSize = Int32.Parse(configuredBufferSize); /* Configuration for using vertex extensions */ bool useVertexExtensions = Boolean.Parse(configuredUseVertexExtensions); /* Make a new instance by applying the configuration */ try { //Make a new GraphDB instance GraphDB = new SonesGraphDB(new GraphDBPlugins( new PluginDefinition("sones.pagedfsnonrevisionedplugin", new Dictionary <string, object>() { { "location", location }, { "pageSize", pageSize }, { "bufferSizePages", bufferSize }, { "writeStrategy", configuredWriteStrategy }, { "useVertexExtensions", useVertexExtensions } })), true, null, location.AbsolutePath); if (!quiet) { Console.WriteLine("Persistence layer initialized."); } } catch (Exception a) { if (!quiet) { Console.WriteLine(a.Message); Console.WriteLine(a.StackTrace); Console.Error.WriteLine("Could not access the data directory " + location.AbsoluteUri + ". Please make sure you that you have the right file access permissions!"); Console.Error.WriteLine("Using in memory storage instead."); } GraphDB = new SonesGraphDB(null, true, new CultureInfo(Properties.Settings.Default.DatabaseCulture)); } } else { GraphDB = new SonesGraphDB(null, true, new CultureInfo(Properties.Settings.Default.DatabaseCulture)); } #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 #region REST Service Plugins List <PluginDefinition> SonesRESTServices = new List <PluginDefinition>(); // not yet used #endregion #region GraphDS Service Plugins List <PluginDefinition> GraphDSServices = new List <PluginDefinition>(); #endregion #region Drain Pipes //// QueryLog DrainPipe //Dictionary<string, object> QueryLog_Parameters = new Dictionary<string, object>(); //QueryLog_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //QueryLog_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //QueryLog_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog"); //QueryLog_Parameters.Add("CreateNew", false); // always create a new file on start-up //QueryLog_Parameters.Add("FlushOnWrite", true); // always flush on each write //// the DrainPipe Log expects several parameters //Dictionary<string, object> DrainPipeLog_Parameters = new Dictionary<string, object>(); //DrainPipeLog_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //DrainPipeLog_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //DrainPipeLog_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog"); //DrainPipeLog_Parameters.Add("CreateNew", false); // always create a new file on start-up //DrainPipeLog_Parameters.Add("FlushOnWrite", true); // always flush on each write //Dictionary<string, object> DrainPipeLog2_Parameters = new Dictionary<string, object>(); //DrainPipeLog2_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //DrainPipeLog2_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //DrainPipeLog2_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog2"); //DrainPipeLog2_Parameters.Add("CreateNew", false); // always create a new file on start-up //DrainPipeLog2_Parameters.Add("FlushOnWrite", true); // always flush on each write List <PluginDefinition> DrainPipes = new List <PluginDefinition>(); //DrainPipes.Add(new PluginDefinition("sones.querylog", QueryLog_Parameters)); //DrainPipes.Add(new PluginDefinition("sones.drainpipelog", DrainPipeLog_Parameters)); //DrainPipes.Add(new PluginDefinition("sones.drainpipelog", DrainPipeLog2_Parameters)); #endregion List <PluginDefinition> UsageDataCollector = new List <PluginDefinition>(); #region UsageDataCollector if (Properties.Settings.Default.UDCEnabled) { Dictionary <string, object> UDC_parameters = new Dictionary <string, object>(); UDC_parameters.Add("UDCWaitUpfrontTime", (Int32)Properties.Settings.Default.UDCWaitUpfront); // do the work in a separate thread to not slow down queries UDC_parameters.Add("UDCUpdateInterval", (Int32)Properties.Settings.Default.UDCUpdateInterval); // 10 UsageDataCollector.Add(new PluginDefinition("sones.GraphDS.UsageDataCollectorClient", UDC_parameters)); } #endregion #endregion GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(QueryLanguages, DrainPipes, UsageDataCollector); _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters); #region Start GraphDS Services #region pre-configure REST Service Dictionary <string, object> RestParameter = new Dictionary <string, object>(); RestParameter.Add("IPAddress", IPAddress.Any); RestParameter.Add("Port", Properties.Settings.Default.ListeningPort); RestParameter.Add("Username", Properties.Settings.Default.Username); RestParameter.Add("Password", Properties.Settings.Default.Password); _dsServer.StartService("sones.RESTService", RestParameter); #endregion #region Remote API Service Dictionary <string, object> RemoteAPIParameter = new Dictionary <string, object>(); RemoteAPIParameter.Add("IPAddress", IPAddress.Any); RemoteAPIParameter.Add("Port", (ushort)9970); //RemoteAPIParameter.Add("IsSecure", true); _dsServer.StartService("sones.RemoteAPIService", RemoteAPIParameter); #endregion #endregion _dsServer.LogOn(new UserPasswordCredentials(Properties.Settings.Default.Username, Properties.Settings.Default.Password)); #endregion #region Some helping lines... if (!quiet) { Console.WriteLine("This GraphDB Instance offers the following options:"); Console.WriteLine(" * If you want to suppress console output add --Q as a"); Console.WriteLine(" parameter."); Console.WriteLine(); Console.WriteLine(" * the following GraphDS Service Plugins are initialized and started: "); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(" * " + Service.PluginName); } Console.WriteLine(); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(Service.ServiceDescription); Console.WriteLine(); } Console.WriteLine("Enter 'shutdown' to initiate the shutdown of this instance."); } Console.CancelKeyPress += OnCancelKeyPress; while (!shutdown) { String command = Console.ReadLine(); if (!_ctrlCPressed) { if (command != null) { if (command.ToUpper() == "SHUTDOWN") { shutdown = true; } } } } Console.WriteLine("Shutting down GraphDS Server"); _dsServer.Shutdown(null); Console.WriteLine("Shutdown complete"); #endregion }
public sonesGraphDBStartup(String[] myArgs) { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(Properties.Settings.Default.DatabaseCulture); if (myArgs.Count() > 0) { foreach (String parameter in myArgs) { if (parameter.ToUpper() == "--Q") quiet = true; } } #region Start REST, WebDAV and WebAdmin services, send GraphDS notification IGraphDB GraphDB; if (Properties.Settings.Default.UsePersistence) { if (!quiet) Console.WriteLine("Initializing persistence layer..."); Uri configuredLocation = new Uri(Properties.Settings.Default.PersistenceLocation, UriKind.RelativeOrAbsolute); string configuredPageSize = Properties.Settings.Default.PageSize; string configuredBufferSize = Properties.Settings.Default.BufferSizeInPages; string configuredUseVertexExtensions = Properties.Settings.Default.UseVertexExtensions; string configuredWriteStrategy = Properties.Settings.Default.WriteStrategy; /* Configure the location */ Uri location = null; if (configuredLocation.IsAbsoluteUri) { location = configuredLocation; } else { Uri rootPath = new Uri(System.Reflection.Assembly.GetAssembly((typeof(sones.Library.Commons.VertexStore.IVertexStore))).Location); location = new Uri(rootPath, configuredLocation); } /* Configuration for the page size */ int pageSize = Int32.Parse(configuredPageSize); /* Configuration for the buffer size */ int bufferSize = Int32.Parse(configuredBufferSize); /* Configuration for using vertex extensions */ bool useVertexExtensions = Boolean.Parse(configuredUseVertexExtensions); /* Make a new instance by applying the configuration */ try { //Make a new GraphDB instance GraphDB = new SonesGraphDB(new GraphDBPlugins( new PluginDefinition("sones.pagedfsnonrevisionedplugin", new Dictionary<string, object>() { { "location", location }, { "pageSize", pageSize }, { "bufferSizePages", bufferSize }, { "writeStrategy", configuredWriteStrategy }, { "useVertexExtensions", useVertexExtensions } })), true, null, location.AbsolutePath); if (!quiet) Console.WriteLine("Persistence layer initialized."); } catch (Exception a) { if (!quiet) { Console.WriteLine(a.Message); Console.WriteLine(a.StackTrace); Console.Error.WriteLine("Could not access the data directory " + location.AbsoluteUri + ". Please make sure you that you have the right file access permissions!"); Console.Error.WriteLine("Using in memory storage instead."); } GraphDB = new SonesGraphDB(null,true,new CultureInfo(Properties.Settings.Default.DatabaseCulture)); } } else { GraphDB = new SonesGraphDB(null, true, new CultureInfo(Properties.Settings.Default.DatabaseCulture)); } #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 #region REST Service Plugins List<PluginDefinition> SonesRESTServices = new List<PluginDefinition>(); // not yet used #endregion #region GraphDS Service Plugins List<PluginDefinition> GraphDSServices = new List<PluginDefinition>(); #endregion #region Drain Pipes //// QueryLog DrainPipe //Dictionary<string, object> QueryLog_Parameters = new Dictionary<string, object>(); //QueryLog_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //QueryLog_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //QueryLog_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog"); //QueryLog_Parameters.Add("CreateNew", false); // always create a new file on start-up //QueryLog_Parameters.Add("FlushOnWrite", true); // always flush on each write //// the DrainPipe Log expects several parameters //Dictionary<string, object> DrainPipeLog_Parameters = new Dictionary<string, object>(); //DrainPipeLog_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //DrainPipeLog_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //DrainPipeLog_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog"); //DrainPipeLog_Parameters.Add("CreateNew", false); // always create a new file on start-up //DrainPipeLog_Parameters.Add("FlushOnWrite", true); // always flush on each write //Dictionary<string, object> DrainPipeLog2_Parameters = new Dictionary<string, object>(); //DrainPipeLog2_Parameters.Add("AsynchronousMode", true); // do the work in a separate thread to not slow down queries //DrainPipeLog2_Parameters.Add("MaximumAsyncBufferSize", (Int32)1024 * 1024 * 10); // 10 Mbytes of maximum async queue size //DrainPipeLog2_Parameters.Add("AppendLogPathAndName", "sones.drainpipelog2"); //DrainPipeLog2_Parameters.Add("CreateNew", false); // always create a new file on start-up //DrainPipeLog2_Parameters.Add("FlushOnWrite", true); // always flush on each write List<PluginDefinition> DrainPipes = new List<PluginDefinition>(); //DrainPipes.Add(new PluginDefinition("sones.querylog", QueryLog_Parameters)); //DrainPipes.Add(new PluginDefinition("sones.drainpipelog", DrainPipeLog_Parameters)); //DrainPipes.Add(new PluginDefinition("sones.drainpipelog", DrainPipeLog2_Parameters)); #endregion List<PluginDefinition> UsageDataCollector = new List<PluginDefinition>(); #region UsageDataCollector if (Properties.Settings.Default.UDCEnabled) { Dictionary<string, object> UDC_parameters = new Dictionary<string, object>(); UDC_parameters.Add("UDCWaitUpfrontTime", (Int32)Properties.Settings.Default.UDCWaitUpfront); // do the work in a separate thread to not slow down queries UDC_parameters.Add("UDCUpdateInterval", (Int32)Properties.Settings.Default.UDCUpdateInterval); // 10 UsageDataCollector.Add(new PluginDefinition("sones.GraphDS.UsageDataCollectorClient",UDC_parameters)); } #endregion #endregion GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(QueryLanguages, DrainPipes,UsageDataCollector); _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters); #region Start GraphDS Services #region pre-configure REST Service Dictionary<string, object> RestParameter = new Dictionary<string, object>(); RestParameter.Add("IPAddress", System.Net.IPAddress.Any); RestParameter.Add("Port", Properties.Settings.Default.ListeningPort); RestParameter.Add("Username", Properties.Settings.Default.Username); RestParameter.Add("Password", Properties.Settings.Default.Password); _dsServer.StartService("sones.RESTService", RestParameter); #endregion #region Remote API Service Dictionary<string, object> RemoteAPIParameter = new Dictionary<string, object>(); RemoteAPIParameter.Add("IPAddress", System.Net.IPAddress.Any); RemoteAPIParameter.Add("Port", (ushort)9970); //RemoteAPIParameter.Add("IsSecure", true); _dsServer.StartService("sones.RemoteAPIService", RemoteAPIParameter); #endregion #endregion _dsServer.LogOn(new UserPasswordCredentials(Properties.Settings.Default.Username,Properties.Settings.Default.Password)); #endregion #region Some helping lines... if (!quiet) { Console.WriteLine("This GraphDB Instance offers the following options:"); Console.WriteLine(" * If you want to suppress console output add --Q as a"); Console.WriteLine(" parameter."); Console.WriteLine(); Console.WriteLine(" * the following GraphDS Service Plugins are initialized and started: "); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(" * "+Service.PluginName); } Console.WriteLine(); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(Service.ServiceDescription); Console.WriteLine(); } Console.WriteLine("Enter 'shutdown' to initiate the shutdown of this instance."); } Console.CancelKeyPress += OnCancelKeyPress; while (!shutdown) { String command = Console.ReadLine(); if (!_ctrlCPressed) { if (command != null) { if (command.ToUpper() == "SHUTDOWN") shutdown = true; } } } Console.WriteLine("Shutting down GraphDS Server"); _dsServer.Shutdown(null); Console.WriteLine("Shutdown complete"); #endregion }
public TagExampleWithGraphMappingFramework(String[] myArgs) { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-us"); if (myArgs.Count() > 0) { foreach (String parameter in myArgs) { if (parameter.ToUpper() == "--Q") { quiet = true; } } } #region Start RemoteAPI, WebDAV and WebAdmin services, send GraphDS notification IGraphDB GraphDB; GraphDB = new SonesGraphDB(null, true, new CultureInfo("en-us")); #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 #region GraphDS Service Plugins List <PluginDefinition> GraphDSServices = new List <PluginDefinition>(); #endregion List <PluginDefinition> UsageDataCollector = new List <PluginDefinition>(); #endregion GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(QueryLanguages); _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters); #region Start GraphDS Services #region Remote API Service Dictionary <string, object> RemoteAPIParameter = new Dictionary <string, object>(); RemoteAPIParameter.Add("IPAddress", IPAddress.Parse("127.0.0.1")); RemoteAPIParameter.Add("Port", (ushort)9970); RemoteAPIParameter.Add("IsSecure", false); _dsServer.StartService("sones.RemoteAPIService", RemoteAPIParameter); #endregion #endregion #endregion #endregion #region Some helping lines... if (!quiet) { Console.WriteLine("This GraphDB Instance offers the following options:"); Console.WriteLine(" * If you want to suppress console output add --Q as a"); Console.WriteLine(" parameter."); Console.WriteLine(); Console.WriteLine(" * the following GraphDS Service Plugins are initialized and started: "); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(" * " + Service.PluginName); } Console.WriteLine(); foreach (var Service in _dsServer.AvailableServices) { Console.WriteLine(Service.ServiceDescription); Console.WriteLine(); } Console.WriteLine("Enter 'shutdown' to initiate the shutdown of this instance."); } Run(); Console.CancelKeyPress += OnCancelKeyPress; while (!shutdown) { String command = Console.ReadLine(); if (!_ctrlCPressed) { if (command != null) { if (command.ToUpper() == "SHUTDOWN") { shutdown = true; } } } } Console.WriteLine("Shutting down GraphDS Server"); _dsServer.Shutdown(null); Console.WriteLine("Shutdown complete"); #endregion }