正在显示
9 个修改的文件
包含
6 行增加
和
204 行删除
| @@ -11,4 +11,4 @@ SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DMAP_OUTPUT_DIRECTORY}/${DMAP_SERVER_MODUL | @@ -11,4 +11,4 @@ SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${DMAP_OUTPUT_DIRECTORY}/${DMAP_SERVER_MODUL | ||
| 11 | 11 | ||
| 12 | ADD_SUBDIRECTORY(tileserver) | 12 | ADD_SUBDIRECTORY(tileserver) |
| 13 | ADD_SUBDIRECTORY(mapserver) | 13 | ADD_SUBDIRECTORY(mapserver) |
| 14 | -ADD_SUBDIRECTORY(api) | ||
| 14 | +ADD_SUBDIRECTORY(managerapi) |
| 1 | - | ||
| 2 | -#include <iostream> | ||
| 3 | -#include <boost/lexical_cast.hpp> | ||
| 4 | -#include <boost/algorithm/string.hpp> | ||
| 5 | -#include <ctype.h> | ||
| 6 | -#include "dmplogger.h" | ||
| 7 | -#include "dmpapiparameters.h" | ||
| 8 | - | ||
| 9 | -namespace DmpApi | ||
| 10 | -{ | ||
| 11 | - DmpApiParameters::DmpApiParameters() | ||
| 12 | - : DmpServerParameters() | ||
| 13 | - { | ||
| 14 | - } | ||
| 15 | - | ||
| 16 | - DmpApiParameters::DmpApiParameters(const DmpServerParameters ¶ms) | ||
| 17 | - { | ||
| 18 | - params_ = params.Parameters(); | ||
| 19 | - } | ||
| 20 | - std::string DmpApiParameters::GetParameter(std::string& key_) | ||
| 21 | - { | ||
| 22 | - std::map<std::string, std::string>::const_iterator iter; | ||
| 23 | - iter = params_.find(key_); | ||
| 24 | - if (iter != params_.end()) | ||
| 25 | - { | ||
| 26 | - try | ||
| 27 | - { | ||
| 28 | - std::string service_name = boost::lexical_cast<std::string>(iter->second); | ||
| 29 | - return service_name; | ||
| 30 | - } | ||
| 31 | - catch (boost::bad_lexical_cast &e) | ||
| 32 | - { | ||
| 33 | - LOGGER_ERROR(e.what()); | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | - return ""; | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - std::string DmpApiParameters::service_name() const | ||
| 41 | - { | ||
| 42 | - std::map<std::string, std::string>::const_iterator iter; | ||
| 43 | - iter = params_.find("SERVICE_NAME"); | ||
| 44 | - if (iter != params_.end()) | ||
| 45 | - { | ||
| 46 | - try | ||
| 47 | - { | ||
| 48 | - std::string service_name = boost::lexical_cast<std::string>(iter->second); | ||
| 49 | - return service_name; | ||
| 50 | - } | ||
| 51 | - catch (boost::bad_lexical_cast &e) | ||
| 52 | - { | ||
| 53 | - LOGGER_ERROR(e.what()); | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - return ""; | ||
| 57 | - } | ||
| 58 | - std::string DmpApiParameters::version() const | ||
| 59 | - { | ||
| 60 | - std::map<std::string, std::string>::const_iterator iter; | ||
| 61 | - iter = params_.find("VERSION"); | ||
| 62 | - if (iter != params_.end()) | ||
| 63 | - { | ||
| 64 | - try | ||
| 65 | - { | ||
| 66 | - std::string service_name = boost::lexical_cast<std::string>(iter->second); | ||
| 67 | - return service_name; | ||
| 68 | - } | ||
| 69 | - catch (boost::bad_lexical_cast &e) | ||
| 70 | - { | ||
| 71 | - LOGGER_ERROR(e.what()); | ||
| 72 | - } | ||
| 73 | - } | ||
| 74 | - return ""; | ||
| 75 | - } | ||
| 76 | - std::string DmpApiParameters::catalog() const | ||
| 77 | - { | ||
| 78 | - std::map<std::string, std::string>::const_iterator iter; | ||
| 79 | - iter = params_.find("CATALOG"); | ||
| 80 | - if (iter != params_.end()) | ||
| 81 | - { | ||
| 82 | - try | ||
| 83 | - { | ||
| 84 | - std::string service_name = boost::lexical_cast<std::string>(iter->second); | ||
| 85 | - return service_name; | ||
| 86 | - } | ||
| 87 | - catch (boost::bad_lexical_cast &e) | ||
| 88 | - { | ||
| 89 | - LOGGER_ERROR(e.what()); | ||
| 90 | - } | ||
| 91 | - } | ||
| 92 | - return ""; | ||
| 93 | - } | ||
| 94 | -} | ||
| 95 | - |
| 1 | -#ifndef __dmpapiparameters_h__ | ||
| 2 | -#define __dmpapiparameters_h__ | ||
| 3 | -#include "dmpserverparameters.h" | ||
| 4 | - | ||
| 5 | -namespace DmpApi | ||
| 6 | -{ | ||
| 7 | - class DmpApiParameters : public DmpServerParameters | ||
| 8 | - { | ||
| 9 | - public: | ||
| 10 | - DmpApiParameters(const DmpServerParameters ¶meters); | ||
| 11 | - DmpApiParameters(); | ||
| 12 | - virtual ~DmpApiParameters() = default; | ||
| 13 | - std::string GetParameter(std::string& key_) ; | ||
| 14 | - std::string service_name() const; | ||
| 15 | - std::string version() const; | ||
| 16 | - std::string catalog() const; | ||
| 17 | - }; | ||
| 18 | -} | ||
| 19 | -#endif //__dmpapiparameters_h__ |
| 1 | -#include"dmpapiutils.h" | ||
| 2 | -namespace DmpApi | ||
| 3 | -{ | ||
| 4 | - void split(const string& strtem,char a,vector<string>& strvec) | ||
| 5 | - { | ||
| 6 | - string::size_type pos1, pos2; | ||
| 7 | - pos2 = strtem.find(a); | ||
| 8 | - pos1 = 0; | ||
| 9 | - while (string::npos != pos2) | ||
| 10 | - { | ||
| 11 | - strvec.push_back(strtem.substr(pos1, pos2 - pos1)); | ||
| 12 | - | ||
| 13 | - pos1 = pos2 + 1; | ||
| 14 | - pos2 = strtem.find(a, pos1); | ||
| 15 | - } | ||
| 16 | - strvec.push_back(strtem.substr(pos1)); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - void ptreeToJson(const boost::property_tree::ptree& pt_,std::string& str_ ) | ||
| 20 | - { | ||
| 21 | - std::stringstream ss; | ||
| 22 | - boost::property_tree::write_json(ss,pt_); | ||
| 23 | - str_=ss.str(); | ||
| 24 | - } | ||
| 25 | - void NowTime(time_t& time_) | ||
| 26 | - { | ||
| 27 | - time_t t_Now = time(0); | ||
| 28 | - struct tm* tm_Now = localtime(&t_Now); | ||
| 29 | - tm_Now->tm_hour =0; | ||
| 30 | - tm_Now->tm_min = 0; | ||
| 31 | - tm_Now->tm_sec = 0; | ||
| 32 | - time_ = mktime(tm_Now); | ||
| 33 | - } | ||
| 34 | - bool IsValidTime(const time_t& AEndTime, const time_t& ANowTime ) | ||
| 35 | - { | ||
| 36 | - return (AEndTime >= ANowTime); | ||
| 37 | - } | ||
| 38 | - void str_to_time_t(const string& aTime_, time_t& time_ ) | ||
| 39 | - { | ||
| 40 | - std::string aFormat_="%d-%d-%d"; | ||
| 41 | - struct tm tm_Temp; | ||
| 42 | - int i = sscanf(aTime_.c_str(), aFormat_.c_str(),// "%d/%d/%d %d:%d:%d" , | ||
| 43 | - &(tm_Temp.tm_year), | ||
| 44 | - &(tm_Temp.tm_mon), | ||
| 45 | - &(tm_Temp.tm_mday), | ||
| 46 | - &(tm_Temp.tm_hour), | ||
| 47 | - &(tm_Temp.tm_min), | ||
| 48 | - &(tm_Temp.tm_sec), | ||
| 49 | - &(tm_Temp.tm_wday), | ||
| 50 | - &(tm_Temp.tm_yday)); | ||
| 51 | - tm_Temp.tm_year -= 1900; | ||
| 52 | - tm_Temp.tm_mon --; | ||
| 53 | - tm_Temp.tm_hour=0; | ||
| 54 | - tm_Temp.tm_min=0; | ||
| 55 | - tm_Temp.tm_sec=0; | ||
| 56 | - tm_Temp.tm_isdst = 0; | ||
| 57 | - time_ = mktime(&tm_Temp); | ||
| 58 | - } | ||
| 59 | -} | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 63 | - |
| 1 | - | ||
| 2 | -#include <iostream> | ||
| 3 | -#include <boost/json.hpp> | ||
| 4 | -#include <boost/property_tree/ptree.hpp> | ||
| 5 | -#include <boost/property_tree/json_parser.hpp> | ||
| 6 | -#include <boost/property_tree/xml_parser.hpp> | ||
| 7 | -#include <boost/foreach.hpp> | ||
| 8 | -#include <string> | ||
| 9 | -#include <vector> | ||
| 10 | -using namespace std; | ||
| 11 | - | ||
| 12 | -namespace DmpApi | ||
| 13 | -{ | ||
| 14 | - void split(const string& strtem,char a,vector<string>& strvec); | ||
| 15 | - void ptreeToJson(const boost::property_tree::ptree& pt_,std::string& str_ ); | ||
| 16 | - void NowTime(time_t& time_); | ||
| 17 | - bool IsValidTime(const time_t& AEndTime, const time_t& ANowTime ); | ||
| 18 | - void str_to_time_t(const string& aTime_, time_t& time_ ); | ||
| 19 | -} |
| @@ -15,7 +15,7 @@ SET (API_HDRS | @@ -15,7 +15,7 @@ SET (API_HDRS | ||
| 15 | ######################################################## | 15 | ######################################################## |
| 16 | # Build | 16 | # Build |
| 17 | 17 | ||
| 18 | -ADD_LIBRARY (webapi MODULE ${API_SRCS} ${API_HDRS}) | 18 | +ADD_LIBRARY (managerapi MODULE ${API_SRCS} ${API_HDRS}) |
| 19 | 19 | ||
| 20 | INCLUDE_DIRECTORIES( | 20 | INCLUDE_DIRECTORIES( |
| 21 | ${CMAKE_SOURCE_DIR}/src/core/ | 21 | ${CMAKE_SOURCE_DIR}/src/core/ |
| @@ -23,10 +23,10 @@ INCLUDE_DIRECTORIES( | @@ -23,10 +23,10 @@ INCLUDE_DIRECTORIES( | ||
| 23 | ${CMAKE_SOURCE_DIR}/src/core/symbology | 23 | ${CMAKE_SOURCE_DIR}/src/core/symbology |
| 24 | ${CMAKE_SOURCE_DIR}/src/server/ | 24 | ${CMAKE_SOURCE_DIR}/src/server/ |
| 25 | ${CMAKE_SOURCE_DIR}/src/server/services | 25 | ${CMAKE_SOURCE_DIR}/src/server/services |
| 26 | - ${CMAKE_SOURCE_DIR}/src/server/services/api | 26 | + ${CMAKE_SOURCE_DIR}/src/server/services/managerapi |
| 27 | ) | 27 | ) |
| 28 | 28 | ||
| 29 | -set_target_properties(webapi | 29 | +set_target_properties(managerapi |
| 30 | PROPERTIES | 30 | PROPERTIES |
| 31 | CXX_VISIBILITY_PRESET hidden | 31 | CXX_VISIBILITY_PRESET hidden |
| 32 | VISIBILITY_INLINES_HIDDEN 1 | 32 | VISIBILITY_INLINES_HIDDEN 1 |
| @@ -34,7 +34,7 @@ set_target_properties(webapi | @@ -34,7 +34,7 @@ set_target_properties(webapi | ||
| 34 | SOVERSION ${COMPLETE_VERSION} | 34 | SOVERSION ${COMPLETE_VERSION} |
| 35 | ) | 35 | ) |
| 36 | 36 | ||
| 37 | -TARGET_LINK_LIBRARIES(webapi | 37 | +TARGET_LINK_LIBRARIES(managerapi |
| 38 | dmap_server | 38 | dmap_server |
| 39 | ) | 39 | ) |
| 40 | 40 | ||
| @@ -46,7 +46,7 @@ TARGET_LINK_LIBRARIES(webapi | @@ -46,7 +46,7 @@ TARGET_LINK_LIBRARIES(webapi | ||
| 46 | 46 | ||
| 47 | #MESSAGE(STATUS "DMAP_SERVER_MODULE_DIR: ${DMAP_SERVER_MODULE_DIR}") | 47 | #MESSAGE(STATUS "DMAP_SERVER_MODULE_DIR: ${DMAP_SERVER_MODULE_DIR}") |
| 48 | 48 | ||
| 49 | -INSTALL(TARGETS webapi | 49 | +INSTALL(TARGETS managerapi |
| 50 | RUNTIME DESTINATION ${DMAP_SERVER_MODULE_DIR} | 50 | RUNTIME DESTINATION ${DMAP_SERVER_MODULE_DIR} |
| 51 | LIBRARY DESTINATION ${DMAP_SERVER_MODULE_DIR} | 51 | LIBRARY DESTINATION ${DMAP_SERVER_MODULE_DIR} |
| 52 | ) | 52 | ) |
| @@ -19,9 +19,7 @@ | @@ -19,9 +19,7 @@ | ||
| 19 | #include "dmpmanagerapihandler.h" | 19 | #include "dmpmanagerapihandler.h" |
| 20 | #include "dmpserverrequest.h" | 20 | #include "dmpserverrequest.h" |
| 21 | #include "dmpserverresponse.h" | 21 | #include "dmpserverresponse.h" |
| 22 | -#include "dmpapiparameters.h" | ||
| 23 | #include "dmplogger.h" | 22 | #include "dmplogger.h" |
| 24 | -#include "dmpapiutils.h" | ||
| 25 | #include "dmpservermanager.h" | 23 | #include "dmpservermanager.h" |
| 26 | #include "dmpserverutils.h" | 24 | #include "dmpserverutils.h" |
| 27 | 25 |
请
注册
或
登录
后发表评论