Subversion Repositories SmartDukaan

Rev

Rev 1415 | Rev 3537 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1415 Rev 3187
Line 12... Line 12...
12
 
12
 
13
 
13
 
14
host_name = 'localhost'
14
host_name = 'localhost'
15
port = 9001
15
port = 9001
16
dbname = 'catalog'
16
dbname = 'catalog'
-
 
17
db_hostname='localhost'
17
 
18
 
18
def main():
19
def main():
19
    #get the config client
20
    #get the config client
20
    try:
21
    try:
21
        config_client = ConfigClient()
22
        config_client = ConfigClient()
22
        host_name = config_client.get_property('catalog_service_server_host')
23
        host_name = config_client.get_property('catalog_service_server_host')
23
        port = config_client.get_property('catalog_service_server_port')
24
        port = config_client.get_property('catalog_service_server_port')
24
        dbname = config_client.get_property('catalog_service_dbname')
25
        dbname = config_client.get_property('catalog_service_dbname')
-
 
26
        db_hostname = config_client.get_property('catalog_service_db_hostname')
25
    except:
27
    except:
26
        #error while spawning the config server
28
        #error while spawning the config server
27
        host_name = 'localhost'
29
        host_name = 'localhost'
28
        port = 9001
30
        port = 9001
29
        dbname = 'catalog'
31
        dbname = 'catalog'
-
 
32
        db_hostname='localhost'
30
    
33
    
31
    handler = InventoryServiceHandler(dbname)
34
    handler = InventoryServiceHandler(dbname, db_hostname)
32
    processor = InventoryService.Processor(handler)
35
    processor = InventoryService.Processor(handler)
33
    transport = TSocket.TServerSocket(port)
36
    transport = TSocket.TServerSocket(port)
34
    tfactory = TTransport.TFramedTransportFactory()
37
    tfactory = TTransport.TFramedTransportFactory()
35
    pfactory = TBinaryProtocolFactory()
38
    pfactory = TBinaryProtocolFactory()
36
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)
39
    server = TServer.TThreadedServer(processor, transport, tfactory, pfactory)