Retrieves the services registered by the given bundle. Returns None
        if the bundle didn't register any service.

        :param bundle: The bundle to look into
        :return: The references to the services registered by the bundle
540461
def get_bundle_registered_services(self, bundle):
        # type: (Any) -> List[ServiceReference]
        
        with self.__svc_lock:
            return sorted(self.__bundle_svc.get(bundle, []))
212509
def _loadServices(self):
        
        servicesPath = os.path.join(self.path, "service")
        if not os.path.isdir(servicesPath):
            return

        self._scanDirectoryForServices(servicesPath)
678694
def service_provider(*services):
    

    def real_decorator(clazz):
        instance = clazz()
        for service in services:
            global_lookup.add(service, instance)
        return clazz

    return real_decorator
1005852
def collect_from_bundles(self, bundles: List[Bundle]) -> Dict[str, Any]:
        
        all_objects = {}  # all discovered objects
        key_bundles = {}  # lookup of which bundle a key came from
        object_keys = set()  # keys in all_objects, used to ensure uniqueness
        for bundle in bundles:
            from_bundle = self.collect_from_bundle(bundle)
            if isinstance(bundle, AppBundle):
                all_objects.update(from_bundle)
                break  # app_bundle is last, no need to update keys

            from_bundle_keys = set(from_bundle.keys())
            conflicts = object_keys.intersection(from_bundle_keys)
            if conflicts:
                msg = [f'{self.name} from {bundle.name} conflict with '
                       f'previously registered {self.name}:']
                for key in conflicts:
                    msg.append(f'{key} from {key_bundles[key].name}')
                raise NameCollisionError('\n'.join(msg))

            all_objects.update(from_bundle)
            object_keys = object_keys.union(from_bundle_keys)
            key_bundles.update({k: bundle for k in from_bundle_keys})

        return all_objects
661492
public <T> T getService(URI bundleURI, Class<T> svcClazz) {
        return m_bundles.getService(bundleURI, svcClazz);
    }
862805
def get_bundle_versions():
    
    global _cached_versions
    if not bundles_settings.BUNDLES_VERSION_FILE:
        _cached_versions = {}
    if _cached_versions is None:
        locs = {}
        try:
            execfile(bundles_settings.BUNDLES_VERSION_FILE, locs)
            _cached_versions = locs['BUNDLES_VERSIONS']
        except IOError:
            _cached_versions = {}
    return _cached_versions
621366
def get_assigned_services_uids(self):
        
        services = self.get_assigned_services()
        uids = map(api.get_uid, services)
        return list(set(uids))
121772
def try_binding(self):
        
        with self._lock:
            if self.services:
                # We already are alive (not our first call)
                # => we are updated through service events
                return

            # Get all matching services
            refs = self._context.get_all_service_references(
                self.requirement.specification, self.requirement.filter
            )
            if not refs:
                # No match found
                return

            results = []
            try:
                # Bind all new reference
                for reference in refs:
                    added = self.on_service_arrival(reference)
                    if added:
                        results.append(reference)
            except BundleException as ex:
                # Get the logger for this instance
                logger = logging.getLogger(
                    "-".join((self._ipopo_instance.name, "RequiresMap-Runtime"))
                )
                logger.debug("Error binding multiple references: %s", ex)

                # Undo what has just been done, ignoring errors
                for reference in results:
                    try:
                        self.on_service_departure(reference)

                    except BundleException as ex2:
                        logger.debug("Error cleaning up: %s", ex2)

                del results[:]
                raise
1231519
@Override
    public ConfigurationAdmin getService(Bundle bundle, ServiceRegistration<ConfigurationAdmin> registration) {
        ServiceReference<ConfigurationAdmin> reference = registration.getReference();
        ced.setServiceReference(reference);
        return new ConfigurationAdminImpl(this, bundle);
    }
1123345
def get_url(self, version=None):
        
        if self.fixed_bundle_url:
            return self.fixed_bundle_url
        return '%s.%s.%s' % (os.path.join(self.bundle_url_root, self.bundle_filename), version or self.get_version(), self.bundle_type)
843446
def services(self):
        """"""
        ids = [ref['id'] for ref in self['services']]
        return [Service.fetch(id) for id in ids]
1171932
def hide_bundle_services(self, bundle):
        
        with self.__svc_lock:
            try:
                svc_refs = self.__bundle_svc.pop(bundle)
            except KeyError:
                # Nothing to do
                return set()
            else:
                # Clean the registry
                specs = set()
                for svc_ref in svc_refs:
                    if svc_ref.is_factory():
                        continue

                    # Remove direct references
                    self.__pending_services[svc_ref] = self.__svc_registry.pop(
                        svc_ref
                    )
                    specs.update(svc_ref.get_property(OBJECTCLASS))

                    # Clean the specifications cache
                    for spec in svc_ref.get_property(OBJECTCLASS):
                        spec_services = self.__svc_specs[spec]
                        # Use bisect to remove the reference (faster)
                        idx = bisect.bisect_left(spec_services, svc_ref)
                        del spec_services[idx]
                        if not spec_services:
                            del self.__svc_specs[spec]

            return svc_refs
907393
def services(self):
        
        if self._services is None:
            self._services = ServiceList(self)
        return self._services
1266420
def _load_bundle_factories(bundle):
    # type: (Bundle) -> List[Tuple[FactoryContext, type]]
    
    result = []

    # Get the Python module
    module_ = bundle.get_module()

    # Get the bundle context
    bundle_context = bundle.get_bundle_context()

    for name in dir(module_):
        try:
            # Get the module member
            factory_class = getattr(module_, name)
            if not inspect.isclass(factory_class):
                continue

            # Check if it is a class
            if sys.modules[factory_class.__module__] is not module_:
                # Only keep classes from this module
                continue
        except (AttributeError, KeyError):
            # getattr() didn't work or __module__ is not a member of the class,
            # or the module is not known by the interpreter
            continue

        context = _set_factory_context(factory_class, bundle_context)
        if context is None:
            # Error setting up the factory context
            continue

        result.append((context, factory_class))

    return result
596044
def get_bundle_by_id(self, bundle_id):
        # type: (int) -> Union[Bundle, Framework]
        
        if bundle_id == 0:
            # "System bundle"
            return self

        with self.__bundles_lock:
            if bundle_id not in self.__bundles:
                raise BundleException("Invalid bundle ID {0}".format(bundle_id))

            return self.__bundles[bundle_id]
1054645
def used_by(self, bundle):
        
        if bundle is None or bundle is self.__bundle:
            # Ignore
            return

        with self.__usage_lock:
            self.__using_bundles.setdefault(bundle, _UsageCounter()).inc()
424251
public static boolean hasHalDocs(Bundle bundle) {
    return bundle.getResource(ServiceModelReader.DOCS_CLASSPATH_PREFIX + "/" + ServiceModelReader.SERVICE_DOC_FILE) != null;
  }