Package elisa :: Package core :: Module service_manager
[hide private]
[frames] | no frames]

Source Code for Module elisa.core.service_manager

 1  # -*- coding: utf-8 -*- 
 2  # Elisa - Home multimedia server 
 3  # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 
 4  # All rights reserved. 
 5  # 
 6  # This file is available under one of two license agreements. 
 7  # 
 8  # This file is licensed under the GPL version 3. 
 9  # See "LICENSE.GPL" in the root of this distribution including a special 
10  # exception to use Elisa with Fluendo's plugins. 
11  # 
12  # The GPL part of Elisa is also available under a commercial licensing 
13  # agreement from Fluendo. 
14  # See "LICENSE.Elisa" in the root directory of this distribution package 
15  # for details on that license. 
16   
17   
18  __maintainer__ = 'Florian Boucault <florian@fluendo.com>' 
19   
20   
21  from elisa.core import manager 
22   
23 -class ServiceManager(manager.Manager):
24 """ 25 ServiceManager instanciates the ServiceProvider components and keeps track 26 of them. 27 """ 28
29 - def start(self):
30 """ Start all the registered ServiceProviders. 31 """ 32 self.info("Starting") 33 34 for i in self._components: 35 i.start()
36
37 - def stop(self):
38 """ Stop all the registered ServiceProviders. 39 """ 40 self.info("Stopping") 41 42 # FIXME: do not do that if ServiceManager was not started 43 for i in self._components: 44 i.stop() 45 46 manager.Manager.stop(self)
47
48 - def unregister_component(self, component):
49 """ Clean a ServiceProvider and unregister it from the ServiceManager. 50 51 @param component: the ServiceProvider instance to unregister 52 @type component: L{elisa.base_components.service_provider.ServiceProvider} 53 54 @raise CannotUnregister : raised when the component cannot be removed 55 """ 56 if manager.Manager.unregister_component(self, component): 57 component.clean()
58