Changeset 824 for vanHelsing/trunk


Ignore:
Timestamp:
Feb 17, 2010, 5:49:19 PM (14 years ago)
Author:
slederer
Message:

Generierter Server-Code

Location:
vanHelsing/trunk/src
Files:
3 added
2 edited

Legend:

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

    r823 r824  
    33  <wsdl:types>
    44    <xsd:schema targetNamespace="http://www.dass-it.de/VanHelsing/">
    5       <xsd:element name="ResourceName" type="tns:ResourceNameType">
     5      <xsd:element name="listResources" type="tns:listResourcesType">
    66      </xsd:element>
    7       <xsd:element name="ResourceResponse"
    8         type="tns:Resource">
     7      <xsd:element name="listResourcesResponse" type="tns:resourceListType">
    98      </xsd:element>
    10 
    11       <xsd:complexType name="Resource">
    12 
     9      <xsd:complexType name="listResourcesType">
    1310        <xsd:sequence>
    14                 <xsd:element name="attributes" type="tns:Attribute"></xsd:element>
     11                <xsd:element name="resourceType" type="xsd:string"></xsd:element>
     12                <xsd:element name="director" type="xsd:string"></xsd:element>
    1513        </xsd:sequence>
    16         <xsd:attribute name="id" type="xsd:int"></xsd:attribute>
    17         <xsd:attribute name="type" type="xsd:string"></xsd:attribute>
    18         <xsd:attribute name="name" type="xsd:string"></xsd:attribute>
    19         <xsd:attribute name="director" type="xsd:string"></xsd:attribute>
    2014      </xsd:complexType>
    21 
    22       <xsd:complexType name="Attribute">
    23         <xsd:attribute name="key" type="xsd:string"></xsd:attribute>
    24         <xsd:attribute name="value" type="xsd:string"></xsd:attribute>
     15      <xsd:complexType name="resourceListType">
     16        <xsd:sequence>
     17                <xsd:element name="resourceList" type="tns:ResourceInfo" maxOccurs="unbounded" minOccurs="0"></xsd:element>
     18        </xsd:sequence>
    2519      </xsd:complexType>
    26             <xsd:element name="in" type="xsd:string"></xsd:element>
    27             <xsd:element name="getResourceByIdResponse">
    28                 <xsd:complexType>
    29                         <xsd:sequence>
    30                                 <xsd:element name="out" type="xsd:string"></xsd:element>
    31                         </xsd:sequence>
    32                 </xsd:complexType>
    33             </xsd:element>
    34             <xsd:complexType name="ResourceIdType">
    35                 <xsd:attribute name="id" type="xsd:int"></xsd:attribute>
    36                 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>
    37             </xsd:complexType>
    38             <xsd:element name="ResourceId" type="tns:ResourceIdType"></xsd:element>
    39             <xsd:complexType name="ResourceNameType">
    40                 <xsd:attribute name="type" type="xsd:string"></xsd:attribute>
    41                 <xsd:attribute name="name" type="xsd:string"></xsd:attribute>
    42                 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>
    43             </xsd:complexType>
    4420   
    45             <xsd:complexType name="ResourceInfo">
    46                 <xsd:attribute name="id" type="xsd:int"></xsd:attribute>
    47                 <xsd:attribute name="type" type="xsd:string"></xsd:attribute>
    48                 <xsd:attribute name="name" type="xsd:string"></xsd:attribute>
    49                 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>
    50             </xsd:complexType>
    51    
    52             <xsd:attribute name="NewAttribute" type="xsd:string"></xsd:attribute>
    53        
    54 
    55    
    56             <xsd:element name="in1" type="xsd:string"></xsd:element>
    57             <xsd:element name="getResourcesByTypeResponse">
    58                 <xsd:complexType>
    59                         <xsd:sequence>
    60                                 <xsd:element name="out" type="xsd:string"></xsd:element>
    61                         </xsd:sequence>
    62                 </xsd:complexType>
    63             </xsd:element>
    64             <xsd:element name="ResourceType" type="tns:ResourceType"></xsd:element>
    65            
    66             <xsd:complexType name="ResourceType">
    67                 <xsd:attribute name="type" type="xsd:string"></xsd:attribute>
    68                 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>
    69             </xsd:complexType>
    70             <xsd:element name="ResourceListResponse"
    71                 type="tns:ResourceList">
    72             </xsd:element>
    73 
    74             <xsd:complexType name="ResourceList">
    75                 <xsd:sequence maxOccurs="unbounded" minOccurs="0">
    76                         <xsd:element name="resources" type="tns:ResourceInfo"></xsd:element>
    77                 </xsd:sequence>
    78             </xsd:complexType>
     21      <xsd:complexType name="ResourceInfo">
     22        <xsd:sequence>
     23                <xsd:element name="resId" type="xsd:int"></xsd:element>
     24                <xsd:element name="resType" type="xsd:string"></xsd:element>
     25                <xsd:element name="resName" type="xsd:string"></xsd:element>
     26                <xsd:element name="director" type="xsd:string"></xsd:element>
     27        </xsd:sequence>
     28      </xsd:complexType>
    7929    </xsd:schema>
    8030  </wsdl:types>
    81   <wsdl:message name="getResourceByNameRequest">
    82     <wsdl:part element="tns:ResourceName" name="resourceName" />
    83   </wsdl:message>
    84   <wsdl:message name="getResourceByNameResponse">
    85     <wsdl:part name="resourceResult" element="tns:ResourceResponse"/>
    86   </wsdl:message>
    87   <wsdl:message name="getResourceByIdRequest">
    88         <wsdl:part name="resourceId" element="tns:ResourceId"></wsdl:part>
    89   </wsdl:message>
    90   <wsdl:message name="getResourceByIdResponse">
    91         <wsdl:part name="resourceResult" element="tns:ResourceResponse"></wsdl:part>
    92   </wsdl:message>
    9331  <wsdl:message name="listResourcesRequest">
    94         <wsdl:part name="resourceType" element="tns:ResourceType"></wsdl:part>
     32    <wsdl:part name="resourceType" element="tns:listResources"/>
    9533  </wsdl:message>
    9634  <wsdl:message name="listResourcesResponse">
    97         <wsdl:part name="resourcesResult" element="tns:ResourceListResponse"></wsdl:part>
     35    <wsdl:part element="tns:listResourcesResponse" name="resultList"/>
    9836  </wsdl:message>
    9937  <wsdl:portType name="VanHelsing">
    100     <wsdl:operation name="getResourceByName">
    101       <wsdl:input message="tns:getResourceByNameRequest"/>
    102       <wsdl:output message="tns:getResourceByNameResponse"/>
    103     </wsdl:operation>
    104     <wsdl:operation name="getResourceById">
    105         <wsdl:input message="tns:getResourceByIdRequest"></wsdl:input>
    106         <wsdl:output message="tns:getResourceByIdResponse"></wsdl:output>
    107     </wsdl:operation>
    10838    <wsdl:operation name="listResources">
    109         <wsdl:input message="tns:listResourcesRequest"></wsdl:input>
    110         <wsdl:output message="tns:listResourcesResponse"></wsdl:output>
     39      <wsdl:input message="tns:listResourcesRequest"/>
     40      <wsdl:output message="tns:listResourcesResponse"/>
    11141    </wsdl:operation>
    11242  </wsdl:portType>
    11343  <wsdl:binding name="VanHelsingSOAP" type="tns:VanHelsing">
    11444    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    115     <wsdl:operation name="getResourceByName">
     45    <wsdl:operation name="listResources">
    11646      <soap:operation soapAction="http://www.dass-it.de/VanHelsing/NewOperation"/>
    11747      <wsdl:input>
     
    12555  <wsdl:service name="VanHelsing">
    12656    <wsdl:port binding="tns:VanHelsingSOAP" name="VanHelsingSOAP">
    127       <soap:address location="http://www.dass-it.de/VanHelsing"/>
     57      <soap:address location="http://localhost:8080/"/>
    12858    </wsdl:port>
    12959  </wsdl:service>
  • vanHelsing/trunk/src/bcfg.py

    r823 r824  
    88import resource
    99import directive
    10 import random
     10
    1111
    1212RESOURCE_TYPES = ('dird', 'console', 'filed', 'stored')
     
    157157    pass
    158158
    159 def genpasswd(len=32):
    160     charset="01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!/%()=?@"
    161     password=""
    162     for a in xrange(0,len):
    163        password += random.choice(charset)
    164     return password
    165 
    166 
    167 def createClientConfig(dirdcfg,clientName,clientPassword=genpasswd()):
    168     director=dirdcfg.getRoot().getByType("Director")[0]
    169     dirdName=director.getName()
    170     r=dirdcfg.getRoot().getByName(clientName)
    171     if len(r)==1:
    172         client=r[0]
    173     else:
    174         return
    175    
    176     filename=clientName+".conf"
    177     fdcfg=FiledConfig(filename)
    178     fdcfg.setDefaults(dirdName,clientPassword,clientName)
    179     fdcfg.write()
    180 
    181 def createAllClientConfigs(dirdcfg):
    182     clients=dirdcfg.getRoot().getByType("Client",1)
    183     director=dirdcfg.getRoot().getByType("Director")[0]
    184     dirdName=director.getName()
    185 
    186     for c in clients:
    187         print c
    188         clientName=c.getName()
    189         if clientName!=None:
    190             r=c.getByType("Password")
    191             if len(r)>0:
    192                 clientPassword=r[0].value
    193                 clientPassword=clientPassword.replace('"','')
    194             else:
    195                 clientPassword=""
    196             filename=clientName+".conf"
    197             fdcfg=FiledConfig(filename)
    198             fdcfg.setDefaults(dirdName,clientPassword,clientName)
    199             fdcfg.write()
    200 
    201 def getDirectors():
    202     return [ "bacula-dir" ];
    203 
    204 def loadDirectorConfig(filename):
    205     global currentConfig
    206     currentConfig=DirdConfig(filename)
    207     currentConfig.read()
    208 
    209 def getDirectorConfig(directorName):
    210     global currentConfig
    211     return currentConfig
    212 
    213 def getClients(directorName):
    214     return getResources(directorName,"Client")
    215 
    216 def getResources(directorName,resType):
    217     dirdcfg=getDirectorConfig(directorName)
    218     resources=dirdcfg.getRoot().getByType(resType,1)
    219     result=[]
    220     for r in resources:
    221         result.append((r.id,r.getName()))
    222     return result
    223 
    224 def getResourceById(directorName,resId):
    225     dirdcfg=getDirectorConfig(directorName)
    226     return dirdcfg.getRoot().getById(resId)   
    227 
    228 def getResourceByName(directorName,resType,name):
    229     dirdcfg=getDirectorConfig(directorName)
    230     return dirdcfg.getRoot().getByName(name,resType)[0]   
    231 
    232 
    233159if __name__ == "__main__":
    234160    if len(sys.argv) < 2:
Note: See TracChangeset for help on using the changeset viewer.