From b8a69ab874452e19f274b6f0489f6d5dadd691f9 Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Tue, 9 Jan 2018 15:25:47 +0800 Subject: [PATCH 1/3] update model service interface Signed-off-by: Franklin_Zhang --- include/INxModelService.h | 18 +++++++++--------- src/NxModelService.h | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/include/INxModelService.h b/include/INxModelService.h index 726b490..0f4ae87 100644 --- a/include/INxModelService.h +++ b/include/INxModelService.h @@ -49,25 +49,25 @@ namespace NJGIS virtual const char* getServiceName() = 0; //! get type - virtual const char* getServiceType(std::string& type) = 0; + virtual const char* getServiceType() = 0; - //! get etail URL - virtual const char* getServiceDetailURL(std::string& url) = 0; + //! get detail URL + virtual const char* getServiceDetailURL() = 0; //! get pid - virtual const char* getServicePid(std::string& pid) = 0; + virtual const char* getServicePid() = 0; //! get mid - virtual int getServiceMid(std::string& mid) = 0; + virtual const char* getServiceMid() = 0; //! get register state virtual bool getServiceRegister() = 0; //! get description - virtual const char* getServiceDescription(std::string& description) = 0; + virtual const char* getServiceDescription() = 0; //! get version - virtual const char* getServiceVersion(std::string& version) = 0; + virtual const char* getServiceVersion() = 0; //! get platform virtual const NJGIS::SERVICE::NjPlatform getServicePlatform() = 0; @@ -76,10 +76,10 @@ namespace NJGIS virtual const NJGIS::SERVICE::NjPlatform int getDeploymentTime() = 0; //! get image url - virtual const char getImage() = 0; + virtual const char* getImage() = 0; //! get deployor information - virtual int getServiceDeployorInfo() = 0; + virtual const char* getServiceDeployorInfo() = 0; //! get status (Dynamic) virtual NJGIS::SERVICE::NjServiceStatus getServiceStatus() = 0; diff --git a/src/NxModelService.h b/src/NxModelService.h index e69de29..9e5f9f0 100644 --- a/src/NxModelService.h +++ b/src/NxModelService.h @@ -0,0 +1,19 @@ +#ifndef __NJGIS_INJMODELSERVICE_H__ +#define __NJGIS_INJMODELSERVICE_H__ + +#include "../include/INxModelService.h" +#include "NxService.h" + +namespace NJGIS +{ + namespace SERVICE + { + class ModelService : public virtual INjModelService + { + public: + + }; + } +} + +#endif \ No newline at end of file -- Gitee From ba9642aca7a2568d27f514973736da68fd09f25e Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Tue, 9 Jan 2018 22:25:14 +0800 Subject: [PATCH 2/3] update model service interface Signed-off-by: Franklin_Zhang --- include/INxModelService.h | 26 ++++++++++++++--------- src/NxModelService.cpp | 1 + src/NxModelService.h | 43 +++++++++++++++++++++++++++++++++++---- src/NxServer.h | 2 +- src/NxServiceAccess.h | 2 +- 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/include/INxModelService.h b/include/INxModelService.h index 0f4ae87..b78201f 100644 --- a/include/INxModelService.h +++ b/include/INxModelService.h @@ -22,21 +22,21 @@ namespace NJGIS { OFFLINE = 0, ONLINE = 1 - } NjServiceStatus; + } NjModelServiceStatus; //! type of limitation typedef enum { PRIVATE = 0, PUBLIC = 1 - } NjServiceLimitation; + } NjModelServiceLimitation; //! type of permission typedef enum { OPEN = 0, PERMISSION = 1 - } NjServicePermission; + } NjModelServicePermission; //! model service class INjModelService: public virtual INjService @@ -60,7 +60,7 @@ namespace NJGIS //! get mid virtual const char* getServiceMid() = 0; - //! get register state + //! get register status virtual bool getServiceRegister() = 0; //! get description @@ -73,25 +73,31 @@ namespace NJGIS virtual const NJGIS::SERVICE::NjPlatform getServicePlatform() = 0; //! get deployment time - virtual const NJGIS::SERVICE::NjPlatform int getDeploymentTime() = 0; + virtual const char* getDeploymentTime() = 0; //! get image url virtual const char* getImage() = 0; - //! get deployor information - virtual const char* getServiceDeployorInfo() = 0; + //! get deployor name + virtual const char* getServiceDeployorName() = 0; + + //! get deployor email + virtual const char* getServiceDeployorEmail() = 0; //! get status (Dynamic) - virtual NJGIS::SERVICE::NjServiceStatus getServiceStatus() = 0; + virtual NJGIS::SERVICE::NjModelServiceStatus getServiceStatus() = 0; //! get limitaion (Dynamic) - virtual NJGIS::SERVICE::NjServiceLimitation getServiceLimitation() = 0; + virtual NJGIS::SERVICE::NjModelServiceLimitation getServiceLimitation() = 0; //! get permission - virtual const NJGIS::SERVICE::NjServicePermission getServicePermission() = 0; + virtual const NJGIS::SERVICE::NjModelServicePermission getServicePermission() = 0; //! invoke service virtual int invoke(const INjDataConfiguration* config, std::string& recordid) = 0; + + //! get laster information + virtual int refresh() = 0; }; } } diff --git a/src/NxModelService.cpp b/src/NxModelService.cpp index e69de29..6dbbd08 100644 --- a/src/NxModelService.cpp +++ b/src/NxModelService.cpp @@ -0,0 +1 @@ +#include "NxModelService.h" diff --git a/src/NxModelService.h b/src/NxModelService.h index 9e5f9f0..c77df46 100644 --- a/src/NxModelService.h +++ b/src/NxModelService.h @@ -1,5 +1,5 @@ -#ifndef __NJGIS_INJMODELSERVICE_H__ -#define __NJGIS_INJMODELSERVICE_H__ +#ifndef __NJGIS_NJMODELSERVICE_H__ +#define __NJGIS_NJMODELSERVICE_H__ #include "../include/INxModelService.h" #include "NxService.h" @@ -8,10 +8,45 @@ namespace NJGIS { namespace SERVICE { - class ModelService : public virtual INjModelService + class NjModelService : public virtual INjModelService, public virtual NjService { public: - + NjModelService(){}; + + private: + std::string _oid; + + std::string _name; + + std::string _type; + + std::string _detailurl; + + std::string _pid; + + std::string _mid; + + bool _registered; + + std::string _description; + + std::string _version; + + NJGIS::SERVICE::NjPlatform _platform; + + std::string _deploymentTime; + + std::string _img; + + std::string _deployor; + + std::string _deployorEmail; + + NJGIS::SERVICE::NjModelServiceStatus _status; + + NJGIS::SERVICE::NjModelServiceLimitation _limit; + + NJGIS::SERVICE::NjModelServicePermission _permission; }; } } diff --git a/src/NxServer.h b/src/NxServer.h index 56199d8..42d9d42 100644 --- a/src/NxServer.h +++ b/src/NxServer.h @@ -8,7 +8,7 @@ namespace NJGIS { namespace SERVICE { - class NjServer : public virtual INjServer, public NjService + class NjServer : public virtual INjServer, public virtual NjService { public: NjServer(){}; diff --git a/src/NxServiceAccess.h b/src/NxServiceAccess.h index fe0ca88..4068932 100644 --- a/src/NxServiceAccess.h +++ b/src/NxServiceAccess.h @@ -9,7 +9,7 @@ namespace NJGIS { namespace SERVICE { - class NjServiceAccess : public virtual INjServiceAccess, public NjService + class NjServiceAccess : public virtual INjServiceAccess, public virtual NjService { public: NjServiceAccess(const char* ip, int port):NjService(ip, port){}; -- Gitee From b4e56c88714e2f2580cf925209252f3ca32caa0c Mon Sep 17 00:00:00 2001 From: Franklin_Zhang Date: Tue, 9 Jan 2018 22:40:43 +0800 Subject: [PATCH 3/3] update model service class --- src/NxModelService.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++ src/NxModelService.h | 46 ++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/src/NxModelService.cpp b/src/NxModelService.cpp index 6dbbd08..62b4603 100644 --- a/src/NxModelService.cpp +++ b/src/NxModelService.cpp @@ -1 +1,96 @@ #include "NxModelService.h" + +const char* NJGIS::SERVICE::NjModelService::getServiceOID() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceName() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceType() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceDetailURL() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServicePid() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceMid() +{ + throw std::exception("The method or operation is not implemented."); +} + +bool NJGIS::SERVICE::NjModelService::getServiceRegister() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceDescription() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceVersion() +{ + throw std::exception("The method or operation is not implemented."); +} + +const NJGIS::SERVICE::NjPlatform NJGIS::SERVICE::NjModelService::getServicePlatform() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getDeploymentTime() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getImage() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceDeployorName() +{ + throw std::exception("The method or operation is not implemented."); +} + +const char* NJGIS::SERVICE::NjModelService::getServiceDeployorEmail() +{ + throw std::exception("The method or operation is not implemented."); +} + +NJGIS::SERVICE::NjModelServiceStatus NJGIS::SERVICE::NjModelService::getServiceStatus() +{ + throw std::exception("The method or operation is not implemented."); +} + +NJGIS::SERVICE::NjModelServiceLimitation NJGIS::SERVICE::NjModelService::getServiceLimitation() +{ + throw std::exception("The method or operation is not implemented."); +} + +const NJGIS::SERVICE::NjModelServicePermission NJGIS::SERVICE::NjModelService::getServicePermission() +{ + throw std::exception("The method or operation is not implemented."); +} + +int NJGIS::SERVICE::NjModelService::invoke( const INjDataConfiguration* config, std::string& recordid ) +{ + throw std::exception("The method or operation is not implemented."); +} + +int NJGIS::SERVICE::NjModelService::refresh() +{ + throw std::exception("The method or operation is not implemented."); +} diff --git a/src/NxModelService.h b/src/NxModelService.h index c77df46..c22fb7d 100644 --- a/src/NxModelService.h +++ b/src/NxModelService.h @@ -13,6 +13,52 @@ namespace NJGIS public: NjModelService(){}; + NjModelService(const char* oid):_oid(oid){}; + + NjModelService(const char* oid, const char* name, const char* type, const char* url, + const char* pid, const char* mid, bool registered, const char* description, const char* version, + NJGIS::SERVICE::NjPlatform platform, const char* deploytime, const char* img, const char* deployorname, + const char* deployemail, NJGIS::SERVICE::NjModelServiceStatus status, NJGIS::SERVICE::NjModelServiceLimitation limit, + NJGIS::SERVICE::NjModelServicePermission permission ){} + + virtual const char* getServiceOID(); + + virtual const char* getServiceName(); + + virtual const char* getServiceType(); + + virtual const char* getServiceDetailURL(); + + virtual const char* getServicePid(); + + virtual const char* getServiceMid(); + + virtual bool getServiceRegister(); + + virtual const char* getServiceDescription(); + + virtual const char* getServiceVersion(); + + virtual const NJGIS::SERVICE::NjPlatform getServicePlatform(); + + virtual const char* getDeploymentTime(); + + virtual const char* getImage(); + + virtual const char* getServiceDeployorName(); + + virtual const char* getServiceDeployorEmail(); + + virtual NJGIS::SERVICE::NjModelServiceStatus getServiceStatus(); + + virtual NJGIS::SERVICE::NjModelServiceLimitation getServiceLimitation(); + + virtual const NJGIS::SERVICE::NjModelServicePermission getServicePermission(); + + virtual int invoke( const INjDataConfiguration* config, std::string& recordid ); + + virtual int refresh(); + private: std::string _oid; -- Gitee