Package etl :: Package connector :: Module connector'
[hide private]
[frames] | no frames]

Source Code for Module etl.connector.connector'

 1  # -*- encoding: utf-8 -*- 
 2  ############################################################################## 
 3  # 
 4  #    ETL system- Extract Transfer Load system 
 5  #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved 
 6  #    $Id$ 
 7  # 
 8  #    This program is free software: you can redistribute it and/or modify 
 9  #    it under the terms of the GNU General Public License as published by 
10  #    the Free Software Foundation, either version 3 of the License, or 
11  #    (at your option) any later version. 
12  # 
13  #    This program is distributed in the hope that it will be useful, 
14  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  #    GNU General Public License for more details. 
17  # 
18  #    You should have received a copy of the GNU General Public License 
19  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  # 
21  ############################################################################## 
22  """ 
23   ETL Connector. 
24   
25   Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).  
26   GNU General Public License. 
27  """ 
28  from etl import signal 
29  import datetime 
30 -class connector(signal):
31 """ 32 Base class of ETL Connector. 33 """ 34
35 - def __init__(self,name='connector'):
36 """ 37 Parameters 38 name : Name of the connector. 39 """ 40 self._type = 'connector' 41 super(connector, self).__init__() 42 self.name = name or '' 43 self.status = 'close'
44
45 - def __copy__(self):
46 res = connector(name=self.name) 47 return res
48
49 - def __str__(self):
50 return '<Connector name = "%s" type = "%s">'%(self.name, self._type) 51
52 - def open(self):
53 self.status = 'open' 54 self.signal('open', {'date': datetime.datetime.today()})
55
56 - def close(self, connector=False):
57 """ 58 Parameters 59 connector : Connector that is to be closed. 60 """ 61 self.status = 'close' 62 self.signal('close', {'date': datetime.datetime.today()})
63
64 - def execute(self):
65 return True
66