Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 1247:32fcc5dc7562
abstraction
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 08 Dec 2014 13:54:27 +0100 |
parents | aea9277dee75 |
children | 2ffe07abd9d8 |
comparison
equal
deleted
inserted
replaced
1246:54bf0f0245f4 | 1247:32fcc5dc7562 |
---|---|
48 #include "OrthancInitialization.h" | 48 #include "OrthancInitialization.h" |
49 #include "ServerContext.h" | 49 #include "ServerContext.h" |
50 #include "OrthancFindRequestHandler.h" | 50 #include "OrthancFindRequestHandler.h" |
51 #include "OrthancMoveRequestHandler.h" | 51 #include "OrthancMoveRequestHandler.h" |
52 #include "ServerToolbox.h" | 52 #include "ServerToolbox.h" |
53 #include "DatabaseWrapper.h" | |
53 #include "../Plugins/Engine/PluginsManager.h" | 54 #include "../Plugins/Engine/PluginsManager.h" |
54 #include "../Plugins/Engine/OrthancPlugins.h" | 55 #include "../Plugins/Engine/OrthancPlugins.h" |
55 | 56 |
56 using namespace Orthanc; | 57 using namespace Orthanc; |
57 | 58 |
429 | 430 |
430 | 431 |
431 static bool StartOrthanc() | 432 static bool StartOrthanc() |
432 { | 433 { |
433 std::string storageDirectoryStr = Configuration::GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); | 434 std::string storageDirectoryStr = Configuration::GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); |
435 | |
436 | |
437 // Open the database | |
434 boost::filesystem::path indexDirectory = Configuration::InterpretStringParameterAsPath( | 438 boost::filesystem::path indexDirectory = Configuration::InterpretStringParameterAsPath( |
435 Configuration::GetGlobalStringParameter("IndexDirectory", storageDirectoryStr)); | 439 Configuration::GetGlobalStringParameter("IndexDirectory", storageDirectoryStr)); |
440 | |
441 std::auto_ptr<IDatabaseWrapper> database; | |
442 try | |
443 { | |
444 boost::filesystem::create_directories(indexDirectory); | |
445 } | |
446 catch (boost::filesystem::filesystem_error) | |
447 { | |
448 } | |
449 | |
450 database.reset(new DatabaseWrapper(indexDirectory.string() + "/index")); | |
451 | |
436 | 452 |
437 // "storage" must be declared BEFORE "ServerContext context", to | 453 // "storage" must be declared BEFORE "ServerContext context", to |
438 // avoid mess in the invokation order of the destructors. | 454 // avoid mess in the invokation order of the destructors. |
439 std::auto_ptr<IStorageArea> storage; | 455 std::auto_ptr<IStorageArea> storage; |
440 ServerContext context(indexDirectory); | 456 |
457 ServerContext context(*database); | |
441 | 458 |
442 LOG(WARNING) << "Index directory: " << indexDirectory; | 459 LOG(WARNING) << "Index directory: " << indexDirectory; |
443 | 460 |
444 context.SetCompressionEnabled(Configuration::GetGlobalBoolParameter("StorageCompression", false)); | 461 context.SetCompressionEnabled(Configuration::GetGlobalBoolParameter("StorageCompression", false)); |
445 context.SetStoreMD5ForAttachments(Configuration::GetGlobalBoolParameter("StoreMD5ForAttachments", true)); | 462 context.SetStoreMD5ForAttachments(Configuration::GetGlobalBoolParameter("StoreMD5ForAttachments", true)); |