/usr/lib/python2.7/dist-packages/framework/subsystems/opimd/domain_manager.py is in fso-frameworkd 0.10.1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | # -*- coding: utf-8 -*-
#
# Openmoko PIM Daemon
# Domain Plugin Manager
#
# http://openmoko.org/
# http://pyneo.org/
#
# Copyright (C) 2008 by Soeren Apel (abraxa@dar-clan.de)
# Copyright (C) 2008-2009 by Openmoko, Inc.
# Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
"""opimd Domain Plugin Manager"""
MODULE_NAME = "opimd"
from dbus.service import FallbackObject as DBusFBObject
import logging
logger = logging.getLogger( MODULE_NAME )
# We use a meta class to automaticaly register all the domain subclasses
#----------------------------------------------------------------------------#
class DomainMetaClass(type(DBusFBObject)):
#----------------------------------------------------------------------------#
def __init__(cls, name, bases, dict):
super(DomainMetaClass, cls).__init__(name, bases, dict)
if DBusFBObject in bases:
return
Domain._all_domains_cls.append(cls)
#----------------------------------------------------------------------------#
class Domain(DBusFBObject):
#----------------------------------------------------------------------------#
"""Base class for all domains"""
__metaclass__ = DomainMetaClass
_all_domains_cls = []
#----------------------------------------------------------------------------#
class DomainManager(object):
#----------------------------------------------------------------------------#
_domains = {} # List containing the domain objects
#----------------------------------------------------------------------------#
@classmethod
def init(cls):
for domain_cls in Domain._all_domains_cls:
cls.register(domain_cls)
@classmethod
def register(cls, domain_cls):
cls._domains[domain_cls.name] = domain_cls()
logger.info("Registered domain %s", domain_cls.name)
@classmethod
def get_domain_handler(cls, domain):
return cls._domains[domain] if (domain in cls._domains) else None
@classmethod
def get_domains(cls):
return cls._domains.keys()
@classmethod
def enumerate_dbus_objects(cls):
for handler in cls._domains.values():
for obj in handler.get_dbus_objects():
yield obj
|