Пример #1
0
		public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
		{
			if (configuration == null)
				throw new ArgumentNullException("configuration");
			
			try
			{
				HttpEndpointRegistration.RegisterHttpEndpointTarget();
			    HttpEndpointRegistration.RegisterAdminLogsTarget();
				if (db == null)
				{
					configuration.UpdateDataDirForLegacySystemDb();
					systemDatabase = new DocumentDatabase(configuration);
					systemDatabase.SpinBackgroundWorkers();
				}
				else
				{
					systemDatabase = db;
				}
			    fileSystemLandlord = new FileSystemsLandlord(systemDatabase);
				databasesLandlord = new DatabasesLandlord(systemDatabase);
				countersLandlord = new CountersLandlord(systemDatabase);
				requestManager = new RequestManager(databasesLandlord);
				mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer();
				mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));
			}
			catch
			{
				if (systemDatabase != null)
					systemDatabase.Dispose();
				throw;
			}
		}
Пример #2
0
        public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            try
            {
                ThreadPool.SetMinThreads(configuration.MinThreadPoolWorkerThreads, configuration.MinThreadPoolCompletionThreads);
                HttpEndpointRegistration.RegisterHttpEndpointTarget();
                HttpEndpointRegistration.RegisterAdminLogsTarget();
                if (db == null)
                {
                    configuration.UpdateDataDirForLegacySystemDb();
                    systemDatabase = new DocumentDatabase(configuration, null);
                    systemDatabase.SpinBackgroundWorkers(false);
                }
                else
                {
                    systemDatabase = db;
                }

                WebSocketBufferPool.Initialize(configuration.WebSockets.InitialBufferPoolSize);
                fileSystemLandlord            = new FileSystemsLandlord(systemDatabase);
                databasesLandlord             = new DatabasesLandlord(systemDatabase);
                countersLandlord              = new CountersLandlord(systemDatabase);
                timeSeriesLandlord            = new TimeSeriesLandlord(systemDatabase);
                requestManager                = new RequestManager(databasesLandlord);
                systemDatabase.RequestManager = requestManager;
                ClusterManager                = new Reference <ClusterManager>();
                systemDatabase.ClusterManager = ClusterManager;
                mixedModeRequestAuthorizer    = new MixedModeRequestAuthorizer();
                mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));

                serverStartupTasks = configuration.Container.GetExportedValues <IServerStartupTask>();

                foreach (var task in serverStartupTasks)
                {
                    toDispose.Add(task);
                    try
                    {
                        task.Execute(this);
                    }
                    catch (Exception e)
                    {
                        systemDatabase.LogErrorAndAddAlertOnStartupTaskException(task.GetType().FullName, e);
                    }
                }
            }
            catch (Exception)
            {
                if (systemDatabase != null)
                {
                    systemDatabase.Dispose();
                }
                throw;
            }
        }
Пример #3
0
        public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            try
            {
                HttpEndpointRegistration.RegisterHttpEndpointTarget();
                HttpEndpointRegistration.RegisterAdminLogsTarget();
                if (db == null)
                {
                    configuration.UpdateDataDirForLegacySystemDb();
                    systemDatabase = new DocumentDatabase(configuration);
                    systemDatabase.SpinBackgroundWorkers(false);
                }
                else
                {
                    systemDatabase = db;
                }

                WebSocketBufferPool.Initialize(configuration.WebSockets.InitialBufferPoolSize);
                fileSystemLandlord         = new FileSystemsLandlord(systemDatabase);
                databasesLandlord          = new DatabasesLandlord(systemDatabase);
                countersLandlord           = new CountersLandlord(systemDatabase);
                requestManager             = new RequestManager(databasesLandlord);
                mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer();
                mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));

                serverStartupTasks = configuration.Container.GetExportedValues <IServerStartupTask>();

                foreach (var task in serverStartupTasks)
                {
                    toDispose.Add(task);
                    task.Execute(this);
                }
            }
            catch
            {
                if (systemDatabase != null)
                {
                    systemDatabase.Dispose();
                }
                throw;
            }
        }
Пример #4
0
        public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            
            try
            {
                HttpEndpointRegistration.RegisterHttpEndpointTarget();
                HttpEndpointRegistration.RegisterAdminLogsTarget();
                ThreadPool.SetMinThreads(configuration.MinThreadPoolWorkerThreads, configuration.MinThreadPoolCompletionThreads);
                if (db == null)
                {
                    configuration.UpdateDataDirForLegacySystemDb();
                    systemDatabase = new DocumentDatabase(configuration);
                    systemDatabase.SpinBackgroundWorkers(false);
                }
                else
                {
                    systemDatabase = db;
                }

                WebSocketBufferPool.Initialize(configuration.WebSockets.InitialBufferPoolSize);
                fileSystemLandlord = new FileSystemsLandlord(systemDatabase);
                databasesLandlord = new DatabasesLandlord(systemDatabase);
                countersLandlord = new CountersLandlord(systemDatabase);
                requestManager = new RequestManager(databasesLandlord);
                mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer();
                mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));

                serverStartupTasks = configuration.Container.GetExportedValues<IServerStartupTask>();

                foreach (var task in serverStartupTasks)
                {
                    toDispose.Add(task);
                    task.Execute(this);
                }
            }
            catch
            {
                if (systemDatabase != null)
                    systemDatabase.Dispose();
                throw;
            }
        }
Пример #5
0
        public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            try
            {
                HttpEndpointRegistration.RegisterHttpEndpointTarget();
                HttpEndpointRegistration.RegisterAdminLogsTarget();
                if (db == null)
                {
                    configuration.UpdateDataDirForLegacySystemDb();
                    systemDatabase = new DocumentDatabase(configuration);
                    systemDatabase.SpinBackgroundWorkers();
                }
                else
                {
                    systemDatabase = db;
                }
                fileSystemLandlord         = new FileSystemsLandlord(systemDatabase);
                databasesLandlord          = new DatabasesLandlord(systemDatabase);
                countersLandlord           = new CountersLandlord(systemDatabase);
                requestManager             = new RequestManager(databasesLandlord);
                mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer();
                webSocketBufferPool        = new WebSocketBufferPool(configuration.WebSockets.InitialBufferPoolSize);
                mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));
            }
            catch
            {
                if (systemDatabase != null)
                {
                    systemDatabase.Dispose();
                }
                throw;
            }
        }