Given a topology definition, resolve and instantiate all components found and return a map
keyed by the component id.
427459
private static void buildComponents(ExecutionContext context) throws ClassNotFoundException, NoSuchMethodException,
            IllegalAccessException, InvocationTargetException, InstantiationException {
        Collection<BeanDef> cDefs = context.getTopologyDef().getComponents();
        if (cDefs != null) {
            for (BeanDef bean : cDefs) {
                Object obj = buildObject(bean, context);
                context.addComponent(bean.getId(), obj);
            }
        }
    }
624664
private <T extends AnnotatedElement> Map<T, PropertyInfo> resolveProperty(String keyPrefix, T element) {
        Map<T, PropertyInfo> result = new HashMap<>();
        if (!shouldDecorate(element)) {
            return result;
        }

        String key = getKey(keyPrefix, element);
        String defaultValue = getPropertyDefaultValue(element);
        String stringValue = compiled.getProperty(key, defaultValue);

        if (stringValue == null) {
            checkRequired(key, element);
            return result;
        }

        Object value = convertValue(element, stringValue);
        result.put(element, new PropertyInfo(key, stringValue, value));
        return result;
    }
187267
public static Map<String, Set<String>> buildSpoutOutoputAndBoltInputMap(DefaultTopologyAssignContext context) {
        Set<String> bolts = context.getRawTopology().get_bolts().keySet();
        Set<String> spouts = context.getRawTopology().get_spouts().keySet();
        Map<String, Set<String>> relationship = new HashMap<>();
        for (Entry<String, Bolt> entry : context.getRawTopology().get_bolts().entrySet()) {
            Map<GlobalStreamId, Grouping> inputs = entry.getValue().get_common().get_inputs();
            Set<String> input = new HashSet<>();
            relationship.put(entry.getKey(), input);
            for (Entry<GlobalStreamId, Grouping> inEntry : inputs.entrySet()) {
                String component = inEntry.getKey().get_componentId();
                input.add(component);
                if (!bolts.contains(component)) {
                    // spout
                    Set<String> spoutOutput = relationship.get(component);
                    if (spoutOutput == null) {
                        spoutOutput = new HashSet<>();
                        relationship.put(component, spoutOutput);
                    }
                    spoutOutput.add(entry.getKey());
                }
            }
        }
        for (String spout : spouts) {
            if (relationship.get(spout) == null)
                relationship.put(spout, new HashSet<String>());
        }
        for (String bolt : bolts) {
            if (relationship.get(bolt) == null)
                relationship.put(bolt, new HashSet<String>());
        }
        return relationship;
    }
889383
function buildResourceMap(resourceDefinitions, start) {
    var map = {};
    if(resourceDefinitions) {
      for(var i = 0, len = resourceDefinitions.length; i < len; i++) {
        addResourceToMap(map, resourceDefinitions[i], start);
      }
    }

    return map;
  }
997276
private Object resolveHostObject(Object value, Context cx, Scriptable scope) throws Exception {
		if (value instanceof List) { // list -> array
			return RHINO.fromList((List<?>) value, cx, scope);
		}
		if (value instanceof Map) { // map -> object
			return RHINO.fromMap((Map<?, ?>) value, cx, scope);
		}
		if (value instanceof String) {
			String string = (String) value;
			if (string.endsWith(jsSuffix)) { // .js source
				return MODS.create(string, null, scope, cx);
			}
			if (string.endsWith(jsonSuffix)) { // .json structure
				return JsonDeserializer.JSON_DESERIALIZER.deserialize((new URL(string).openStream()));
			}
		}
		return value;
	}
105826
protected Object resolveSimpleComponent(String exp, Map<String, ? extends Object> contextMap, LaContainer container,
            Class<?> resultType) {
        if (!LdiSrl.containsAny(exp, ".", ",", SQ, DQ, "@", "#")) { // main except, just in case
            if (container.hasComponentDef(exp)) {
                return container.getComponent(exp);
            }
        }
        return null;
    }
1182724
function addComponentMapping (componentName, mappings) {
  var schema = components[componentName].schema;
  Object.keys(schema).map(function (prop) {
    // Hyphenate where there is camelCase.
    var attrName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
    // If there is a mapping collision, prefix with component name and hyphen.
    if (mappings[attrName] !== undefined) { attrName = componentName + '-' + prop; }
    mappings[attrName] = componentName + '.' + prop;
  });
}
146803
private Multimap<String, Setting> loadComponentSettings(DbSession dbSession, Set<String> keys, ComponentDto component) {
    List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
    List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids);
    Set<Long> componentIds = componentDtos.stream().map(ComponentDto::getId).collect(Collectors.toSet());
    Map<Long, String> uuidsById = componentDtos.stream().collect(Collectors.toMap(ComponentDto::getId, ComponentDto::uuid));
    List<PropertyDto> properties = dbClient.propertiesDao().selectPropertiesByKeysAndComponentIds(dbSession, keys, componentIds);
    List<PropertyDto> propertySets = dbClient.propertiesDao().selectPropertiesByKeysAndComponentIds(dbSession, getPropertySetKeys(properties), componentIds);

    Multimap<String, Setting> settingsByUuid = TreeMultimap.create(Ordering.explicit(componentUuids), Ordering.arbitrary());
    for (PropertyDto propertyDto : properties) {
      Long componentId = propertyDto.getResourceId();
      String componentUuid = uuidsById.get(componentId);
      String propertyKey = propertyDto.getKey();
      settingsByUuid.put(componentUuid,
        Setting.createFromDto(propertyDto, getPropertySets(propertyKey, propertySets, componentId), propertyDefinitions.get(propertyKey)));
    }
    return settingsByUuid;
  }
406799
def _get_topology(self):
        
        self._topology.open()
        with self.__lock:
            self._kill_cursors_executor.open()
        return self._topology
1018052
def get_connected_components(graph):
    

    list_of_components = []
    component = []  # Not strictly necessary due to the while loop structure, but it helps the automated analysis tools

    # Store a list of all unreached vertices
    unreached = set(graph.get_all_node_ids())
    to_explore = deque()

    while len(unreached) > 0:
        # This happens when we reach the end of a connected component and still have more vertices to search through
        if len(to_explore) == 0:
            n = unreached.pop()
            unreached.add(n)
            to_explore.append(n)
            component = []
            list_of_components.append(component)

        # This is the BFS that searches for connected vertices
        while len(to_explore) > 0:
            n = to_explore.pop()
            if n in unreached:
                component.append(n)
                unreached.remove(n)
                nodes = graph.neighbors(n)
                for n in nodes:
                    if n in unreached:
                        to_explore.append(n)

    return list_of_components
827110
private HashSet<String> getComponents(Nimbus.Client client, String topology) throws Exception {
        HashSet<String> components = new HashSet<String>();
        ClusterSummary clusterSummary = client.getClusterInfo();
        TopologySummary topologySummary = null;
        for (TopologySummary ts : clusterSummary.get_topologies()) {
            if (topology.equals(ts.get_name())) {
                topologySummary = ts;
                break;
            }
        }
        if (topologySummary == null) {
            throw new IllegalArgumentException("topology: " + topology + " not found");
        } else {
            String id = topologySummary.get_id();
            // GetInfoOptions getInfoOpts = new GetInfoOptions();
            // getInfoOpts.set_num_err_choice(NumErrorsChoice.NONE);
            // TopologyInfo info = client.getTopologyInfoWithOpts(id, getInfoOpts);
            // for (ExecutorSummary es: info.get_executors()) {
            // components.add(es.get_component_id());
            // }
        }
        return components;
    }
929297
function mapNode(visitor) {
  const nodeMapper = node => {
    if (node == null) {
      return node;
    }

    const mappingFunction = (() => {
      if ('*' in visitor && typeof visitor['*'] === 'function') {
        return visitor['*'];
      }

      if (node.Type in visitor && typeof visitor[node.Type] === 'function') {
        return visitor[node.Type];
      }
      return identity;
    })();

    if (mappingFunction.length === 2) {
      return mappingFunction(node, nodeMapper);
    }

    const mappedNode = mappingFunction(node);
    const params = mappedNode.params.map(nodeMapper);

    return extend(mappedNode, { params });
  };

  return nodeMapper;
}
539945
function(name) {
    if (name) {
      // Find integration by name.
      var result = integrations[name];
      if (!result) {
        throw new Error('Integration does not exist: ' + name);
      }
      return result;
    } else {
      // Return entire singleton integration map.
      return integrations;
    }
  }
25565
def map(cls, obj, mode='data', backend=None):
        
        from .overlay import CompositeOverlay
        element_compositors = [c for c in cls.definitions if len(c._pattern_spec) == 1]
        overlay_compositors = [c for c in cls.definitions if len(c._pattern_spec) > 1]
        if overlay_compositors:
            obj = obj.map(lambda obj: cls.collapse_element(obj, mode=mode, backend=backend),
                          [CompositeOverlay])
        element_patterns = [c.pattern for c in element_compositors]
        if element_compositors and obj.traverse(lambda x: x, element_patterns):
            obj = obj.map(lambda obj: cls.collapse_element(obj, mode=mode, backend=backend),
                          element_patterns)
        return obj
1214949
function mapMapNode(node, parent, maps, id)
  {
    var local,
        attrs = __slice.call(node.attributes),
        nodeMaps = [],
        nodeId = uuid(),
        item,
        x = 0,
        len = attrs.length,
        text,
        title,
        mapText,
        i,
        lenn;
      
    for(x;x<len;x++)
    {
      text = attrs[x].value;
      title = attrs[x].name;
      if(title === '__kaleonodebind__')
      {
        mapText = splitText(text);
        item = mapText[0];

        /* create nodemap */
        local = new mapObject({
          local_id: id,
          node_id: nodeId,
          mapIndex: maps.length,
          mapTextIndex: 0,
          text: item,
          mapText: mapText,
          maps: maps,
          type: 'node',
          property: 'nodeName',
          listener: 'nodeName',
          isDirty: false,
          localAttr: 'nodeName',
          node: node,
          values: nodeMaps
        })
        maps.push(local);
        mapText[0] = maps[(maps.length - 1)];
      }
      else if(title === '__kaleoattrsbind__')
      {
        mapAttrName(node, text, nodeMaps, id, nodeId, true);
      }
      else if(title === '__kaleostylebind__')
      {
        mapStyleAttr(node, text, nodeMaps, id, nodeId, true);
      }
      else if(text.match(__matchText))
      {
        mapText = splitText(text);
        lenn = mapText.length;
        i = 0;
        for(i;i<lenn;i++)
        {
          item = mapText[i];
          if(item.match(__matchInsert))
          {
            nodeMaps.push(new mapObject({
              local_id: id,
              node_id: nodeId,
              mapIndex: maps.length,
              mapTextIndex: i,
              text: item,
              mapText: mapText,
              maps: nodeMaps,
              type: 'pointer',
              isInsert: true,
              property: title,
              local: attrs[x],
              localAttr: 'value',
              node: node,
              isAttr: true
            }));
          }
          else if(item.match(__matchText))
          {
            nodeMaps.push(new mapObject({
              local_id: id,
              node_id: nodeId,
              mapIndex: maps.length,
              mapTextIndex: i,
              text: item,
              mapText: mapText,
              maps: nodeMaps,
              type: 'pointer',
              property: title,
              listener: title,
              local: attrs[x],
              localAttr: 'value',
              node: node,
              isAttr: true,
              isPointer: true
            }));
          }
        }
      }
    }
  }
1165400
def resolve(self, key):
        
        try:
            return self._resolve_from_binding(key)
        except NotBoundError:
            return self._resolve_from_entry_point(key)
713759
function(components, input) {
    // Prebuild a list of existing components.
    var existingComponents = {};
    FormioUtils.eachComponent(components, function(component) {
      // If theres no key, we cant compare components.
      if (!component.key) return;

      // A component is pre-existing if the key is unique, or the key is a duplicate and its not flagged as the new component.
      if (
        (component.key !== input.key) ||
        ((component.key === input.key) && (!!component.isNew !== !!input.isNew))
      ) {
        existingComponents[component.key] = component;
      }
    }, true);

    return existingComponents;
  }