[tuxdroid-svn] r4688 - software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_ba
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-05-27 14:06:43
|
Author: remi
Date: 2009-05-27 16:06:34 +0200 (Wed, 27 May 2009)
New Revision: 4688
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
Log:
* added command to restart the server
* TODO : linux.
Modified: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py 2009-05-27 09:49:31 UTC (rev 4687)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py 2009-05-27 14:06:34 UTC (rev 4688)
@@ -25,6 +25,14 @@
"""
httpServer.stop()
+ def restartServer(self):
+ """Restart the server.
+ """
+ # TODO: Restart on linux
+ if os.name == 'nt':
+ t = threading.Thread(target = os.system, args = ["tuxhttpserver_restart.exe",])
+ t.start()
+
def getVersion(self):
"""Get the server version.
@return: The server version.
@@ -59,6 +67,28 @@
resourceServer.addService(TDSServiceServerStop)
# ------------------------------------------------------------------------------
+# Declaration of the service "restart".
+# ------------------------------------------------------------------------------
+class TDSServiceServerRestart(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "restart"
+ self.comment = "Restart the server."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceServer.restartServer()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerRestart)
+
+# ------------------------------------------------------------------------------
# Declaration of the service "version".
# ------------------------------------------------------------------------------
class TDSServiceServerVersion(TDSService):
|