source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/Log/log_services_server.py @ 2270

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.common/ndg/security/common/Log/log_services_server.py@2270
Revision 2270, 4.0 KB checked in by pjkersha, 13 years ago (diff)

Replaced

reposID = '$Id$'

with,

revision = '$Id$'

for all relevant files.

ndg.security.server/setup.py:

  • added license keyword to setup

ndg.security.server/ndg/security/server/AttAuthority/init.py:

  • removed refs to proxy certificate in getattCert call. Input cert may not necessarily be a proxy.

ndg.security.common/setup.py: Major fixes to give *working* version.

  • PyXML dependency to ZSI fixed by giving explict sourceforge dependency link
  • Get ZSI from PyPI insteads of Sourceforge
  • Moved SQLObject and MySQL dependency to a separate if clause. This will be completed later to

allow inclusion of these on provision of a given option

  • added license keyword to setup.
Line 
1"""NDG Logging Web service server side interface.  Generated and
2adapted from:
3
4wsdl2dispatch -f log.wsdl
5
6NERC Data Grid Project
7
8P J Kershaw 12/05/06
9
10Copyright (C) 2006 CCLRC & NERC
11
12This software may be distributed under the terms of the Q Public License,
13version 1.0 or later.
14"""
15__revision__ = '$Id$'
16
17import os
18
19from log_services import *
20from ZSI.ServiceContainer import ServiceSOAPBinding
21
22from Log import *
23from LogIO import *
24
25
26class log(ServiceSOAPBinding):
27    soapAction = {
28        'urn:log#debug': 'soap_debug',
29        'urn:log#error': 'soap_error',
30        'urn:log#info': 'soap_info',
31        'urn:log#warning': 'soap_warning',
32        }
33
34    def __init__(self, srv, debug=False, post='/log.wsdl', **kw):
35        ServiceSOAPBinding.__init__(self, post)
36       
37        if not isinstance(srv, Log):
38            raise LogError("Expecting NDG Log type object")
39           
40        self.__srv = srv       
41        self.__debug = debug
42        self.__caCertFilePath = os.path.expandvars(\
43                                             "$NDG_DIR/conf/certs/cacert.pem")
44       
45
46    def soap_debug(self, ps):
47        """Log a debug message"""
48
49        if self.__debug:
50            import pdb
51            pdb.set_trace()       
52       
53        # input vals in request object
54        reqArgs = ps.Parse(debugRequestWrapper)       
55        req = DebugReq(xmlTxt=str(reqArgs._debugReq))       
56
57        # assign return values to response object
58        response = debugResponseWrapper()
59       
60        try:           
61            if not req.isValidSig(self.__caCertFilePath):
62                response._debugResp = "Client signature is invalid"
63               
64            self.__srv.debug(req['msg'])
65
66        except Exception, e:
67            response._debugResp = str(e)
68
69        response._debugResp = ''
70        return response
71
72
73    def soap_error(self, ps):
74        """Log an error message"""
75       
76        if self.__debug:
77            import pdb
78            pdb.set_trace()       
79       
80        # input vals in request object
81        reqArgs = ps.Parse(errorRequestWrapper)
82        req = ErrorReq(xmlTxt=str(reqArgs._errorReq))       
83
84        # assign return values to response object
85        response = errorResponseWrapper()
86       
87        try:
88            if not req.isValidSig(self.__caCertFilePath):
89                response._errorResp = "Client signature is invalid"
90               
91            self.__srv.error(req['msg'])
92
93        except Exception, e:
94            response._errorResp = str(e)
95
96        response._errorResp = ''
97        return response
98
99
100    def soap_info(self, ps):
101        """Log an information message"""
102       
103        if self.__debug:
104            import pdb
105            pdb.set_trace()
106       
107        # input vals in request object
108        reqArgs = ps.Parse(infoRequestWrapper)
109        req = InfoReq(xmlTxt=str(reqArgs._infoReq))       
110
111        # assign return values to response object
112        response = infoResponseWrapper()
113       
114        try:
115            if not req.isValidSig(self.__caCertFilePath):
116                response._infoResp = "Client signature is invalid"
117
118            self.__srv.info(req['msg'])
119
120        except Exception, e:
121            response._infoResp = str(e)
122
123        response._infoResp = ''
124        return response
125
126
127    def soap_warning(self, ps):
128        """Log an warning message"""
129       
130        if self.__debug:
131            import pdb
132            pdb.set_trace()
133       
134        # input vals in request object
135        reqArgs = ps.Parse(warningRequestWrapper)
136        req = WarningReq(xmlTxt=str(reqArgs._warningReq))       
137
138        # assign return values to response object
139        response = warningResponseWrapper()
140       
141        try:
142            if not req.isValidSig(self.__caCertFilePath):
143                response._warningResp = "Client signature is invalid"
144               
145            self.__srv.warning(req['msg'])
146
147        except Exception, e:
148            response._warningResp = str(e)
149
150        response._warningResp = ''
151        return response
Note: See TracBrowser for help on using the repository browser.