Build broker objects using broker-ids.
552365
def _build_brokers(self, brokers):
        """"""
        for broker_id, metadata in six.iteritems(brokers):
            self.brokers[broker_id] = self._create_broker(broker_id, metadata)
1233256
public static Broker createBroker(int id, String brokerInfoString) {
        String[] brokerInfo = brokerInfoString.split(":");
        String creator = brokerInfo[0].replace('#', ':');
        String hostname = brokerInfo[1].replace('#', ':');
        String port = brokerInfo[2];
        boolean autocreated = Boolean.valueOf(brokerInfo.length > 3 ? brokerInfo[3] : "true");
        return new Broker(id, creator, hostname, Integer.parseInt(port), autocreated);
    }
53901
def addBrokerList(self, aBrokerInfoList):
        """"""
        self.cluster_available.update(set(aBrokerInfoList))

        # If we need another connection to a fellow broker
        # TODO: only connect to a given number
        for aBrokerInfo in aBrokerInfoList:
            self.cluster_socket.connect(
                "tcp://{hostname}:{port}".format(
                    hostname=aBrokerInfo.hostname,
                    port=aBrokerInfo.task_port,
                )
            )
            self.cluster.append(aBrokerInfo)
1268330
def _rebuild_key_ids(self):
        """"""
        self._key_ids = collections.defaultdict(list)
        for i, x in enumerate(self._pairs):
            self._key_ids[x[0]].append(i)
922374
def build(self, builder):
        """"""
        params = {}
        if self.study_oid:
            params.update(dict(StudyOID=self.study_oid))
        builder.start("AdminData", params)
        for user in self.users:
            user.build(builder)
        for location in self.locations:
            location.build(builder)

        builder.end("AdminData")
630234
def fill_initial_broks(self, broker_name):
        # pylint: disable=too-many-branches
        
        broker_uuid = None
        logger.debug("My brokers: %s", self.my_daemon.brokers)
        for broker_link in list(self.my_daemon.brokers.values()):
            logger.debug("Searching broker: %s", broker_link)
            if broker_name == broker_link.name:
                broker_uuid = broker_link.uuid
                logger.info("Filling initial broks for: %s (%s)", broker_name, broker_uuid)
                break
        else:
            if self.pushed_conf:
                # I am yet configured but I do not know this broker ! Something went wrong!!!
                logger.error("Requested initial broks for an unknown broker: %s", broker_name)
            else:
                logger.info("Requested initial broks for an unknown broker: %s", broker_name)
            return 0

        if self.my_daemon.brokers[broker_uuid].initialized:
            logger.warning("The broker %s still got its initial broks...", broker_name)
            return 0

        initial_broks_count = len(self.my_daemon.brokers[broker_uuid].broks)

        # First the program status
        brok = self.get_program_status_brok()
        self.add_brok(brok, broker_uuid)

        #  We can't call initial_status from all this types
        #  The order is important, service need host...
        initial_status_types = (self.timeperiods, self.commands,
                                self.contacts, self.contactgroups,
                                self.hosts, self.hostgroups,
                                self.services, self.servicegroups)

        self.pushed_conf.skip_initial_broks = getattr(self.pushed_conf, 'skip_initial_broks', False)
        logger.debug("Skipping initial broks? %s", str(self.pushed_conf.skip_initial_broks))
        if not self.pushed_conf.skip_initial_broks:
            #  We call initial_status from all this types
            #  The order is important, service need host...
            initial_status_types = (self.realms, self.timeperiods, self.commands,
                                    self.notificationways, self.contacts, self.contactgroups,
                                    self.hosts, self.hostgroups, self.hostdependencies,
                                    self.services, self.servicegroups, self.servicedependencies,
                                    self.escalations)

            for tab in initial_status_types:
                for item in tab:
                    # Awful! simply to get the group members property name... :(
                    # todo: replace this!
                    member_items = None
                    if hasattr(item, 'members'):
                        member_items = getattr(self, item.my_type.replace("group", "s"))
                    brok = item.get_initial_status_brok(member_items)
                    self.add_brok(brok, broker_uuid)

        # Add a brok to say that we finished all initial_pass
        brok = Brok({'type': 'initial_broks_done', 'data': {'instance_id': self.instance_id}})
        self.add_brok(brok, broker_uuid)

        final_broks_count = len(self.my_daemon.brokers[broker_uuid].broks)
        self.my_daemon.brokers[broker_uuid].initialized = True

        # Send the initial broks to our modules
        self.send_broks_to_modules()

        # We now have raised all the initial broks
        self.raised_initial_broks = True

        logger.info("Created %d initial broks for %s",
                    final_broks_count - initial_broks_count, broker_name)
        return final_broks_count - initial_broks_count
610378
def build(self, builder):
        """"""
        params = dict(CodedValue=self.coded_value)
        if self.order_number is not None:
            params["mdsol:OrderNumber"] = str(self.order_number)

        if self.specify:
            params["mdsol:Specify"] = "Yes"

        builder.start("CodeListItem", params)

        if self.decode is not None:
            self.decode.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("CodeListItem")
368457
def build_keys(request, database_name, collection_name):
    """"""
    build_keys_with_mapreduce(database_name, collection_name)
    messages.success(request, _(
        "Successfully completed MapReduce operation. "
        "Key rebuild for custom report complete."))
    return HttpResponseRedirect(reverse("djmongo_show_dbs"))
482131
def build(values):
		'''
		
		'''
		idxstore = IndexStore()
		idxstore._i2val = list(values)
		idxstore._val2i = {term:i for i,term in enumerate(values)}
		idxstore._next_i = len(values)
		return idxstore
300795
def build(self, builder):
        """"""
        params = dict(
            OID=self.oid, Name=self.name, Repeating=bool_to_yes_no(self.repeating)
        )

        if self.order_number is not None:
            params["mdsol:OrderNumber"] = str(self.order_number)

        if self.active is not None:
            params["mdsol:Active"] = bool_to_yes_no(self.active)

        params["mdsol:Template"] = bool_to_yes_no(self.template)
        params["mdsol:SignatureRequired"] = bool_to_yes_no(self.signature_required)
        params["mdsol:LogDirection"] = self.log_direction
        params["mdsol:DoubleDataEntry"] = self.double_data_entry
        params["mdsol:ConfirmationStyle"] = self.confirmation_style

        if self.link_study_event_oid:
            params["mdsol:LinkStudyEventOID"] = self.link_study_event_oid

        if self.link_form_oid:
            params["mdsol:LinkFormOID"] = self.link_form_oid

        builder.start("FormDef", params)
        for itemgroup_ref in self.itemgroup_refs:
            itemgroup_ref.build(builder)

        for helptext in self.helptexts:
            helptext.build(builder)

        for view_restriction in self.view_restrictions:
            view_restriction.build(builder)

        for entry_restriction in self.entry_restrictions:
            entry_restriction.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("FormDef")
418251
def identity_parts(id)
      @brokers.each do |b|
        return [b.host, b.port, b.index, priority(b.identity)] if b.identity == id || b.alias == id
      end
      [nil, nil, nil, nil]
    end
187660
def build(self, builder):
        """"""
        params = dict(OID=self.oid, Name=self.name, DataType=self.datatype.value)
        if self.sas_format_name is not None:
            params["SASFormatName"] = self.sas_format_name
        builder.start("CodeList", params)

        for item in self.codelist_items:
            item.build(builder)

        for alias in self.aliases:
            alias.build(builder)

        builder.end("CodeList")
1079934
def _build_named_object_ids(parameters):
    """"""
    if isinstance(parameters, str):
        return [_build_named_object_id(parameters)]
    return [_build_named_object_id(parameter) for parameter in parameters]
305312
def add_broker(self, broker):
        """"""
        if broker not in self._brokers:
            self._brokers.add(broker)
        else:
            self.log.warning(
                'Broker {broker_id} already present in '
                'replication-group {rg_id}'.format(
                    broker_id=broker.id,
                    rg_id=self._id,
                )
            )
340633
def construct (self, properties = [], targets = []):
        
        if not targets:
            for name, project in self.projects ().projects ():
                targets.append (project.target ())

        property_groups = build_request.expand_no_defaults (properties)

        virtual_targets = []
        build_prop_sets = []
        for p in property_groups:
            build_prop_sets.append (property_set.create (feature.split (p)))

        if not build_prop_sets:
            build_prop_sets = [property_set.empty ()]

        for build_properties in build_prop_sets:
            for target in targets:
                result = target.generate (build_properties)
                virtual_targets.extend (result.targets ())

        actual_targets = []
        for virtual_target in virtual_targets:
            actual_targets.extend (virtual_target.actualize ())
977900
def messages_for_brokers
      messages_for_broker_ids = {}
      @messages.each do |message|
        partition_id, broker_id = @message_conductor.destination(message.topic,
                                                                 message.key)

        # Create a nested hash to group messages by broker_id, topic, partition.
        messages_for_broker_ids[broker_id] ||= MessagesForBroker.new(broker_id)
        messages_for_broker_ids[broker_id].add(message, partition_id)
      end

      messages_for_broker_ids.values
    end
146723
def brokers(self):
        
        return set(self._brokers.values()) or set(self._bootstrap_brokers.values())