2006-04-15 22:00:23 +02:00
|
|
|
#!/usr/bin/python
|
2006-04-17 22:56:59 +02:00
|
|
|
"""
|
|
|
|
XML-RPC server for gnuviech-admin tool
|
|
|
|
(c) 2006 Jan Dittberner
|
|
|
|
$Id$
|
|
|
|
"""
|
2006-04-15 22:00:23 +02:00
|
|
|
from DocXMLRPCServer import DocXMLRPCServer
|
2006-04-17 22:56:59 +02:00
|
|
|
from GnuviechAdmin import ServiceFacade, Settings
|
|
|
|
import logging, threading
|
2006-04-15 22:00:23 +02:00
|
|
|
|
2006-04-17 22:56:59 +02:00
|
|
|
logger = logging.getLogger()
|
|
|
|
hdlr = logging.FileHandler('xmlrpcserver.log')
|
|
|
|
f = logging.Formatter('%(asctime)s %(levelname)s %(module)s: %(message)s')
|
|
|
|
hdlr.setFormatter(f)
|
|
|
|
logger.addHandler(hdlr)
|
|
|
|
logger.setLevel(logging.DEBUG)
|
2006-04-15 22:00:23 +02:00
|
|
|
|
2006-04-17 22:56:59 +02:00
|
|
|
server = DocXMLRPCServer(Settings.RPCSERVERADDRESS)
|
|
|
|
server.register_introspection_functions()
|
|
|
|
server.register_instance(ServiceFacade())
|
2006-04-15 22:00:23 +02:00
|
|
|
|
2006-04-17 22:56:59 +02:00
|
|
|
try:
|
|
|
|
server.serve_forever()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
server.server_close()
|
|
|
|
|
|
|
|
for thread in [t for t in threading.enumerate() if t.isAlive() \
|
|
|
|
and isinstance(t, threading._Timer)]:
|
|
|
|
logger.debug("Stopping timer thread %s" % thread.getName())
|
|
|
|
thread.cancel()
|