Changeset 855


Ignore:
Timestamp:
Mar 26, 2010, 6:42:38 PM (15 years ago)
Author:
tobias
Message:

node replacement added.

Location:
vanHelsing/trunk/src
Files:
5 edited

Legend:

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

    r839 r855  
    33  <wsdl:types>
    44    <xsd:schema targetNamespace="http://www.dass-it.de/VanHelsing/">
    5       <xsd:element name="listResources" type="tns:listResourcesType">
    6       </xsd:element>
    7       <xsd:element name="listResourcesResponse" type="tns:resourceListType">
    8       </xsd:element>
     5      <xsd:element name="listResources" type="tns:listResourcesType"></xsd:element>
     6      <xsd:element name="listResourcesResponse" type="tns:resourceListType"></xsd:element>
    97      <xsd:complexType name="listResourcesType">
    108        <xsd:sequence>
     
    5149        </xsd:sequence>
    5250      </xsd:complexType>
     51      <xsd:element name="setSimpleResource">
     52              <xsd:complexType>
     53                      <xsd:sequence>
     54                              <xsd:element name="resInfo" type="tns:ResourceInfo"></xsd:element>
     55                              <xsd:element name="resAttribute" type="tns:ResourceAttributeType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
     56                      </xsd:sequence>
     57              </xsd:complexType>
     58      </xsd:element>
     59      <xsd:element name="setSimpleResourceResponse">
     60              <xsd:complexType>
     61                      <xsd:sequence>
     62                              <xsd:element name="resId" type="xsd:int"></xsd:element>
     63                              <xsd:element name="status" type="xsd:string"></xsd:element>
     64                      </xsd:sequence>
     65              </xsd:complexType>
     66      </xsd:element>
    5367    </xsd:schema>
    5468  </wsdl:types>
     
    6579        <wsdl:part name="parameters" element="tns:getSimpleResourceResponse"></wsdl:part>
    6680  </wsdl:message>
     81  <wsdl:message name="setSimpleResourceRequest">
     82          <wsdl:part name="newResource" element="tns:setSimpleResource"></wsdl:part>
     83  </wsdl:message>
     84  <wsdl:message name="setSimpleResourceResponse">
     85          <wsdl:part name="setResponse" element="tns:setSimpleResourceResponse"></wsdl:part>
     86  </wsdl:message>
    6787  <wsdl:portType name="VanHelsing">
     88
    6889    <wsdl:operation name="listResources">
    6990      <wsdl:input message="tns:listResourcesRequest"/>
     
    7394        <wsdl:input message="tns:getSimpleResourceRequest"></wsdl:input>
    7495        <wsdl:output message="tns:getSimpleResourceResponse"></wsdl:output>
     96    </wsdl:operation>
     97    <wsdl:operation name="setSimpleResource">
     98        <wsdl:input message="tns:setSimpleResourceRequest"></wsdl:input>
     99        <wsdl:output message="tns:setSimpleResourceResponse"></wsdl:output>
    75100    </wsdl:operation>
    76101  </wsdl:portType>
     
    98123                </wsdl:output>
    99124        </wsdl:operation>
     125        <wsdl:operation name="setSimpleResource">
     126                <soap:operation
     127                        soapAction="http://www.dass-it.de/VanHelsing/setResource" />
     128                <wsdl:input>
     129                        <soap:body use="literal" />
     130                </wsdl:input>
     131                <wsdl:output>
     132                        <soap:body use="literal" />
     133                </wsdl:output>
     134        </wsdl:operation>l
    100135  </wsdl:binding>
    101136  <wsdl:service name="VanHelsing">
  • vanHelsing/trunk/src/VanHelsingServer.py

    r839 r855  
    7979        return request,response
    8080
     81    def soap_setSimpleResource(self, ps, **kw):
     82        request,response=VanHelsing.soap_setSimpleResource(self, ps)
    8183
     84        resInfo = request.get_element_resInfo()
     85        resId = resInfo.get_element_resId()
     86        director = resInfo.get_element_director()
     87        attributes = request.get_element_resAttribute()
    8288
     89        resId, status = VanHelsingWrapper.setResourceById(resId, director, attributes, resInfo)
     90        response.set_element_resId(resId)
     91        response.set_element_status(status)
     92
     93        return request, response
    8394
    8495if 1:
  • vanHelsing/trunk/src/VanHelsingWrapper.py

    r839 r855  
    1313    password=""
    1414    for a in xrange(0,len):
    15        password += random.choice(charset)
     15        password += random.choice(charset)
    1616    return password
    1717
     
    8686def getResourceById(directorName,resId):
    8787    dirdcfg=getDirectorConfig(directorName)
    88     return dirdcfg.getRoot().getById(resId)   
     88    return dirdcfg.getRoot().getById(resId)
     89
     90def setResourceById(resId, directorName, attributes, resInfo):
     91    if resId > 0:
     92        myResource = getResourceById(directorName, resId)
     93        myResource.items = []
     94        for a in attributes:
     95            k = a.get_element_key()
     96            v = a.get_element_value()
     97            myResource.add(k, v)
     98
     99    else:
     100        resource = resource.Resource()
     101        resource.name = resInfo.get_element_resName()
     102        setResourceById(resource.getId, directorName, attributes, resInfo)
     103       
     104    status = "wtf"
     105   
     106    return resId, status
    89107
    90108def getResourceByName(directorName,resType,name):
     
    103121    clientIds=getResources("bacula-dir","Client")
    104122       
    105     c=getResourceById("bacula-dir",clientIds[0][0])
    106     print c
    107     print keyValueList(c)
    108 
     123    #c=getResourceById("bacula-dir",clientIds[0][0])
     124    #print c
     125    #print keyValueList(c)
     126    attList = [("name", "klaus"), ("director", "bernd"), ("FileSet","homeAll")]
     127    resId, status = setResourceById(100, "bacula-dir", attList)
  • vanHelsing/trunk/src/VanHelsing_server.py

    r839 r855  
    33#
    44# skeleton generated by "ZSI.generate.wsdl2dispatch.ServiceModuleWriter"
    5 #      /usr/bin/wsdl2py -b VanHelsing.wsdl
     5#      /usr/local/bin/wsdl2py -b VanHelsing.wsdl
    66#
    77##################################################
     
    2020
    2121getSimpleResourceResponse = GED("http://www.dass-it.de/VanHelsing/", "getSimpleResourceResponse").pyclass
     22
     23setSimpleResourceRequest = GED("http://www.dass-it.de/VanHelsing/", "setSimpleResource").pyclass
     24
     25setSimpleResourceResponse = GED("http://www.dass-it.de/VanHelsing/", "setSimpleResourceResponse").pyclass
    2226
    2327
     
    4448    root[(getSimpleResourceRequest.typecode.nspname,getSimpleResourceRequest.typecode.pname)] = 'soap_getSimpleResource'
    4549
     50    def soap_setSimpleResource(self, ps, **kw):
     51        request = ps.Parse(setSimpleResourceRequest.typecode)
     52        return request,setSimpleResourceResponse()
     53
     54    soapAction['http://www.dass-it.de/VanHelsing/setResource'] = 'soap_setSimpleResource'
     55    root[(setSimpleResourceRequest.typecode.nspname,setSimpleResourceRequest.typecode.pname)] = 'soap_setSimpleResource'
     56
  • vanHelsing/trunk/src/VanHelsing_types.py

    r839 r855  
    33#
    44# schema types generated by "ZSI.generate.wsdl2python.WriteServiceModule"
    5 #    /usr/bin/wsdl2py -b VanHelsing.wsdl
     5#    /usr/local/bin/wsdl2py -b VanHelsing.wsdl
    66#
    77##################################################
     
    192192            self.pyclass = Holder
    193193
     194    class setSimpleResource_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration):
     195        literal = "setSimpleResource"
     196        schema = "http://www.dass-it.de/VanHelsing/"
     197        def __init__(self, **kw):
     198            ns = ns0.setSimpleResource_Dec.schema
     199            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"))]
     200            kw["pname"] = ("http://www.dass-it.de/VanHelsing/","setSimpleResource")
     201            kw["aname"] = "_setSimpleResource"
     202            self.attribute_typecode_dict = {}
     203            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw)
     204            class Holder:
     205                __metaclass__ = pyclass_type
     206                typecode = self
     207                def __init__(self):
     208                    # pyclass
     209                    self._resInfo = None
     210                    self._resAttribute = []
     211                    return
     212            Holder.__name__ = "setSimpleResource_Holder"
     213            self.pyclass = Holder
     214
     215    class setSimpleResourceResponse_Dec(ZSI.TCcompound.ComplexType, ElementDeclaration):
     216        literal = "setSimpleResourceResponse"
     217        schema = "http://www.dass-it.de/VanHelsing/"
     218        def __init__(self, **kw):
     219            ns = ns0.setSimpleResourceResponse_Dec.schema
     220            TClist = [ZSI.TCnumbers.Iint(pname="resId", aname="_resId", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded")), ZSI.TC.String(pname="status", aname="_status", minOccurs=1, maxOccurs=1, nillable=False, typed=False, encoded=kw.get("encoded"))]
     221            kw["pname"] = ("http://www.dass-it.de/VanHelsing/","setSimpleResourceResponse")
     222            kw["aname"] = "_setSimpleResourceResponse"
     223            self.attribute_typecode_dict = {}
     224            ZSI.TCcompound.ComplexType.__init__(self,None,TClist,inorder=0,**kw)
     225            class Holder:
     226                __metaclass__ = pyclass_type
     227                typecode = self
     228                def __init__(self):
     229                    # pyclass
     230                    self._resId = None
     231                    self._status = None
     232                    return
     233            Holder.__name__ = "setSimpleResourceResponse_Holder"
     234            self.pyclass = Holder
     235
    194236# end class ns0 (tns: http://www.dass-it.de/VanHelsing/)
Note: See TracChangeset for help on using the changeset viewer.