正在显示
11 个修改的文件
包含
18 行增加
和
23 行删除
| @@ -23,7 +23,7 @@ bool DmpServer::accept(const std::string &url) | @@ -23,7 +23,7 @@ bool DmpServer::accept(const std::string &url) | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | //子类实现 | 25 | //子类实现 |
| 26 | -bool DmpServer::publish(const std::string &name, unsigned int capability, const DmpProject &project) | 26 | +bool DmpServer::publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project) |
| 27 | { | 27 | { |
| 28 | return false; | 28 | return false; |
| 29 | } | 29 | } |
| @@ -28,7 +28,7 @@ public: | @@ -28,7 +28,7 @@ public: | ||
| 28 | virtual bool accept(const std::string &url); | 28 | virtual bool accept(const std::string &url); |
| 29 | virtual void executeRequest(DmpServerRequest &request, DmpServerResponse &response) = 0; | 29 | virtual void executeRequest(DmpServerRequest &request, DmpServerResponse &response) = 0; |
| 30 | 30 | ||
| 31 | - virtual bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project); | 31 | + virtual bool publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project); |
| 32 | virtual bool remove(const std::string &serviceName); | 32 | virtual bool remove(const std::string &serviceName); |
| 33 | virtual bool start(const std::string &serviceName); | 33 | virtual bool start(const std::string &serviceName); |
| 34 | virtual bool stop(const std::string &serviceName); | 34 | virtual bool stop(const std::string &serviceName); |
| @@ -99,7 +99,7 @@ bool DmpServerManager::removeProject(const std::string &serviceName) | @@ -99,7 +99,7 @@ bool DmpServerManager::removeProject(const std::string &serviceName) | ||
| 99 | return true; | 99 | return true; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | -bool DmpServerManager::publish(const std::string &serverName, const std::string &serviceName, int capabilities, const std::string &projectData) | 102 | +bool DmpServerManager::publish(const std::string& serverName, const std::string& serviceName, const std::string& title, int capabilities, const std::string& projectData) |
| 103 | { | 103 | { |
| 104 | //project | 104 | //project |
| 105 | std::string projData; | 105 | std::string projData; |
| @@ -114,7 +114,7 @@ bool DmpServerManager::publish(const std::string &serverName, const std::string | @@ -114,7 +114,7 @@ bool DmpServerManager::publish(const std::string &serverName, const std::string | ||
| 114 | return false; | 114 | return false; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | - if (!serverRegistry_->getServer(serverName)->publish(serviceName, capabilities, *project)) | 117 | + if (!serverRegistry_->getServer(serverName)->publish(serviceName, title, capabilities, *project)) |
| 118 | { | 118 | { |
| 119 | delete project; | 119 | delete project; |
| 120 | return false; | 120 | return false; |
| @@ -122,6 +122,7 @@ bool DmpServerManager::publish(const std::string &serverName, const std::string | @@ -122,6 +122,7 @@ bool DmpServerManager::publish(const std::string &serverName, const std::string | ||
| 122 | projects_[serviceName] = project; | 122 | projects_[serviceName] = project; |
| 123 | return true; | 123 | return true; |
| 124 | } | 124 | } |
| 125 | + | ||
| 125 | bool DmpServerManager::deleteService(const std::string &serverName, const std::string &serviceName) | 126 | bool DmpServerManager::deleteService(const std::string &serverName, const std::string &serviceName) |
| 126 | { | 127 | { |
| 127 | if (serverRegistry_->getServer(serverName)->remove(serviceName) && removeProject(serviceName)) | 128 | if (serverRegistry_->getServer(serverName)->remove(serviceName) && removeProject(serviceName)) |
| @@ -176,7 +177,7 @@ bool DmpServerManager::LoadServices() | @@ -176,7 +177,7 @@ bool DmpServerManager::LoadServices() | ||
| 176 | std::string type = e.second.get<std::string>("type"); | 177 | std::string type = e.second.get<std::string>("type"); |
| 177 | int capabilities =e.second.get<int>("capabilities"); | 178 | int capabilities =e.second.get<int>("capabilities"); |
| 178 | std::string project = e.second.get<std::string>("project"); | 179 | std::string project = e.second.get<std::string>("project"); |
| 179 | - this->publish(type,name,capabilities,project); | 180 | + this->publish(type,name,title,capabilities,project); |
| 180 | } | 181 | } |
| 181 | } | 182 | } |
| 182 | return true; | 183 | return true; |
| @@ -30,7 +30,7 @@ public: | @@ -30,7 +30,7 @@ public: | ||
| 30 | std::shared_ptr<DmpServer> serverForRequest(const DmpServerRequest& request); | 30 | std::shared_ptr<DmpServer> serverForRequest(const DmpServerRequest& request); |
| 31 | std::shared_ptr<DmpServerApi> apiForRequest(const DmpServerRequest& request); | 31 | std::shared_ptr<DmpServerApi> apiForRequest(const DmpServerRequest& request); |
| 32 | 32 | ||
| 33 | - bool publish(const std::string& serverName, const std::string& serviceName, int capabilities, const std::string& projectData); | 33 | + bool publish(const std::string& serverName, const std::string& serviceName, const std::string& title, int capabilities, const std::string& projectData); |
| 34 | bool deleteService(const std::string& serverName, const std::string& serviceName); | 34 | bool deleteService(const std::string& serverName, const std::string& serviceName); |
| 35 | bool startService(const std::string& serverName, const std::string& serviceName); | 35 | bool startService(const std::string& serverName, const std::string& serviceName); |
| 36 | bool stopService(const std::string& serverName, const std::string& serviceName); | 36 | bool stopService(const std::string& serverName, const std::string& serviceName); |
| @@ -9,10 +9,9 @@ | @@ -9,10 +9,9 @@ | ||
| 9 | #include "dmpserverproject.h" | 9 | #include "dmpserverproject.h" |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | -DmpServerProject::DmpServerProject(const std::string &name, const std::string &title, const std::string &description,const DmpProject *project): | 12 | +DmpServerProject::DmpServerProject(const std::string &name, const std::string &title, const DmpProject *project): |
| 13 | name_(name), | 13 | name_(name), |
| 14 | title_(title), | 14 | title_(title), |
| 15 | - description_(description), | ||
| 16 | project_(project) | 15 | project_(project) |
| 17 | { | 16 | { |
| 18 | status_ = 1; | 17 | status_ = 1; |
| @@ -18,21 +18,16 @@ | @@ -18,21 +18,16 @@ | ||
| 18 | class SERVER_EXPORT DmpServerProject | 18 | class SERVER_EXPORT DmpServerProject |
| 19 | { | 19 | { |
| 20 | public: | 20 | public: |
| 21 | - DmpServerProject(const std::string &name, | ||
| 22 | - const std::string &title, | ||
| 23 | - const std::string &description, | ||
| 24 | - const DmpProject *project); | 21 | + DmpServerProject(const std::string &name, const std::string &title, const DmpProject *project); |
| 25 | std::string createTime() { return time_;} | 22 | std::string createTime() { return time_;} |
| 26 | const DmpProject* project() const { return project_;} | 23 | const DmpProject* project() const { return project_;} |
| 27 | std::string name() const { return name_;} | 24 | std::string name() const { return name_;} |
| 28 | std::string title() const { return title_;} | 25 | std::string title() const { return title_;} |
| 29 | - std::string description() const { return description_;} | ||
| 30 | int status() { return status_;} | 26 | int status() { return status_;} |
| 31 | void setStatus(int status) { status_ = status;} | 27 | void setStatus(int status) { status_ = status;} |
| 32 | private: | 28 | private: |
| 33 | std::string name_; | 29 | std::string name_; |
| 34 | std::string title_; | 30 | std::string title_; |
| 35 | - std::string description_; | ||
| 36 | std::string time_; | 31 | std::string time_; |
| 37 | int status_; | 32 | int status_; |
| 38 | int flag_; | 33 | int flag_; |
| @@ -125,7 +125,7 @@ void DmpManagerApiHandler::regService(const DmpServerApiContext &context) const | @@ -125,7 +125,7 @@ void DmpManagerApiHandler::regService(const DmpServerApiContext &context) const | ||
| 125 | context.response()->write("{\"status\":\"false\",\"message\":\"服务发布失败\"}"); | 125 | context.response()->write("{\"status\":\"false\",\"message\":\"服务发布失败\"}"); |
| 126 | return; | 126 | return; |
| 127 | } | 127 | } |
| 128 | - if(context.manager()->publish(serverType, name, capabilities, project)) { | 128 | + if(context.manager()->publish(serverType, name, title, capabilities, project)) { |
| 129 | LOGGER_INFO("服务发布成功"); | 129 | LOGGER_INFO("服务发布成功"); |
| 130 | context.response()->write("{\"status\":\"true\",\"message\":\"Pulish service successful!\"}"); | 130 | context.response()->write("{\"status\":\"true\",\"message\":\"Pulish service successful!\"}"); |
| 131 | // std::string projData; | 131 | // std::string projData; |
| @@ -91,7 +91,7 @@ void DmpMapServer::executeRequest(DmpServerRequest &request, DmpServerResponse & | @@ -91,7 +91,7 @@ void DmpMapServer::executeRequest(DmpServerRequest &request, DmpServerResponse & | ||
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | -bool DmpMapServer::publish(const std::string &name, unsigned int capability, const DmpProject &project) | 94 | +bool DmpMapServer::publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project) |
| 95 | { | 95 | { |
| 96 | if(capability & DmpServiceType::WMTS) { | 96 | if(capability & DmpServiceType::WMTS) { |
| 97 | DmpService* wmtsservice = getService("WMTSService"); | 97 | DmpService* wmtsservice = getService("WMTSService"); |
| @@ -105,8 +105,8 @@ bool DmpMapServer::publish(const std::string &name, unsigned int capability, con | @@ -105,8 +105,8 @@ bool DmpMapServer::publish(const std::string &name, unsigned int capability, con | ||
| 105 | return false; | 105 | return false; |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | - DmpServerProject* serverProject = new DmpServerProject(name,"","", &project); | ||
| 109 | - serverProjects_[name] = serverProject; | 108 | + DmpServerProject* serverProject = new DmpServerProject(serviceName, title, &project); |
| 109 | + serverProjects_[serviceName] = serverProject; | ||
| 110 | 110 | ||
| 111 | return true; | 111 | return true; |
| 112 | } | 112 | } |
| @@ -37,7 +37,7 @@ public: | @@ -37,7 +37,7 @@ public: | ||
| 37 | std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/MapServer/([\\w]+)"); } | 37 | std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/MapServer/([\\w]+)"); } |
| 38 | std::string capability() const override; | 38 | std::string capability() const override; |
| 39 | void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override; | 39 | void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override; |
| 40 | - bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override; | 40 | + bool publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project) override; |
| 41 | bool remove(const std::string &serviceName) override; | 41 | bool remove(const std::string &serviceName) override; |
| 42 | bool start(const std::string &serviceName) override; | 42 | bool start(const std::string &serviceName) override; |
| 43 | bool stop(const std::string &serviceName) override; | 43 | bool stop(const std::string &serviceName) override; |
| @@ -98,7 +98,7 @@ void DmpTileServer::executeRequest(DmpServerRequest &request, DmpServerResponse | @@ -98,7 +98,7 @@ void DmpTileServer::executeRequest(DmpServerRequest &request, DmpServerResponse | ||
| 98 | } | 98 | } |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | -bool DmpTileServer::publish(const std::string &name, unsigned int capability, const DmpProject &project) | 101 | +bool DmpTileServer::publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project) |
| 102 | { | 102 | { |
| 103 | if(capability & DmpServiceType::WMTS) { | 103 | if(capability & DmpServiceType::WMTS) { |
| 104 | DmpService* wmtsservice = getService("WMTSService"); | 104 | DmpService* wmtsservice = getService("WMTSService"); |
| @@ -112,8 +112,8 @@ bool DmpTileServer::publish(const std::string &name, unsigned int capability, co | @@ -112,8 +112,8 @@ bool DmpTileServer::publish(const std::string &name, unsigned int capability, co | ||
| 112 | return false; | 112 | return false; |
| 113 | } | 113 | } |
| 114 | } | 114 | } |
| 115 | - DmpServerProject* serverProject = new DmpServerProject(name,"","", &project); | ||
| 116 | - serverProjects_[name] = serverProject; | 115 | + DmpServerProject* serverProject = new DmpServerProject(serviceName, title, &project); |
| 116 | + serverProjects_[serviceName] = serverProject; | ||
| 117 | 117 | ||
| 118 | return true; | 118 | return true; |
| 119 | } | 119 | } |
| @@ -37,7 +37,7 @@ public: | @@ -37,7 +37,7 @@ public: | ||
| 37 | std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/TileServer/([\\w.]+)([\\w./]*)"); } | 37 | std::string path() const override { return std::string("^/DMap/Services/?([\\w./]*)/TileServer/([\\w.]+)([\\w./]*)"); } |
| 38 | std::string capability() const override; | 38 | std::string capability() const override; |
| 39 | void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override; | 39 | void executeRequest(DmpServerRequest &request, DmpServerResponse &response) override; |
| 40 | - bool publish(const std::string &serviceName, unsigned int capability, const DmpProject &project) override; | 40 | + bool publish(const std::string &serviceName, const std::string &title, unsigned int capability, const DmpProject &project) override; |
| 41 | bool remove(const std::string &serviceName) override; | 41 | bool remove(const std::string &serviceName) override; |
| 42 | bool start(const std::string &serviceName) override; | 42 | bool start(const std::string &serviceName) override; |
| 43 | bool stop(const std::string &serviceName) override; | 43 | bool stop(const std::string &serviceName) override; |
请
注册
或
登录
后发表评论