Changeset 839 for vanHelsing/trunk


Ignore:
Timestamp:
Mar 12, 2010, 5:11:50 PM (15 years ago)
Author:
slederer
Message:

neue SOAP-Operation getSimpleResource implementiert

Location:
vanHelsing/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/src/VanHelsing.wsdl

    r837 r839  
    2727        </xsd:sequence>
    2828      </xsd:complexType>
     29      <xsd:element name="getSimpleResource" type="tns:getResourceType"></xsd:element>
     30      <xsd:element name="getSimpleResourceResponse">
     31        <xsd:complexType>
     32                <xsd:sequence>
     33                        <xsd:element name="resInfo" type="tns:ResourceInfo"></xsd:element>
     34                        <xsd:element name="resAttribute" type="tns:ResourceAttributeType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
     35                </xsd:sequence>
     36        </xsd:complexType>
     37      </xsd:element>
     38   
     39      <xsd:complexType name="ResourceAttributeType">
     40        <xsd:sequence>
     41                <xsd:element name="key" type="xsd:string"></xsd:element>
     42                <xsd:element name="value" type="xsd:string"></xsd:element>
     43        </xsd:sequence>
     44      </xsd:complexType>
     45   
     46   
     47      <xsd:complexType name="getResourceType">
     48        <xsd:sequence>
     49                <xsd:element name="resId" type="xsd:int"></xsd:element>
     50                <xsd:element name="director" type="xsd:string"></xsd:element>
     51        </xsd:sequence>
     52      </xsd:complexType>
    2953    </xsd:schema>
    3054  </wsdl:types>
     
    3559    <wsdl:part element="tns:listResourcesResponse" name="resultList"/>
    3660  </wsdl:message>
     61  <wsdl:message name="getSimpleResourceRequest">
     62        <wsdl:part name="resourceId" element="tns:getSimpleResource"></wsdl:part>
     63  </wsdl:message>
     64  <wsdl:message name="getSimpleResourceResponse">
     65        <wsdl:part name="parameters" element="tns:getSimpleResourceResponse"></wsdl:part>
     66  </wsdl:message>
    3767  <wsdl:portType name="VanHelsing">
    3868    <wsdl:operation name="listResources">
     
    4070      <wsdl:output message="tns:listResourcesResponse"/>
    4171    </wsdl:operation>
     72    <wsdl:operation name="getSimpleResource">
     73        <wsdl:input message="tns:getSimpleResourceRequest"></wsdl:input>
     74        <wsdl:output message="tns:getSimpleResourceResponse"></wsdl:output>
     75    </wsdl:operation>
    4276  </wsdl:portType>
    4377  <wsdl:binding name="VanHelsingSOAP" type="tns:VanHelsing">
    44     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    45     <wsdl:operation name="listResources">
    46       <soap:operation soapAction="http://localhost:8080/"/>
    47       <wsdl:input>
    48         <soap:body use="literal"/>
    49       </wsdl:input>
    50       <wsdl:output>
    51         <soap:body use="literal"/>
    52       </wsdl:output>
    53     </wsdl:operation>
     78        <soap:binding style="document"
     79                transport="http://schemas.xmlsoap.org/soap/http" />
     80        <wsdl:operation name="listResources">
     81                <soap:operation
     82                        soapAction="http://www.dass-it.de/VanHelsing/listResources" />
     83                <wsdl:input>
     84                        <soap:body use="literal" />
     85                </wsdl:input>
     86                <wsdl:output>
     87                        <soap:body use="literal" />
     88                </wsdl:output>
     89        </wsdl:operation>
     90        <wsdl:operation name="getSimpleResource">
     91                <soap:operation
     92                        soapAction="http://www.dass-it.de/VanHelsing/getResource" />
     93                <wsdl:input>
     94                        <soap:body use="literal" />
     95                </wsdl:input>
     96                <wsdl:output>
     97                        <soap:body use="literal" />
     98                </wsdl:output>
     99        </wsdl:operation>
    54100  </wsdl:binding>
    55101  <wsdl:service name="VanHelsing">
  • vanHelsing/trunk/src/VanHelsingServer.py

    r837 r839  
    4848        return request,response
    4949
     50    def soap_getSimpleResource(self, ps, **kw):
     51        request,response=VanHelsing.soap_getSimpleResource(self,ps)
     52
     53        resId=request.get_element_resId()
     54        resDirector=request.get_element_director()
     55
     56        print resId
     57
     58        resource=VanHelsingWrapper.getResourceById(resDirector,resId)
     59        attributes=VanHelsingWrapper.keyValueList(resource)
     60
     61        resInf=response.new_resInfo()
     62        print dir(response)
     63        resInf.set_element_director(resDirector)
     64        resInf.set_element_resId(resId)
     65        resInf.set_element_resType("type")
     66        resInf.set_element_resName("name")
     67
     68        response.set_element_resInfo(resInf)
     69
     70        attrlist=[]
     71
     72        for k,v in attributes:
     73            resAttr=response.new_resAttribute()
     74            resAttr.set_element_key(k)
     75            resAttr.set_element_value(v)
     76            attrlist.append(resAttr)
     77        response.set_element_resAttribute(attrlist)
     78
     79        return request,response
     80
     81
     82
     83
    5084if 1:
    5185    if len(sys.argv) < 2:
  • vanHelsing/trunk/src/VanHelsingWrapper.py

    r836 r839  
    7474    return result
    7575
     76def keyValueList(res):
     77    result=[]
     78    for i in res.items:
     79        #if i.type=="Name":
     80        #    continue
     81
     82        result.append((i.type,i.value))
     83
     84    return result
     85
    7686def getResourceById(directorName,resId):
    7787    dirdcfg=getDirectorConfig(directorName)
     
    91101    loadDirectorConfig(filename)
    92102
    93     print getResources("bacula-dir","Client")
     103    clientIds=getResources("bacula-dir","Client")
     104       
     105    c=getResourceById("bacula-dir",clientIds[0][0])
     106    print c
     107    print keyValueList(c)
    94108
  • vanHelsing/trunk/src/VanHelsing_server.py

    r837 r839  
    1717listResourcesResponse = GED("http://www.dass-it.de/VanHelsing/", "listResourcesResponse").pyclass
    1818
     19getSimpleResourceRequest = GED("http://www.dass-it.de/VanHelsing/", "getSimpleResource").pyclass
     20
     21getSimpleResourceResponse = GED("http://www.dass-it.de/VanHelsing/", "getSimpleResourceResponse").pyclass
     22
    1923
    2024# Service Skeletons
     
    3034        return request,listResourcesResponse()
    3135
    32     soapAction['http://localhost:8080/'] = 'soap_listResources'
     36    soapAction['http://www.dass-it.de/VanHelsing/listResources'] = 'soap_listResources'
    3337    root[(listResourcesRequest.typecode.nspname,listResourcesRequest.typecode.pname)] = 'soap_listResources'
    3438
     39    def soap_getSimpleResource(self, ps, **kw):
     40        request = ps.Parse(getSimpleResourceRequest.typecode)
     41        return request,getSimpleResourceResponse()
     42
     43    soapAction['http://www.dass-it.de/VanHelsing/getResource'] = 'soap_getSimpleResource'
     44    root[(getSimpleResourceRequest.typecode.nspname,getSimpleResourceRequest.typecode.pname)] = 'soap_getSimpleResource'
     45
  • vanHelsing/trunk/src/VanHelsing_types.py

    r837 r839  
    8484            self.pyclass = Holder
    8585
     86    class ResourceAttributeType_Def(ZSI.TCcompound.ComplexType, TypeDefinition):
     87        schema = "http://www.dass-it.de/VanHelsing/"
     88        type = (schema, "ResourceAttributeType")
     89        def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):
     90            ns = ns0.ResourceAttributeType_Def.schema
     91            TClist = [ZSI.TC.String(pname="key", aname="_key", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.String(pname="value", aname="_value", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]
     92            self.attribute_typecode_dict = attributes or {}
     93            if extend: TClist += ofwhat
     94            if restrict: TClist = ofwhat
     95            ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw)
     96            class Holder:
     97                __metaclass__ = pyclass_type
     98                typecode = self
     99                def __init__(self):
     100                    # pyclass
     101                    self._key = None
     102                    self._value = None
     103                    return
     104            Holder.__name__ = "ResourceAttributeType_Holder"
     105            self.pyclass = Holder
     106
     107    class getResourceType_Def(ZSI.TCcompound.ComplexType, TypeDefinition):
     108        schema = "http://www.dass-it.de/VanHelsing/"
     109        type = (schema, "getResourceType")
     110        def __init__(self, pname, ofwhat=(), attributes=None, extend=False, restrict=False, **kw):
     111            ns = ns0.getResourceType_Def.schema
     112            TClist = [ZSI.TCnumbers.Iint(pname="resId", aname="_resId", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.String(pname="director", aname="_director", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]
     113            self.attribute_typecode_dict = attributes or {}
     114            if extend: TClist += ofwhat
     115            if restrict: TClist = ofwhat
     116            ZSI.TCcompound.ComplexType.__init__(self, None, TClist, pname=pname, inorder=0, **kw)
     117            class Holder:
     118                __metaclass__ = pyclass_type
     119                typecode = self
     120                def __init__(self):
     121                    # pyclass
     122                    self._resId = None
     123                    self._director = None
     124                    return
     125            Holder.__name__ = "getResourceType_Holder"
     126            self.pyclass = Holder
     127
    86128    class listResources_Dec(ElementDeclaration):
    87129        literal = "listResources"
     
    114156            if self.pyclass is not None: self.pyclass.__name__ = "listResourcesResponse_Dec_Holder"
    115157
     158    class getSimpleResource_Dec(ElementDeclaration):
     159        literal = "getSimpleResource"
     160        schema = "http://www.dass-it.de/VanHelsing/"
     161        substitutionGroup = None
     162        def __init__(self, **kw):
     163            kw["pname"] = ("http://www.dass-it.de/VanHelsing/","getSimpleResource")
     164            kw["aname"] = "_getSimpleResource"
     165            if ns0.getResourceType_Def not in ns0.getSimpleResource_Dec.__bases__:
     166                bases = list(ns0.getSimpleResource_Dec.__bases__)
     167                bases.insert(0, ns0.getResourceType_Def)
     168                ns0.getSimpleResource_Dec.__bases__ = tuple(bases)
     169
     170            ns0.getResourceType_Def.__init__(self, **kw)
     171            if self.pyclass is not None: self.pyclass.__name__ = "getSimpleResource_Dec_Holder"
     172
     173    class getSimpleResourceResponse_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration):
     174        literal = "getSimpleResourceResponse"
     175        schema = "http://www.dass-it.de/VanHelsing/"
     176        def __init__(self, **kw):
     177            ns = ns0.getSimpleResourceResponse_Dec.schema
     178            TClist = [GTD("http://www.dass-it.de/VanHelsing/","ResourceInfo",lazy=False)(pname="resInfo", aname="_resInfo", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), GTD("http://www.dass-it.de/VanHelsing/","ResourceAttributeType",lazy=False)(pname="resAttribute", aname="_resAttribute", minOccurs=0, maxOccurs="unbounded", nillable=False, typed=False, encoded=kw.get("encoded"))]
     179            kw["pname"] = ("http://www.dass-it.de/VanHelsing/","getSimpleResourceResponse")
     180            kw["aname"] = "_getSimpleResourceResponse"
     181            self.attribute_typecode_dict = {}
     182            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw)
     183            class Holder:
     184                __metaclass__ = pyclass_type
     185                typecode = self
     186                def __init__(self):
     187                    # pyclass
     188                    self._resInfo = None
     189                    self._resAttribute = []
     190                    return
     191            Holder.__name__ = "getSimpleResourceResponse_Holder"
     192            self.pyclass = Holder
     193
    116194# end class ns0 (tns: http://www.dass-it.de/VanHelsing/)
Note: See TracChangeset for help on using the changeset viewer.