source: TI12-security/trunk/python/ndg.security.common/ndg/security/common/Gatekeeper/gatekeeper_services.py @ 2909

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

Updated for epydoc: added double underscore vars module info

  • Property svn:keywords set to Id
Line 
1##################################################
2# gatekeeper_services.py
3# generated by ZSI.wsdl2python
4#
5#
6##################################################
7
8
9import urlparse, types
10from ZSI.TCcompound import Struct
11from ZSI import client
12import ZSI
13
14class gatekeeperServiceInterface:
15    def getgatekeeper(self, portAddress=None, **kw):
16        raise NonImplementationError, "method not implemented"
17
18
19class gatekeeperServiceLocator(gatekeeperServiceInterface):
20    gatekeeper_address = "http://localhost:5200"
21    def getgatekeeperAddress(self):
22        return gatekeeperServiceLocator.gatekeeper_address
23
24    def getgatekeeper(self, portAddress=None, **kw):
25        return gatekeeperBindingSOAP(portAddress or gatekeeperServiceLocator.gatekeeper_address, **kw)
26
27
28class gatekeeperBindingSOAP:
29
30    def __init__(self, addr, **kw):
31        netloc = (urlparse.urlparse(addr)[1]).split(":") + [80,]
32        if not kw.has_key("host"):
33            kw["host"] = netloc[0]
34        if not kw.has_key("port"):
35            kw["port"] = int(netloc[1])
36        if not kw.has_key("url"):
37            kw["url"] =  urlparse.urlparse(addr)[2]
38        self.binding = client.Binding(**kw)
39
40
41    def executeAccess(self, request):
42        """
43        @param: request to executeAccessRequest::
44          _attCert: str
45
46        @return: response from executeAccessResponse::
47          _errMsg: str
48          _matchingRole: str
49        """
50
51        if not isinstance(request, executeAccessRequest) and\
52            not issubclass(executeAccessRequest, request.__class__):
53            raise TypeError, "%s incorrect request type" %(request.__class__)
54        kw = {}
55        response = self.binding.Send(None, None, request, soapaction="urn:gatekeeper#executeAccess", **kw)
56        response = self.binding.Receive(executeAccessResponseWrapper())
57        if not isinstance(response, executeAccessResponse) and\
58            not issubclass(executeAccessResponse, response.__class__):
59            raise TypeError, "%s incorrect response type" %(response.__class__)
60        return response
61
62
63    def readAccess(self, request):
64        """
65        @param: request to readAccessRequest::
66          _attCert: str
67
68        @return: response from readAccessResponse::
69          _errMsg: str
70          _matchingRole: str
71        """
72
73        if not isinstance(request, readAccessRequest) and\
74            not issubclass(readAccessRequest, request.__class__):
75            raise TypeError, "%s incorrect request type" %(request.__class__)
76        kw = {}
77        response = self.binding.Send(None, None, request, soapaction="urn:gatekeeper#readAccess", **kw)
78        response = self.binding.Receive(readAccessResponseWrapper())
79        if not isinstance(response, readAccessResponse) and\
80            not issubclass(readAccessResponse, response.__class__):
81            raise TypeError, "%s incorrect response type" %(response.__class__)
82        return response
83
84
85    def writeAccess(self, request):
86        """
87        @param: request to writeAccessRequest::
88          _attCert: str
89
90        @return: response from writeAccessResponse::
91          _errMsg: str
92          _matchingRole: str
93        """
94
95        if not isinstance(request, writeAccessRequest) and\
96            not issubclass(writeAccessRequest, request.__class__):
97            raise TypeError, "%s incorrect request type" %(request.__class__)
98        kw = {}
99        response = self.binding.Send(None, None, request, soapaction="urn:gatekeeper#writeAccess", **kw)
100        response = self.binding.Receive(writeAccessResponseWrapper())
101        if not isinstance(response, writeAccessResponse) and\
102            not issubclass(writeAccessResponse, response.__class__):
103            raise TypeError, "%s incorrect response type" %(response.__class__)
104        return response
105
106
107
108class executeAccessRequest (ZSI.TCcompound.Struct): 
109    def __init__(self, name=None, ns=None):
110        self._attCert = None
111
112        oname = None
113        if name:
114            oname = name
115            if ns:
116                oname += ' xmlns="%s"' % ns
117            ZSI.TC.Struct.__init__(self, executeAccessRequest, [ZSI.TC.String(pname="attCert",aname="_attCert",optional=1),], pname=name, aname="_%s" % name, oname=oname )
118
119class executeAccessRequestWrapper(executeAccessRequest):
120    """wrapper for rpc:encoded message"""
121
122    typecode = executeAccessRequest(name='executeAccess', ns='urn:gatekeeper')
123    def __init__( self, name=None, ns=None, **kw ):
124        executeAccessRequest.__init__( self, name='executeAccess', ns='urn:gatekeeper' )
125
126class executeAccessResponse (ZSI.TCcompound.Struct): 
127    def __init__(self, name=None, ns=None):
128        self._matchingRole = None
129        self._errMsg = None
130
131        oname = None
132        if name:
133            oname = name
134            if ns:
135                oname += ' xmlns="%s"' % ns
136            ZSI.TC.Struct.__init__(self, executeAccessResponse, [ZSI.TC.String(pname="matchingRole",aname="_matchingRole",optional=1),ZSI.TC.String(pname="errMsg",aname="_errMsg",optional=1),], pname=name, aname="_%s" % name, oname=oname )
137
138class executeAccessResponseWrapper(executeAccessResponse):
139    """wrapper for rpc:encoded message"""
140
141    typecode = executeAccessResponse(name='executeAccessResponse', ns='urn:gatekeeper')
142    def __init__( self, name=None, ns=None, **kw ):
143        executeAccessResponse.__init__( self, name='executeAccessResponse', ns='urn:gatekeeper' )
144
145class readAccessRequest (ZSI.TCcompound.Struct): 
146    def __init__(self, name=None, ns=None):
147        self._attCert = None
148
149        oname = None
150        if name:
151            oname = name
152            if ns:
153                oname += ' xmlns="%s"' % ns
154            ZSI.TC.Struct.__init__(self, readAccessRequest, [ZSI.TC.String(pname="attCert",aname="_attCert",optional=1),], pname=name, aname="_%s" % name, oname=oname )
155
156class readAccessRequestWrapper(readAccessRequest):
157    """wrapper for rpc:encoded message"""
158
159    typecode = readAccessRequest(name='readAccess', ns='urn:gatekeeper')
160    def __init__( self, name=None, ns=None, **kw ):
161        readAccessRequest.__init__( self, name='readAccess', ns='urn:gatekeeper' )
162
163class readAccessResponse (ZSI.TCcompound.Struct): 
164    def __init__(self, name=None, ns=None):
165        self._matchingRole = None
166        self._errMsg = None
167
168        oname = None
169        if name:
170            oname = name
171            if ns:
172                oname += ' xmlns="%s"' % ns
173            ZSI.TC.Struct.__init__(self, readAccessResponse, [ZSI.TC.String(pname="matchingRole",aname="_matchingRole",optional=1),ZSI.TC.String(pname="errMsg",aname="_errMsg",optional=1),], pname=name, aname="_%s" % name, oname=oname )
174
175class readAccessResponseWrapper(readAccessResponse):
176    """wrapper for rpc:encoded message"""
177
178    typecode = readAccessResponse(name='readAccessResponse', ns='urn:gatekeeper')
179    def __init__( self, name=None, ns=None, **kw ):
180        readAccessResponse.__init__( self, name='readAccessResponse', ns='urn:gatekeeper' )
181
182class writeAccessRequest (ZSI.TCcompound.Struct): 
183    def __init__(self, name=None, ns=None):
184        self._attCert = None
185
186        oname = None
187        if name:
188            oname = name
189            if ns:
190                oname += ' xmlns="%s"' % ns
191            ZSI.TC.Struct.__init__(self, writeAccessRequest, [ZSI.TC.String(pname="attCert",aname="_attCert",optional=1),], pname=name, aname="_%s" % name, oname=oname )
192
193class writeAccessRequestWrapper(writeAccessRequest):
194    """wrapper for rpc:encoded message"""
195
196    typecode = writeAccessRequest(name='writeAccess', ns='urn:gatekeeper')
197    def __init__( self, name=None, ns=None, **kw ):
198        writeAccessRequest.__init__( self, name='writeAccess', ns='urn:gatekeeper' )
199
200class writeAccessResponse (ZSI.TCcompound.Struct): 
201    def __init__(self, name=None, ns=None):
202        self._matchingRole = None
203        self._errMsg = None
204
205        oname = None
206        if name:
207            oname = name
208            if ns:
209                oname += ' xmlns="%s"' % ns
210            ZSI.TC.Struct.__init__(self, writeAccessResponse, [ZSI.TC.String(pname="matchingRole",aname="_matchingRole",optional=1),ZSI.TC.String(pname="errMsg",aname="_errMsg",optional=1),], pname=name, aname="_%s" % name, oname=oname )
211
212class writeAccessResponseWrapper(writeAccessResponse):
213    """wrapper for rpc:encoded message"""
214
215    typecode = writeAccessResponse(name='writeAccessResponse', ns='urn:gatekeeper')
216    def __init__( self, name=None, ns=None, **kw ):
217        writeAccessResponse.__init__( self, name='writeAccessResponse', ns='urn:gatekeeper' )
Note: See TracBrowser for help on using the repository browser.