# HG changeset patch # User Sebastien Jodogne # Date 1366639173 -7200 # Node ID ff647eedfbe1a9d6e2523d1f8c90c21c6a67ce6a # Parent dfbd3989a3f9017d7371600ea67c5c2f882ae8aa enabling of Find/Move commands diff -r dfbd3989a3f9 -r ff647eedfbe1 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Fri Apr 19 09:46:14 2013 +0200 +++ b/OrthancServer/main.cpp Mon Apr 22 15:59:33 2013 +0200 @@ -39,6 +39,7 @@ #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" #include "../Core/HttpServer/FilesystemHttpHandler.h" #include "../Core/HttpServer/MongooseServer.h" +#include "../Core/DicomFormat/DicomArray.h" #include "DicomProtocol/DicomServer.h" #include "OrthancInitialization.h" #include "ServerContext.h" @@ -47,13 +48,13 @@ -class MyDicomStore : public IStoreRequestHandler +class MyStoreRequestHandler : public IStoreRequestHandler { private: ServerContext& context_; public: - MyDicomStore(ServerContext& context) : + MyStoreRequestHandler(ServerContext& context) : context_(context) { } @@ -71,24 +72,78 @@ }; -class MyDicomStoreFactory : public IStoreRequestHandlerFactory +class MyFindRequestHandler : public IFindRequestHandler +{ +private: + ServerContext& context_; + +public: + MyFindRequestHandler(ServerContext& context) : + context_(context) + { + } + + virtual void Handle(const DicomMap& input, + DicomFindAnswers& answers) + { + printf("FindRequest\n"); + DicomArray a(input); + a.Print(stdout); + } +}; + + +class MyMoveRequestHandler : public IMoveRequestHandler { private: ServerContext& context_; public: - MyDicomStoreFactory(ServerContext& context) : context_(context) + MyMoveRequestHandler(ServerContext& context) : + context_(context) + { + } + +public: + virtual IMoveRequestIterator* Handle(const std::string& target, + const DicomMap& input) + { + printf("MoveRequest\n"); + return NULL; + } +}; + + +class MyDicomServerFactory : + public IStoreRequestHandlerFactory, + public IFindRequestHandlerFactory, + public IMoveRequestHandlerFactory +{ +private: + ServerContext& context_; + +public: + MyDicomServerFactory(ServerContext& context) : context_(context) { } virtual IStoreRequestHandler* ConstructStoreRequestHandler() { - return new MyDicomStore(context_); + return new MyStoreRequestHandler(context_); + } + + virtual IFindRequestHandler* ConstructFindRequestHandler() + { + return new MyFindRequestHandler(context_); + } + + virtual IMoveRequestHandler* ConstructMoveRequestHandler() + { + return new MyMoveRequestHandler(context_); } void Done() { - //index_.db().Execute("DELETE FROM Studies"); } }; @@ -237,13 +292,16 @@ context.GetIndex().SetMaximumStorageSize(0); } - MyDicomStoreFactory storeScp(context); + MyDicomServerFactory serverFactory(context); + { // DICOM server DicomServer dicomServer; dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false)); - dicomServer.SetStoreRequestHandlerFactory(storeScp); + dicomServer.SetStoreRequestHandlerFactory(serverFactory); + dicomServer.SetMoveRequestHandlerFactory(serverFactory); + dicomServer.SetFindRequestHandlerFactory(serverFactory); dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242)); dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC")); @@ -288,7 +346,7 @@ LOG(WARNING) << "Orthanc is stopping"; } - storeScp.Done(); + serverFactory.Done(); } catch (OrthancException& e) { diff -r dfbd3989a3f9 -r ff647eedfbe1 Resources/Configuration.json --- a/Resources/Configuration.json Fri Apr 19 09:46:14 2013 +0200 +++ b/Resources/Configuration.json Mon Apr 22 15:59:33 2013 +0200 @@ -54,7 +54,7 @@ /** - * Security-related options + * Security-related options for the HTTP server **/ // Whether remote hosts can connect to the HTTP server @@ -63,7 +63,7 @@ // Whether or not SSL is enabled "SslEnabled" : false, - // Path to the SSL certificate + // Path to the SSL certificate (meaningful only if SSL is enabled) "SslCertificate" : "certificate.pem", // Whether or not the password protection is enabled