diff --git a/backend/GnuviechAdmin/SOAPServer.py b/backend/GnuviechAdmin/SOAPServer.py index 8d11d79..801e500 100644 --- a/backend/GnuviechAdmin/SOAPServer.py +++ b/backend/GnuviechAdmin/SOAPServer.py @@ -8,30 +8,50 @@ import SOAPpy import logging import Settings -class SOAPServer(SOAPpy.SOAPServer): +class _GnuviechLoggingInstance: """ - SOAP Server class for the gnuviech administration tool backend + Logging instance base class """ + def __init__(self, logname): + """ + Initializes a logging instance + """ + self.logger = logging.getLogger(logname) + hdlr = logging.FileHandler('soapserver.log') + hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s')) + self.logger.addHandler(hdlr) + self.logger.setLevel(logging.DEBUG) + +class Services(_GnuviechLoggingInstance): + """ + The class provides all services. + """ + def __init__(self): + """ + Construtor + """ + _GnuviechLoggingInstance.__init__(self, 'GnuviechAdminServices') + def echo(self, param0): """ This method echoes its parameter """ self.logger.debug("calling echo with " + param0) return param0 + param0 - + +class SOAPServer(SOAPpy.SOAPServer, _GnuviechLoggingInstance): + """ + SOAP Server class for the gnuviech administration tool backend + """ def __init__(self): """ This method creates the SOAPServer and registers the methods to be available to connected SOAP clients. """ SOAPpy.SOAPServer.__init__(self, Settings.soapaddress) - self.logger = logging.getLogger('GnuviechAdminSOAPServer') - hdlr = logging.FileHandler('soapserver.log') - hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s')) - self.logger.addHandler(hdlr) - self.logger.setLevel(logging.DEBUG) - self.logger.debug("created SOAPServer") - self.registerFunction(self.echo) + _GnuviechLoggingInstance.__init__(self, 'GnuviechAdminSOAPServer') + self.services = Services() + self.registerObject(self.services, Settings.namespace) self.logger.debug("registered function echo") def main(self): diff --git a/backend/GnuviechAdmin/Settings.py b/backend/GnuviechAdmin/Settings.py index b340eb6..9d3b384 100644 --- a/backend/GnuviechAdmin/Settings.py +++ b/backend/GnuviechAdmin/Settings.py @@ -2,7 +2,7 @@ # # Settings for gnuviech-admin tool backend # (c) 2006 Jan Dittberner -# $Id$ +# $Id:Settings.py 847 2006-02-21 21:21:30Z jan $ # dbsettings = { 'dbuser': 'exim4', @@ -17,5 +17,6 @@ popgroup = 'poponly' popgroup = 'poponly' pophome = '/home/mail/' webhome = '/home/www/' +namespace = 'urn:gnuviech-admin-services' soapaddress = ('127.0.0.1', 8080);