WinServer.cpp 990 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "WinServer.h"
  2. #include "HelloImp.h"
  3. #include "servant/Application.h"
  4. using namespace std;
  5. WinServer::~WinServer()
  6. {
  7. }
  8. void
  9. WinServer::initialize()
  10. {
  11. addServant<HelloImp>(ServerConfig::Application + "." + ServerConfig::ServerName + ".WinObj");
  12. TARS_ADD_ADMIN_CMD_NORMAL("AdminCmdNormalTest", WinServer::cmdAdd);
  13. TARS_ADD_ADMIN_CMD_NORMAL("CmdToDelete", WinServer::cmdAdd);
  14. getNotifyObserver()->unregisterNotify("CmdToDelete", this);
  15. TARS_ADD_ADMIN_CMD_NORMAL("DeletePrefixCmd", WinServer::delTarsViewVersion);
  16. }
  17. void WinServer::destroyApp()
  18. {
  19. }
  20. void WinServer::run()
  21. {
  22. this->waitForShutdown();
  23. }
  24. bool WinServer::cmdAdd(const string& command, const string& params, string& result)
  25. {
  26. result = params + " AdminCmdNormalTest success!";
  27. return true;
  28. }
  29. bool WinServer::delTarsViewVersion(const string& command, const string& params, string& result)
  30. {
  31. getNotifyObserver()->unregisterPrefix("tars.viewversion", this);
  32. result = "Delete success!";
  33. return true;
  34. }