Пример #1
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'server_url', REQUIRED, config)
     set_attribute(self, 'node', REQUIRED, config)
     set_attribute(self, 'period', 30, config, int)
     set_attribute(self,'connection','/services/network',config,as_node)
     set_attribute(self,'timeout',60,config,int)
Пример #2
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'log', self.parent.parent, config, as_node)
     set_attribute(self, 'gm_time', 1, config, as_boolean)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Пример #3
0
 def start(self):
     ServiceNode.start(self)
     # this will correctly add the msglog as a child
     #  to the logger.
     if 'msglog' not in self.children_names():
         columns = mpx.lib.msglog.get_columns()
         log = Log()
         log.configure({'name':'msglog', 'parent':self})
         for c in columns:
             column = mpx.lib.factory('mpx.service.logger.column')
             config = c.configuration()
             config['parent'] = log
             column.configure(config)
     self._logs = PersistentDataObject(self)
     self._logs.names = []
     self._logs.load()
     for name in self._logs.names:
         if ((not mpx.lib.log.log_exists(name)) and 
             (name not in self.children_names())):
             log = mpx.lib.log.log(name)
             log.destroy()
             del(log)
     self._logs.names = []
     for child in self.children_nodes():
         if not isinstance(child, Alias):
             # Don't manage other managers' logs...
             self._logs.names.append(child.name)
     self._logs.save()
Пример #4
0
 def configure(self, config):
     set_attribute(self, 'debug', 0, config, int)
     set_attribute(self, 'ip', '', config)
     default = '${mpx.properties.%s_PORT}' % self.server_type
     set_attribute(self,'port',default,config,int)
     set_attribute(self,'user_manager',
                   as_node('/services/User Manager'),config,as_node)
     set_attribute(self,'authentication','form',config)
     if (self.authentication is not None and
         self.authentication not in ('digest','basic','form')):
         raise EInvalidValue('authentication',self.authentication,
                             'Authentication scheme not recognized.')
     set_attribute(self,'port',default,config,int)
     set_attribute(self, 'maintenance_interval', 25, config, int)
     set_attribute(self, 'zombie_timeout', 600, config, int)
     set_attribute(self, 'thread_count', 3, config, int)        
     if not self.has_child("Request Responder"):
         self._setup_request_responder()
     if not self.has_child("Authenticator"):
         self._setup_authentication_handler()
     if not self.has_child("PSP Handler"):
         self._setup_psp_handler()
     if not self.has_child("JSON-RPC Handler"):
         self._setup_json_handler()
     ServiceNode.configure(self, config)
Пример #5
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'heating', REQUIRED, config, as_node)
     set_attribute(self, 'cooling', REQUIRED, config, as_node)
     set_attribute(self, 'temperature', REQUIRED, config, as_node)
     set_attribute(self, 'minimum', REQUIRED, config, float)
     set_attribute(self, 'maximum', REQUIRED, config, float)
Пример #6
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'log', self.parent.parent, config, as_node)
     set_attribute(self, 'gm_time', 1, config, as_boolean)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Пример #7
0
 def __init__(self):
     ServiceNode.__init__(self)
     UTC().configure({'name': 'UTC', 'parent': self})
     Local().configure({'name': 'local', 'parent': self})
     self._tz_mtime = None
     self._in_err = False
     self._scheduled = None
Пример #8
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'default_log', '/services/logger/local_view',
                   config)
     set_attribute(self, 'use_cache', 1, config, int)
     set_attribute(self, 'debug', 1, config, int)
     return
Пример #9
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'server_url', REQUIRED, config)
     set_attribute(self, 'node', REQUIRED, config)
     set_attribute(self, 'period', 30, config, int)
     set_attribute(self, 'connection', '/services/network', config, as_node)
     set_attribute(self, 'timeout', 60, config, int)
Пример #10
0
 def __init__(self):
     ServiceNode.__init__(self)
     UTC().configure({'name':'UTC','parent':self})
     Local().configure({'name':'local','parent':self})
     self._tz_mtime = None
     self._in_err = False
     self._scheduled = None
Пример #11
0
 def start(self):
     ServiceNode.start(self)
     # this will correctly add the msglog as a child
     #  to the logger.
     if 'msglog' not in self.children_names():
         columns = mpx.lib.msglog.get_columns()
         log = Log()
         log.configure({'name': 'msglog', 'parent': self})
         for c in columns:
             column = mpx.lib.factory('mpx.service.logger.column')
             config = c.configuration()
             config['parent'] = log
             column.configure(config)
     self._logs = PersistentDataObject(self)
     self._logs.names = []
     self._logs.load()
     for name in self._logs.names:
         if ((not mpx.lib.log.log_exists(name))
                 and (name not in self.children_names())):
             log = mpx.lib.log.log(name)
             log.destroy()
             del (log)
     self._logs.names = []
     for child in self.children_nodes():
         if not isinstance(child, Alias):
             # Don't manage other managers' logs...
             self._logs.names.append(child.name)
     self._logs.save()
Пример #12
0
 def configure(self, config):
     set_attribute(self, 'debug', 0, config, int)
     set_attribute(self, 'ip', '', config)
     default = '${mpx.properties.%s_PORT}' % self.server_type
     set_attribute(self, 'port', default, config, int)
     set_attribute(self, 'user_manager', as_node('/services/User Manager'),
                   config, as_node)
     set_attribute(self, 'authentication', 'form', config)
     if (self.authentication is not None
             and self.authentication not in ('digest', 'basic', 'form')):
         raise EInvalidValue('authentication', self.authentication,
                             'Authentication scheme not recognized.')
     set_attribute(self, 'port', default, config, int)
     set_attribute(self, 'maintenance_interval', 25, config, int)
     set_attribute(self, 'zombie_timeout', 600, config, int)
     set_attribute(self, 'thread_count', 3, config, int)
     if not self.has_child("Request Responder"):
         self._setup_request_responder()
     if not self.has_child("Authenticator"):
         self._setup_authentication_handler()
     if not self.has_child("PSP Handler"):
         self._setup_psp_handler()
     if not self.has_child("JSON-RPC Handler"):
         self._setup_json_handler()
     ServiceNode.configure(self, config)
Пример #13
0
 def start(self):
     if self.has_child('columns'):
         _positions = []
         columns = []
         for child in self.get_child('columns').children_nodes():
             if child.position in _positions:
                 raise EConfiguration(('One or more columns ' + 
                                       'have the same position'))
             _positions.append(child.position)
             column = ColumnConfiguration()
             column.configure(child.configuration())
             columns.append(column)
         _positions.sort()
         if _positions != range(0,len(_positions)):
             raise EConfiguration((
                 'Columns do not have consecutive positions this '
                 'can be caused by having two columns with the same name.'
                 ))
         self.log.configure(columns,self.minimum_size,self.maximum_size)
     else:
         self.log.set_limits(self.minimum_size,self.maximum_size)
     self.log.start_trimming() # Turn log trimming on now that sizes are set
     self.forwarder.start_forwarding(self.log)
     ServiceNode.start(self)
     return
Пример #14
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'heating', REQUIRED, config, as_node)
     set_attribute(self, 'cooling', REQUIRED, config, as_node)
     set_attribute(self, 'temperature', REQUIRED, config, as_node)
     set_attribute(self, 'minimum', REQUIRED, config, float)
     set_attribute(self, 'maximum', REQUIRED, config, float)
Пример #15
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'connection', '/services/network', config, as_node)
     set_attribute(self, 'timeout', 60, config, int)
     set_attribute(self, 'gm_time', 1, config, as_boolean)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Пример #16
0
 def configure(self,config):
     ServiceNode.configure(self,config)
     set_attribute(self,'connection','/services/network',config,as_node)
     set_attribute(self,'timeout',60,config,int)
     set_attribute(self, 'gm_time', 1, config, as_boolean)
     self.time_function = time.localtime
     if self.gm_time:
         self.time_function = time.gmtime
Пример #17
0
    def __init__(self):
        ServiceNode.__init__(self)
        self.debug = 0
        self._registered = ()
        self._did_save = 0
        self._post_configuration=0

        if self.debug: print 'Initialized _registered to [] for %s.' % self
Пример #18
0
 def start(self):
     if not Server._servers.has_key(self.port):
         Server._servers[self.port] = self
         self._setup_server()
     if Server._thread is None:
         Server._thread = _RedusaThread()
         Server._thread.start()
     ServiceNode.start(self)
Пример #19
0
 def __init__(self):
     ServiceNode.__init__(self)
     self._added_thread_count = 0
     self._file_request_handler = None
     self.psp_handler = None
     self.authenticator = None
     self.request_responder = None
     self.request_manager = _request.RequestSingleton().request_manager
Пример #20
0
 def start(self):
     if not Server._servers.has_key(self.port):
         Server._servers[self.port] = self
         self._setup_server()
     if Server._thread is None:
         Server._thread = _RedusaThread()
         Server._thread.start()
     ServiceNode.start(self)
Пример #21
0
 def __init__(self):
     ServiceNode.__init__(self)
     self._added_thread_count = 0
     self._file_request_handler = None
     self.psp_handler = None
     self.authenticator = None
     self.request_responder = None
     self.request_manager = _request.RequestSingleton().request_manager
Пример #22
0
 def __init__(self):
     self._lock = Lock()
     self._started = 0
     self._alarm = [] # can have a whole MESS o' alarms at startup...
     self._scheduled = None
     self.trigger_node_url_posn = None # allow source stamping
     self.trigger_node_msg_posn = None # allow source stamping
     self._waiting_alarm_sid = None
     ServiceNode.__init__(self)
Пример #23
0
 def __init__(self):
     ServiceNode.__init__(self)
     EventConsumerMixin.__init__(self, self.handle_alarm, \
                                 self.handle_exception)
     self.__running = 0
     self.__queue = Queue()
     self._id_manager = None
     self._dynamic_alarms = {}
     return
Пример #24
0
 def __init__(self):
     self._lock = Lock()
     self._started = 0
     self._alarm = []  # can have a whole MESS o' alarms at startup...
     self._scheduled = None
     self.trigger_node_url_posn = None  # allow source stamping
     self.trigger_node_msg_posn = None  # allow source stamping
     self._waiting_alarm_sid = None
     ServiceNode.__init__(self)
Пример #25
0
 def __init__(self):
     ServiceNode.__init__(self)
     EventConsumerMixin.__init__(self, self.handle_alarm, \
                                 self.handle_exception)
     self.__running = 0
     self.__queue = Queue()
     self._id_manager = None
     self._dynamic_alarms = {}
     return
Пример #26
0
 def stop(self):
     if not self._waiting_alarm_sid is None:
         try:
             scheduler.remove(self._waiting_alarm_sid)
         except: # SID may already have expired and been removed...
             msglog.exception()
         self._waiting_alarm_sid = None
     self._started = 0
     ServiceNode.stop(self)
     return
Пример #27
0
 def stop(self):
     if not self._waiting_alarm_sid is None:
         try:
             scheduler.remove(self._waiting_alarm_sid)
         except:  # SID may already have expired and been removed...
             msglog.exception()
         self._waiting_alarm_sid = None
     self._started = 0
     ServiceNode.stop(self)
     return
Пример #28
0
 def __init__(self):
     ServiceNode.__init__(self)
     self.transportClass = None # can't be set until we configure security
     self.was_enabled = 0
     self.enabled = 0
     self.start_count = 0
     self.stop_count = 0
     self.state = self.STOPPED
     self.debug = 0
     self.__rna_thread = None
     return
Пример #29
0
 def __init__(self):
     ServiceNode.__init__(self)
     self.transportClass = None  # can't be set until we configure security
     self.was_enabled = 0
     self.enabled = 0
     self.start_count = 0
     self.stop_count = 0
     self.state = self.STOPPED
     self.debug = 0
     self.__rna_thread = None
     return
Пример #30
0
 def start(self):
     if not self.__running:
         known_alarms = self.get_child('alarms')
         for child in known_alarms.children_nodes():
             child.event_subscribe(self, AlarmTriggerEvent)
             child.event_subscribe(self, AlarmClearEvent)
         self.__running = 1
         self.__thread = ImmortalThread(name=self.name, target=self.__run)
         self.__thread.start()
         ServiceNode.start(self)
     return
Пример #31
0
 def start(self):
     if not self.__running:
         known_alarms = self.get_child('alarms')
         for child in known_alarms.children_nodes():
             child.event_subscribe(self, AlarmTriggerEvent)
             child.event_subscribe(self, AlarmClearEvent)
         self.__running = 1
         self.__thread = ImmortalThread(name=self.name,target=self.__run)
         self.__thread.start()
         ServiceNode.start(self)
     return
Пример #32
0
    def start(self):
        from mpx.lib.persistent import PersistentDataObject
        
        ServiceNode.start(self)
        if self.debug: print 'Garbage Collector Starting!'

        self._data = PersistentDataObject(self,dmtype=GC_NEVER)
  
        self._data.registered = []
        self._data.load()
        
        if self.debug: print 'GC Data is %s.' % self._data
        if self.debug: print 'GC Data._reg is %s.' % self._data.registered
Пример #33
0
 def __init__(self):
     ##
     # Used to control access to the user control dictionaries.
     self.__lock = Lock()
     ##
     # There is only every one instance of a User cached in memory.
     self.__users = {"NoneUser": self._NoneUser()}
     ##
     # For every derived CacheableAuthenticator that has been used
     # to authenticate a User instance, there is one cached
     # authenticator instance.
     self.__pending = {DigestRFC2617Authenticator: []}
     ServiceNode.__init__(self)
     return
Пример #34
0
 def __init__(self):
     ##
     # Used to control access to the user control dictionaries.
     self.__lock = Lock()
     ##
     # There is only every one instance of a User cached in memory.
     self.__users = {'NoneUser': self._NoneUser()}
     ##
     # For every derived CacheableAuthenticator that has been used
     # to authenticate a User instance, there is one cached
     # authenticator instance.
     self.__pending = {DigestRFC2617Authenticator: []}
     ServiceNode.__init__(self)
     return
Пример #35
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'server_url', config)
     get_attribute(self, 'node', config)
     get_attribute(self, 'period', config, str)
     get_attribute(self, 'connection', config, as_node_url)
     get_attribute(self, 'timeout', config, str)
     return config
Пример #36
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'server_url', config)
     get_attribute(self, 'node', config)
     get_attribute(self, 'period', config, str)
     get_attribute(self,'connection',config,as_node_url)
     get_attribute(self,'timeout',config,str)
     return config
Пример #37
0
 def __init__(self):
     ServiceNode.__init__(self)
     self._tzklass = tzinfo.TZInfo
     year = {'name':'year','index':0}
     month = {'name':'month','index':1}
     day = {'name':'day','index':2}
     hour = {'name':'hour','index':3}
     minute  = {'name':'minute','index':4}
     second  = {'name':'second','index':5}
     weekday = {'name':'weekday','index':6}
     ta = [year,month,day,hour,minute,weekday,second]
     for x in ta:
         y = TimeAttribute(x['index'])
         y.configure({'name':x['name'],'parent':self})
     milliseconds = MilliSeconds()
     milliseconds.configure({'name':'milliseconds','parent':self})   
     return
Пример #38
0
 def __init__(self):
     ServiceNode.__init__(self)
     self._tzklass = tzinfo.TZInfo
     year = {'name': 'year', 'index': 0}
     month = {'name': 'month', 'index': 1}
     day = {'name': 'day', 'index': 2}
     hour = {'name': 'hour', 'index': 3}
     minute = {'name': 'minute', 'index': 4}
     second = {'name': 'second', 'index': 5}
     weekday = {'name': 'weekday', 'index': 6}
     ta = [year, month, day, hour, minute, weekday, second]
     for x in ta:
         y = TimeAttribute(x['index'])
         y.configure({'name': x['name'], 'parent': self})
     milliseconds = MilliSeconds()
     milliseconds.configure({'name': 'milliseconds', 'parent': self})
     return
Пример #39
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'heating', config, as_node_url)
     get_attribute(self, 'cooling', config, as_node_url)
     get_attribute(self, 'temperature', config, as_node_url)
     get_attribute(self, 'minimum', config, str)
     get_attribute(self, 'maximum', config, str)
     return config
Пример #40
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'heating', config, as_node_url)
     get_attribute(self, 'cooling', config, as_node_url)
     get_attribute(self, 'temperature', config, as_node_url)
     get_attribute(self, 'minimum', config, str)
     get_attribute(self, 'maximum', config, str)
     return config
Пример #41
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'security_level', 'NoSec', config)
     msglog.log('broadway', msglog.types.INFO,
                'RNA_Socket.configure: security_level = %s.' % self.security_level)
     self.transportClass = SimpleTcpService
     if (self.security_level == 'Auth-Only') \
         or (self.security_level == 'Full-Enc'):
         self.transportClass = SrnaService
     # Handle changes to the enabled attribute, once we've started.
     if self.enabled != self.was_enabled:
         if self.enabled:
             if self.start_count and self._start():
                 self.start_count += 1
                 self.was_enabled = self.enabled
         elif self.start_count > self.stop_count:
             self.stop_count += 1
             self._stop()
     return
Пример #42
0
 def configure(self, config):
     ServiceNode.configure(self, config)
     set_attribute(self, 'security_level', 'NoSec', config)
     msglog.log(
         'broadway', msglog.types.INFO,
         'RNA_Socket.configure: security_level = %s.' % self.security_level)
     self.transportClass = SimpleTcpService
     if (self.security_level == 'Auth-Only') \
         or (self.security_level == 'Full-Enc'):
         self.transportClass = SrnaService
     # Handle changes to the enabled attribute, once we've started.
     if self.enabled != self.was_enabled:
         if self.enabled:
             if self.start_count and self._start():
                 self.start_count += 1
                 self.was_enabled = self.enabled
         elif self.start_count > self.stop_count:
             self.stop_count += 1
             self._stop()
     return
Пример #43
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'ip', config)
     get_attribute(self, 'port', config, str)
     get_attribute(self, 'user_manager', config, as_node_url)
     get_attribute(self, 'authentication', config, str)
     get_attribute(self, 'debug', config, str)
     get_attribute(self, 'maintenance_interval', config, str)
     get_attribute(self, 'zombie_timeout', config, str)
     get_attribute(self, 'thread_count', config, str)
     return config
Пример #44
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'ip', config)
     get_attribute(self, 'port', config, str)
     get_attribute(self, 'user_manager', config, as_node_url)
     get_attribute(self, 'authentication', config, str)
     get_attribute(self, 'debug', config, str)
     get_attribute(self, 'maintenance_interval', config, str)
     get_attribute(self, 'zombie_timeout', config, str)
     get_attribute(self, 'thread_count', config, str)
     return config
Пример #45
0
 def start(self):
     for child in self.children_nodes():
         if isinstance(child, Formatter):
             if self.formatter is not None:
                 raise EConfiguration('Can only have one formatter')
             self.formatter = child
         elif isinstance(child, Transporter):
             if self.transporter is not None:
                 raise EConfiguration('Can only have one transporter')
             self.transporter = child
     if self.formatter is None or self.transporter is None:
         raise EConfiguration('Exporter one formatter '
                              'and one transporter child')
     return ServiceNode.start(self)
Пример #46
0
 def start(self):
     for child in self.children_nodes():
         if isinstance(child,Formatter):
             if self.formatter is not None:
                 raise EConfiguration('Can only have one formatter')
             self.formatter = child
         elif isinstance(child,Transporter):
             if self.transporter is not None:
                 raise EConfiguration('Can only have one transporter')
             self.transporter = child
     if self.formatter is None or self.transporter is None:
         raise EConfiguration('Exporter one formatter '
                              'and one transporter child')
     return ServiceNode.start(self)
Пример #47
0
 def stop(self):
     self.__running = 0
     self.__thread = None
     self.__queue.put(None)
     try:
         # @fixme try/except/else is a hack to survive testcases use
         #        of prune.  Really should revisit...
         alarms = self.get_child('alarms')
     except:
         pass
     else:
         for child in alarms.children_nodes():
             child.cancel(self, AlarmTriggerEvent)
             child.cancel(self, AlarmClearEvent)
     return ServiceNode.stop(self)
Пример #48
0
 def stop(self):
     self.__running = 0
     self.__thread = None
     self.__queue.put(None)
     try:
         # @fixme try/except/else is a hack to survive testcases use
         #        of prune.  Really should revisit...
         alarms = self.get_child('alarms')
     except:
         pass
     else:
         for child in alarms.children_nodes():
             child.cancel(self, AlarmTriggerEvent)
             child.cancel(self, AlarmClearEvent)
     return ServiceNode.stop(self)
Пример #49
0
 def start(self):
     self._lock.acquire()
     try:
         self.log = as_node(self.log)
         columns_node = self.log.get_child('columns')
         self.ts_position = columns_node.get_child('timestamp').position
         # Allow source stamping:
         if columns_node.has_child('trigger_node_url'):
             self.trigger_node_url_posn = columns_node.get_child('trigger_node_url').position
         if columns_node.has_child('trigger_node_msg'):
             self.trigger_node_msg_posn = columns_node.get_child('trigger_node_msg').position
         self._started = 1
     finally:
         self._lock.release()
     self.export_waiting_alarm()
     return ServiceNode.start(self)
Пример #50
0
 def start(self):
     self._lock.acquire()
     try:
         self.log = as_node(self.log)
         columns_node = self.log.get_child('columns')
         self.ts_position = columns_node.get_child('timestamp').position
         # Allow source stamping:
         if columns_node.has_child('trigger_node_url'):
             self.trigger_node_url_posn = columns_node.get_child(
                 'trigger_node_url').position
         if columns_node.has_child('trigger_node_msg'):
             self.trigger_node_msg_posn = columns_node.get_child(
                 'trigger_node_msg').position
         self._started = 1
     finally:
         self._lock.release()
     self.export_waiting_alarm()
     return ServiceNode.start(self)
Пример #51
0
 def stop(self):
     return ServiceNode.stop(self)
Пример #52
0
 def configuration(self):
     if self.debug: print 'In GarbageCollector:configuration().'
     config = ServiceNode.configuration(self)
     return config
Пример #53
0
 def __init__(self):
     ServiceNode.__init__(self)
     self.critical_data = self._CriticalData()
Пример #54
0
 def configure(self,config):
     ServiceNode.configure(self,config)