Construct a list of MapConfigs for a Topology
@return the list of MapConfigs
@throws Exception
190786
public List<MapConfig> getMapConfigsForTopology(SamzaTopology topology) throws Exception {
		List<MapConfig> configs = new ArrayList<MapConfig>();
		List<Map<String,String>> maps = this.getMapsForTopology(topology);
		for(Map<String,String> map:maps) {
			configs.add(new MapConfig(map));
		}
		return configs;
	}
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;
    }
887930
public Config buildConfig(EcoTopologyDefinition topologyDefinition)
      throws IllegalArgumentException {

    Map<String, Object> configMap = topologyDefinition.getConfig();
    Config config = new Config();
    for (Map.Entry<String, Object> entry: configMap.entrySet()) {

      if (entry.getKey().equals(COMPONENT_RESOURCE_MAP)) {

        setComponentLevelResource(config, entry);

      } else if (entry.getKey().equals(COMPONENT_JVM_OPTIONS)) {

        List<Object> objects = (List<Object>) entry.getValue();
        for (Object obj : objects) {
          String objString = obj.toString();
          objString = objString.replace(LEFT_BRACE, WHITESPACE);
          objString = objString.replace(RIGHT_BRACE, WHITESPACE);

          int idIndex = objString.indexOf(ID);
          int optionsIndex = objString.indexOf(OPTIONS);

          String id = getIdValue(objString, idIndex);

          String jvmOptions;
          if (optionsIndex != -1) {

            int equalsIndex = objString.indexOf(EQUALS, optionsIndex);
            jvmOptions = objString.substring(equalsIndex + 1, objString.length());

            jvmOptions = jvmOptions.replace(LEFT_BRACKET, "")
                .replace(RIGHT_BRACKET, "");

          } else {
            throw new IllegalArgumentException(
                "You must specify the JVM options for your component");
          }

          config.setComponentJvmOptions(id, jvmOptions);
        }

      } else {
        config.put(entry.getKey(), entry.getValue());
      }

    }
    return config;
  }
1150373
@Override
	public Map<String, String> toMap() {
		synchronized (this.confData){
			Map<String, String> ret = new HashMap<>(this.confData.size());
			for (Map.Entry<String, Object> entry : confData.entrySet()) {
				ret.put(entry.getKey(), entry.getValue().toString());
			}
			return ret;
		}
	}
1257008
public java.util.List<DhcpConfiguration> getDhcpConfigurations() {
        if (dhcpConfigurations == null) {
            dhcpConfigurations = new com.amazonaws.internal.SdkInternalList<DhcpConfiguration>();
        }
        return dhcpConfigurations;
    }
572723
public java.util.List<ConfigurationSet> getConfigurationSets() {
        if (configurationSets == null) {
            configurationSets = new com.amazonaws.internal.SdkInternalList<ConfigurationSet>();
        }
        return configurationSets;
    }
1158071
public java.util.List<ConfigurationSettingsDescription> getConfigurationSettings() {
        if (configurationSettings == null) {
            configurationSettings = new com.amazonaws.internal.SdkInternalList<ConfigurationSettingsDescription>();
        }
        return configurationSettings;
    }
1069038
public static Map<String, TraceEvent> tocManagedConnections(List<TraceEvent> data) throws Exception
   {
      Map<String, TraceEvent> result = new TreeMap<String, TraceEvent>();

      for (TraceEvent te : data)
      {
         if (te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_GET ||
             te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_PREFILL ||
             te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_INCREMENTER)
         {
            result.put(te.getPayload1(), te);
         }
      }

      return result;
   }
588722
@Override
   public Map<String, String> getConfigProperties()
   {
      return configProperties == null ? null : Collections.unmodifiableMap(configProperties);
   }
546280
@Override
    public Map<String, Object> getTuningConfig() {
        return ImmutableMap.<String, Object>of(
                "type", "hadoop",
                "partitionsSpec", partitionsSpec.getDataMap());
    }
1178538
private synchronized void loadTopologyConfiguration()
            throws ConfigurationException
    {
        logger.debug("Loading topology configuration from {}",
                topologyConfigFilename);

        final TypeDescription topologyConfigTypeDescription = new TypeDescription(
                TopologyConfig.class);
        topologyConfigTypeDescription.putListPropertyType("topology",
                Datacenter.class);

        final TypeDescription topologyTypeDescription = new TypeDescription(
                Datacenter.class);
        topologyTypeDescription.putListPropertyType("racks", Rack.class);

        final TypeDescription rackTypeDescription = new TypeDescription(
                Rack.class);
        rackTypeDescription.putListPropertyType("nodes", Node.class);

        final Constructor configConstructor = new Constructor(
                TopologyConfig.class);
        configConstructor.addTypeDescription(topologyConfigTypeDescription);
        configConstructor.addTypeDescription(topologyTypeDescription);
        configConstructor.addTypeDescription(rackTypeDescription);

        final InputStream configFileInputStream = getClass().getClassLoader()
                .getResourceAsStream(topologyConfigFilename);
        if (configFileInputStream == null)
        {
            throw new ConfigurationException(
                    "Could not read topology config file "
                            + topologyConfigFilename);
        }
        Yaml yaml;
        TopologyConfig topologyConfig;
        try
        {
            yaml = new Yaml(configConstructor);
            topologyConfig = (TopologyConfig) yaml.load(configFileInputStream);
        }
        finally
        {
            FileUtils.closeQuietly(configFileInputStream);
        }
        final Map<InetAddress, NodeData> nodeDataMap = new HashMap<InetAddress, NodeData>();

        if (topologyConfig.topology == null)
        {
            throw new ConfigurationException(
                    "Topology configuration file is missing the topology section");
        }

        for (final Datacenter datacenter : topologyConfig.topology)
        {
            if (datacenter.dc_name == null)
            {
                throw new ConfigurationException(
                        "Topology configuration file is missing a data center name for some data center");
            }

            for (final Rack rack : datacenter.racks)
            {
                if (rack.rack_name == null)
                {
                    throw new ConfigurationException(
                            String.format(
                                    "Topology configuration file is missing a rack name for some rack under data center '%s'",
                                    datacenter.dc_name));
                }

                for (final Node node : rack.nodes)
                {
                    if (node.broadcast_address == null)
                    {
                        throw new ConfigurationException(
                                String.format(
                                        "Topology configuration file is missing a broadcast address for some node under data center '%s' rack '%s'",
                                        datacenter.dc_name, rack.rack_name));
                    }

                    final InetAddress endpoint = InetAddresses
                            .forString(node.broadcast_address);
                    final InetAddress dcLocalAddress = node.dc_local_address == null ? null
                            : InetAddresses.forString(node.dc_local_address);

                    final NodeData nodeData = new NodeData();
                    nodeData.datacenter = datacenter.dc_name;
                    nodeData.rack = rack.rack_name;
                    nodeData.dcLocalAddress = dcLocalAddress;

                    if (nodeDataMap.put(endpoint, nodeData) != null)
                    {
                        throw new ConfigurationException(
                                String.format(
                                        "IP address '%s' appears more than once in the topology configuration file",
                                        endpoint));
                    }

                    if (dcLocalAddress != null
                            && nodeDataMap.put(dcLocalAddress, nodeData) != null)
                    {
                        throw new ConfigurationException(
                                String.format(
                                        "IP address '%s' appears more than once in the topology configuration file",
                                        dcLocalAddress));
                    }
                }
            }
        }

        final NodeData localNodeData = nodeDataMap.get(FBUtilities
                .getBroadcastAddress());
        if (localNodeData == null)
        {
            throw new ConfigurationException(
                    "Topology configuration missing information for the local node");
        }

        final NodeData defaultNodeData = new NodeData();

        if (topologyConfig.default_dc_name == null)
        {
            throw new ConfigurationException(
                    "default_dc_name must be specified");
        }
        if (topologyConfig.default_rack_name == null)
        {
            throw new ConfigurationException(
                    "default_rack_name must be specified");
        }

        defaultNodeData.datacenter = topologyConfig.default_dc_name;
        defaultNodeData.rack = topologyConfig.default_rack_name;

        // YAML configuration looks good; now make the changes

        this.nodeDataMap = nodeDataMap;
        this.localNodeData = localNodeData;
        this.defaultNodeData = defaultNodeData;
        maybeSetApplicationState();

        if (logger.isDebugEnabled())
        {
            logger.debug(
                    "Built topology map from config file: localNodeData={}, nodeDataMap={}",
                    localNodeData, nodeDataMap);
        }

        if (gossiperInitialized)
        {
            StorageService.instance.gossipSnitchInfo();
        }
    }
731937
public Map<String, List<ExecutorDetails>> getNeedsSchedulingComponentToExecutors(TopologyDetails topology) {
        Map<ExecutorDetails, String> executorToComponents = this.getNeedsSchedulingExecutorToComponents(topology);
        Map<String, List<ExecutorDetails>> componentToExecutors = new HashMap<>();
        for (ExecutorDetails executor : executorToComponents.keySet()) {
            String component = executorToComponents.get(executor);
            if (!componentToExecutors.containsKey(component)) {
                componentToExecutors.put(component, new ArrayList<ExecutorDetails>());
            }

            componentToExecutors.get(component).add(executor);
        }

        return componentToExecutors;
    }
314043
public static Map<String, Double> getComponentCpuMapConfig(TopologyAPI.Topology topology)
      throws RuntimeException {
    Map<String, String> configMap =
        getComponentConfigMap(topology, Config.TOPOLOGY_COMPONENT_CPUMAP);
    Map<String, Double> cpuMap = new HashMap<>();

    for (Map.Entry<String, String> entry : configMap.entrySet()) {
      Double requiredCpu = Double.parseDouble(entry.getValue());
      cpuMap.put(entry.getKey(), requiredCpu);
    }
    return cpuMap;
  }
370190
public List<InetAddress> nodes() {
        List<InetAddress> allNodes = new ArrayList<InetAddress>();
        BucketConfig config = bucketConfig.get();
        for (NodeInfo nodeInfo : config.nodes()) {
            try {
                allNodes.add(InetAddress.getByName(nodeInfo.hostname().address()));
            } catch (UnknownHostException e) {
                throw new IllegalStateException(e);
            }
        }
        return allNodes;
    }
1085222
public List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> getAllMapEntry()
   {
      List<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>> list = new ArrayList<FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>>();
      List<Node> nodeList = childNode.get("map-entry");
      for(Node node: nodeList)
      {
         FacesConfigMapEntryType<FacesConfigMapEntriesType<T>>  type = new FacesConfigMapEntryTypeImpl<FacesConfigMapEntriesType<T>>(this, "map-entry", childNode, node);
         list.add(type);
      }
      return list;
   }
478413
public static Map<String, DataSourceConfiguration> getDataSourceConfigurationMap(final Map<String, DataSource> dataSourceMap) {
        Map<String, DataSourceConfiguration> result = new LinkedHashMap<>(dataSourceMap.size(), 1);
        for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
            result.put(entry.getKey(), DataSourceConfiguration.getDataSourceConfiguration(entry.getValue()));
        }
        return result;
    }
257194
Collection<MappingImpl> build(PropertyMap<S, D> propertyMap) {
    try {
      PROPERTY_MAP_CONFIGURE.invoke(propertyMap, this);
      saveLastMapping();
    } catch (IllegalAccessException e) {
      errors.errorAccessingConfigure(e);
    } catch (InvocationTargetException e) {
      Throwable cause = e.getCause();
      if (cause instanceof ConfigurationException)
        throw (ConfigurationException) cause;
      else
        errors.addMessage(cause, "Failed to configure mappings");
    } catch (NullPointerException e) {
      if (proxyErrors.hasErrors()) {
        throw proxyErrors.toException();
      }
      throw e;
    }

    errors.throwConfigurationExceptionIfErrorsExist();
    return propertyMappings;
  }