def __init_references(self, references: IReferences): # Override in base classes existingInfo = references.get_one_optional( DefaultInfoFactory.ContextInfoDescriptor) if existingInfo is None: references.put(DefaultInfoFactory.ContextInfoDescriptor, self._info) else: self._info = existingInfo references.put( Descriptor("pip-services", "factory", "container", "default", "1.0"), self._factories)
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ context_info = references.get_one_optional(Descriptor("pip-services", "context-info", "*", "*", "1.0")) if context_info is not None and self._source is None: self._source = context_info.name
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ descriptor = Descriptor(None, "counters", None, None, None) counters = references.get_optional(descriptor) for counter in counters: if isinstance(counter, ICounters): self._counters.append(counter)
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ super(CompositeLogger, self).set_references(references) # descriptor = Descriptor(None, "logger", None, None, None) loggers = references.get_optional(Descriptor(None, "logger", None, None, None)) for logger in loggers: if isinstance(logger, ILogger): self.__loggers.append(logger)
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ traces = references.get_optional(Descriptor(None, "tracer", None, None, None)) for i in range(len(traces)): tracer = traces[i] if tracer != self: self._TRACERS.append(tracer)
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ self.__logger.set_references(references) self.__connection_resolver.set_references(references) context_info = references.get_one_optional( Descriptor("pip-services", "context-info", "default", "*", "1.0")) if context_info is not None and self.__source is None: self.__source = context_info.name if context_info is not None and self.__instance is None: self.__instance = context_info.context_id
def set_references(self, references: IReferences): """ Sets references to dependent components. :param references: references to locate the component dependencies. """ super().set_references(references) self.__cached_counters = self._dependency_resolver.get_one_required( 'prometheus-counters') if self.__cached_counters is None: self.__cached_counters = self._dependency_resolver.get_one_required( 'cached-counters') context_info = references.get_one_required( Descriptor("pip-services", "context-info", "default", "*", "1.0")) if context_info is not None and (self.__source == '' or self.__source is None): self.__source = context_info.name if context_info is not None and (self.__instance == '' or self.__instance is None): self.__instance = context_info.context_id
def set_references(self, references: IReferences): self.__persistence = references.get_one_required( Descriptor("beacons", "persistence", "*", "*", "1.0"))