comparison OrthancServer/main.cpp @ 1632:eb8fbcf008b5

fix build with plugins disabled
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2015 14:05:06 +0200
parents ffd23c0104af
children 1558b3226b18
comparison
equal deleted inserted replaced
1631:0d074f5f6069 1632:eb8fbcf008b5
366 locker.GetLua().Execute(script); 366 locker.GetLua().Execute(script);
367 } 367 }
368 } 368 }
369 369
370 370
371
372 #if ORTHANC_PLUGINS_ENABLED == 1
371 static void LoadPlugins(OrthancPlugins& plugins) 373 static void LoadPlugins(OrthancPlugins& plugins)
372 { 374 {
373 std::list<std::string> path; 375 std::list<std::string> path;
374 Configuration::GetGlobalListOfStringsParameter(path, "Plugins"); 376 Configuration::GetGlobalListOfStringsParameter(path, "Plugins");
375 for (std::list<std::string>::const_iterator 377 for (std::list<std::string>::const_iterator
378 std::string path = Configuration::InterpretStringParameterAsPath(*it); 380 std::string path = Configuration::InterpretStringParameterAsPath(*it);
379 LOG(WARNING) << "Loading plugin(s) from: " << path; 381 LOG(WARNING) << "Loading plugin(s) from: " << path;
380 plugins.GetManager().RegisterPlugin(path); 382 plugins.GetManager().RegisterPlugin(path);
381 } 383 }
382 } 384 }
385 #endif
383 386
384 387
385 388
386 // Returns "true" if restart is required 389 // Returns "true" if restart is required
387 static bool WaitForExit(ServerContext& context, 390 static bool WaitForExit(ServerContext& context,
494 497
495 498
496 static bool ConfigureHttpHandler(ServerContext& context, 499 static bool ConfigureHttpHandler(ServerContext& context,
497 OrthancPlugins *plugins) 500 OrthancPlugins *plugins)
498 { 501 {
502 #if ORTHANC_PLUGINS_ENABLED == 1
499 // By order of priority, first apply the "plugins" layer, so that 503 // By order of priority, first apply the "plugins" layer, so that
500 // plugins can overwrite the built-in REST API of Orthanc 504 // plugins can overwrite the built-in REST API of Orthanc
501 if (plugins) 505 if (plugins)
502 { 506 {
503 assert(context.HasPlugins()); 507 assert(context.HasPlugins());
504 context.GetHttpHandler().Register(*plugins, false); 508 context.GetHttpHandler().Register(*plugins, false);
505 } 509 }
510 #endif
506 511
507 // Secondly, apply the "static resources" layer 512 // Secondly, apply the "static resources" layer
508 #if ORTHANC_STANDALONE == 1 513 #if ORTHANC_STANDALONE == 1
509 EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER); 514 EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER);
510 #else 515 #else
591 context.GetIndex().SetMaximumStorageSize(0); 596 context.GetIndex().SetMaximumStorageSize(0);
592 } 597 }
593 598
594 LoadLuaScripts(context); 599 LoadLuaScripts(context);
595 600
601 #if ORTHANC_PLUGINS_ENABLED == 1
596 if (plugins) 602 if (plugins)
597 { 603 {
598 plugins->SetServerContext(context); 604 plugins->SetServerContext(context);
599 context.SetPlugins(*plugins); 605 context.SetPlugins(*plugins);
600 } 606 }
607 #endif
601 608
602 bool restart = ConfigureHttpHandler(context, plugins); 609 bool restart = ConfigureHttpHandler(context, plugins);
603 context.Stop(); 610 context.Stop();
604 611
612 #if ORTHANC_PLUGINS_ENABLED == 1
605 if (plugins) 613 if (plugins)
606 { 614 {
607 context.ResetPlugins(); 615 context.ResetPlugins();
608 } 616 }
617 #endif
609 618
610 return restart; 619 return restart;
611 } 620 }
612 621
613 622