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)
def __init__(self): self.ttl = 3600 self._lock = Lock() self._sessions = None self._scheduled = None self.user_manager = None ServiceNode.__init__(self)
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 })
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)
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)
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})
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)
def configuration(self): cd = ServiceNode.configuration(self) get_attribute(self, 'ttl', cd, str) return cd
def configure(self, cd): ServiceNode.configure(self, cd) set_attribute(self, 'ttl', self.ttl, cd, float) self.enabled = 1
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
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)
def configuration(self): config = ServiceNode.configuration(self) config['secured'] = self.secured return config
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)
def configure(self, cd): ServiceNode.configure(self, cd) self.name = 'nodetree_as_dict' return
def children_names(self, **options): children = ServiceNode.children_names(self, **options) children.sort(service_sort) return children