HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
ConnectionManager.py
Go to the documentation of this file.
1 '''
2 Created on Feb 14, 2014
3 
4 @author: igor
5 '''
6 
7 
8 from transport.ConnectionBuilder import ConnectionBuilder
9 from transport.IDGenerator import IDGenerator
10 import transport.Consts as consts
11 
12 
13 
16 class ConnectionManager(object):
17 
18 
19 
21  def __init__(self):
22  '''
23  Constructor
24  '''
25  #@var builder
26  #a member variable, holds a connection builder object
28 
29 
30 
34  def create_connection(self, connect_params):
35  return self.builder.build(consts.DATA_CONNECT_TYPE, connect_params)
36 
37 
38 
41  def destroy_connection(self, connection):
42  connection.close()
43 
44 
45 
def create_connection(self, connect_params)
create a data_connect_type connection
def destroy_connection(self, connection)
destroy connection
Simple wrapper that hide all routines related to create and destroy connections.
The builder is used to encapsulation routine of creation various type of connections.
IDGenerator is used to generate unique id for connections.
Definition: IDGenerator.py:15