Пример #1
0
 def start(self):
     alias = self.alias
     class_name = self.class_name
     lifetime = self.lifetime
     # Register with our parent the named object
     self.parent.register_deployed_object(alias, class_name, lifetime)
     ServiceNode.start(self)
Пример #2
0
 def __init__(self):
     self.ttl = 3600
     self._lock = Lock()
     self._sessions = None
     self._scheduled = None
     self.user_manager = None
     ServiceNode.__init__(self)
Пример #3
0
 def __init__(self):
     self.ttl = 3600
     self._lock = Lock()
     self._sessions = None
     self._scheduled = None
     self.user_manager = None
     ServiceNode.__init__(self)
Пример #4
0
 def __init__(self):
     ServiceNode.__init__(self)
     # Instantiate implicit children.
     from mpx.service.interactive import InteractiveService
     InteractiveService().configure({
         'name': 'Interactive Service',
         'parent': self,
         'debug': 0,
         'port': 9666,
         'interface': 'localhost'
     })
     from mpx.service.time import Time
     Time().configure({'name': 'time', 'parent': self})
     from mpx.service.session import SessionManager
     SessionManager().configure({'name': 'session_manager', 'parent': self})
     from mpx.service.user_manager import UserManager
     UserManager().configure({'name': 'User Manager', 'parent': self})
     from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER
     SUBSCRIPTION_MANAGER.configure({
         'name': 'Subscription Manager',
         'parent': self
     })
     # Guarantee that /services/garbage_collector will exist, whether or not
     # there is an entry in the XML file.
     from mpx.service.garbage_collector import GARBAGE_COLLECTOR
     # @todo Make ReloadableSingleton!
     GARBAGE_COLLECTOR.configure({
         'name': 'garbage_collector',
         'parent': self
     })
Пример #5
0
 def start(self):
     alias = self.alias
     class_name = self.class_name
     lifetime = self.lifetime
     # Register with our parent the named object
     self.parent.register_deployed_object(alias, class_name, lifetime)
     ServiceNode.start(self)
Пример #6
0
 def stop(self):
     self._begin_critical_section()
     try:
         if self._scheduled:
             self._scheduled.cancel()
         self._scheduled = None
         self._sessions = None
     finally:
         self._end_critical_section()
     self.user_manager = None
     return ServiceNode.stop(self)
Пример #7
0
 def stop(self):
     self._begin_critical_section()
     try:
         if self._scheduled:
             self._scheduled.cancel()
         self._scheduled = None
         self._sessions = None
     finally:
         self._end_critical_section()
     self.user_manager = None
     return ServiceNode.stop(self)
Пример #8
0
 def start(self):
     self._begin_critical_section()
     try:
         if self._sessions is None:
             self._sessions = PersistentDictionary(self.name,
                                                   encode=Session.encode,
                                                   decode=Session.decode)
         if not self._scheduled:
             self._scheduled = scheduler.every(self.ttl, self.collect)
     finally:
         self._end_critical_section()
     self.user_manager = as_node("/services/User Manager")
     return ServiceNode.start(self)
Пример #9
0
 def __init__(self):
     ServiceNode.__init__(self)
     # Instantiate implicit children.
     from mpx.service.interactive import InteractiveService
     InteractiveService().configure({'name':'Interactive Service',
                                     'parent':self,'debug':0,
                                     'port':9666,'interface':'localhost'})
     from mpx.service.time import Time
     Time().configure({'name':'time','parent':self})
     from mpx.service.session import SessionManager
     SessionManager().configure({'name':'session_manager', 'parent':self})
     from mpx.service.user_manager import UserManager
     UserManager().configure({'name':'User Manager', 'parent':self})
     from mpx.service.subscription_manager import SUBSCRIPTION_MANAGER
     SUBSCRIPTION_MANAGER.configure({'name':'Subscription Manager',
                                     'parent':self})
     # Guarantee that /services/garbage_collector will exist, whether or not
     # there is an entry in the XML file.
     from mpx.service.garbage_collector import GARBAGE_COLLECTOR
     # @todo Make ReloadableSingleton!
     GARBAGE_COLLECTOR.configure({'name':'garbage_collector',
                                  'parent':self})
Пример #10
0
 def start(self):
     self._begin_critical_section()
     try:
         if self._sessions is None:
             self._sessions = PersistentDictionary(self.name, 
                                                   encode=Session.encode, 
                                                   decode=Session.decode)
         if not self._scheduled:
             self._scheduled = scheduler.every(self.ttl, self.collect)
     finally:
         self._end_critical_section()
     self.user_manager = as_node("/services/User Manager")
     return ServiceNode.start(self)
Пример #11
0
 def configure(self, config):
     set_attribute(self, 'alias', REQUIRED, config)
     set_attribute(self, 'class_name',REQUIRED, config)
     set_attribute(self, 'lifetime', 'Request',config)        
     ServiceNode.configure(self, config)
Пример #12
0
 def configuration(self):
     cd = ServiceNode.configuration(self)
     get_attribute(self, 'ttl', cd, str)
     return cd
Пример #13
0
 def configure(self, cd):
     ServiceNode.configure(self, cd)
     set_attribute(self, 'ttl', self.ttl, cd, float)
     self.enabled = 1
Пример #14
0
 def configure(self, cd):
     ServiceNode.configure(self, cd)
     set_attribute(self, 'ttl', self.ttl, cd, float)
     self.enabled = 1
Пример #15
0
 def configuration(self):
     cd = ServiceNode.configuration(self)
     get_attribute(self, 'ttl', cd, str)
     return cd
Пример #16
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     get_attribute(self, 'alias', config)
     get_attribute(self, 'class_name', config)
     get_attribute(self, 'lifetime', config)
     return config
Пример #17
0
 def configure(self, config):
     if not getattr(self, 'parent', None):
         config.setdefault('parent', '/')
     self.setattr('secured', as_boolean(config.get('secured', True)))
     ServiceNode.configure(self, config)
Пример #18
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     config['secured'] = self.secured
     return config
Пример #19
0
 def configure(self, config):
     set_attribute(self, 'alias', REQUIRED, config)
     set_attribute(self, 'class_name', REQUIRED, config)
     set_attribute(self, 'lifetime', 'Request', config)
     ServiceNode.configure(self, config)
Пример #20
0
 def configure(self, cd):
     ServiceNode.configure(self, cd)
     self.name = 'nodetree_as_dict'
     return
Пример #21
0
 def configuration(self):
     config = ServiceNode.configuration(self)        
     get_attribute(self, 'alias', config)
     get_attribute(self, 'class_name', config)
     get_attribute(self, 'lifetime', config)
     return config
Пример #22
0
 def children_names(self, **options):
     children = ServiceNode.children_names(self, **options)
     children.sort(service_sort)
     return children
Пример #23
0
 def configuration(self):
     config = ServiceNode.configuration(self)
     config['secured'] = self.secured
     return config
Пример #24
0
 def children_names(self, **options):
     children = ServiceNode.children_names(self, **options)
     children.sort(service_sort)
     return children
Пример #25
0
 def configure(self, config):
     if not getattr(self, 'parent', None):
         config.setdefault('parent', '/')
     self.setattr('secured', as_boolean(config.get('secured', True)))
     ServiceNode.configure(self, config)
Пример #26
0
 def configure(self, cd):
     ServiceNode.configure(self, cd)
     self.name = 'nodetree_as_dict'
     return