Beispiel #1
0
    def load_services(self, services=None):
        """
        Load services from resources.

        Services are registered as utilities in zope.component.
        Service should provide an interface gaphor.interfaces.IService.
        """

        self.logger.info("Loading services")

        for ep in pkg_resources.iter_entry_points("gaphor.services"):
            cls = ep.load()
            if not IService.implementedBy(cls):
                raise "MisConfigurationException", "Entry point %s doesn" "t provide IService" % ep.name
            if services is None or ep.name in services:
                srv = cls()
                self._uninitialized_services[ep.name] = srv
Beispiel #2
0
    def load_services(self, services=None):
        """
        Load services from resources.

        Services are registered as utilities in zope.component.
        Service should provide an interface gaphor.interfaces.IService.
        """
        
        self.logger.info('Loading services')
        
        for ep in pkg_resources.iter_entry_points('gaphor.services'):
            cls = ep.load()
            if not IService.implementedBy(cls):
                raise NameError('Entry point %s doesn''t provide IService' % ep.name)
            if services is None or ep.name in services:
                srv = cls()
                self._uninitialized_services[ep.name] = srv
Beispiel #3
0
    def load_services(self, services=None):
        """
        Load services from resources.

        Services are registered as utilities in zope.component.
        Service should provide an interface gaphor.interfaces.IService.
        """
        # Ensure essential services are always loaded.
        if services:
            for name in self.essential_services:
                if name not in services:
                    services.append(name)

        for ep in pkg_resources.iter_entry_points('gaphor.services'):
            cls = ep.load()
            if not IService.implementedBy(cls):
                raise NameError('Entry point %s doesn''t provide IService' % ep.name)
            if not services or ep.name in services:
                logger.debug('found service entry point "%s"' % ep.name)
                srv = cls()
                self._uninitialized_services[ep.name] = srv
Beispiel #4
0
    def load_services(self, services=None):
        """
        Load services from resources.

        Services are registered as utilities in zope.component.
        Service should provide an interface gaphor.interfaces.IService.
        """
        # Ensure essential services are always loaded.
        if services:
            for name in self.essential_services:
               if name not in services:
                    services.append(name)

        for ep in pkg_resources.iter_entry_points('gaphor.services'):
            cls = ep.load()
            if not IService.implementedBy(cls):
                raise NameError, 'Entry point %s doesn''t provide IService' % ep.name
            if not services or ep.name in services:
                logger.debug('found service entry point "%s"' % ep.name)
                srv = cls()
                self._uninitialized_services[ep.name] = srv