Parses the configuration to get the number of slots and validates the value.

@param configuration configuration object
@return the number of slots in task manager
970845
public static int getSlot(Configuration configuration) {
		int slots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
		// we need this because many configs have been written with a "-1" entry
		if (slots == -1) {
			slots = 1;
		}

		ConfigurationParserUtils.checkConfigParameter(slots >= 1, slots, TaskManagerOptions.NUM_TASK_SLOTS.key(),
			"Number of task slots must be at least one.");

		return slots;
	}
97048
public ConfigurationResult getConfiguration ()
        throws ServiceException
    {
        requireAdminUser();

        final ServletWaiter<ConfigurationResult> waiter =
            new ServletWaiter<ConfigurationResult>("getConfiguration");

        _omgr.postRunnable(new Runnable() {
            public void run () {
                Map<String, ConfigurationRecord> tabs = Maps.newHashMap();
                for (String key : _confReg.getKeys()) {
                    ConfigurationRecord record = buildRecord(key);
                    if (record == null) {
                        waiter.requestFailed(
                            new ServiceException(InvocationCodes.E_INTERNAL_ERROR));
                        return;
                    }
                    tabs.put(key, record);
                }

                ConfigurationResult result = new ConfigurationResult();
                result.records = tabs;
                waiter.requestCompleted(result);
            }
        });

        return waiter.waitForResult();
    }
39692
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) {
		List<String> keyValues = new ArrayList<String>();
		for (String key : configuration.keys()) {
			keyValues.add(key + "=\"" + configuration.getString(key) + "\"");
		}
		Collections.sort(keyValues);
		return keyValues;
	}
1165451
@Override
    public Configuration getConfiguration() {
        try {
            globalLock.readLock().lock();
            return configuration;
        } finally {
            globalLock.readLock().unlock();
        }
    }
574554
public java.util.List<java.util.Map<String, String>> getConfigurations() {
        return configurations;
    }
1243560
@Override
  public IAgentConfiguration parse(Configuration agentConfiguration) throws InternalException {
    if (agentConfiguration == null) {
      return null;
    }
    AgentConfigurationImpl conf = new AgentConfigurationImpl();
    try {

      conf.properties = new Properties();
      Configuration[] propConfs = agentConfiguration.getChildren(Properties.ordinal());
      for (Configuration c : propConfs) {

        conf.properties.put(c.getStringValue(PropertyName.ordinal(), ""), c.getStringValue(PropertyValue.ordinal(), ""));
      }
    }
    catch (Exception e) {
      throw new InternalException(e);
    }
    return conf;
  }
8663
private void parseConfiguration(String config) {

        CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
        m_comboBox = new CmsSelectComboBox(parser.getOptions(), false);
        if (parser.getDefaultValue() != null) {
            //set the declared value selected.
            m_comboBox.setFormValueAsString(parser.getDefaultValue());
        }
        fireChangeEvent();
    }
860032
private void validateConfiguration(CounterConfiguration configuration) {
      storage.validatePersistence(configuration);
      switch (configuration.type()) {
         case BOUNDED_STRONG:
            validateStrongCounterBounds(configuration.lowerBound(), configuration.initialValue(),
                  configuration.upperBound());
            break;
         case WEAK:
            if (configuration.concurrencyLevel() < 1) {
               throw log.invalidConcurrencyLevel(configuration.concurrencyLevel());
            }
            break;
      }
   }
162623
private void parseExternalsConfig(final Node node,
			final ConfigSettings config)
	{

		String name, value;
		Node nnode;
		NodeList list = node.getChildNodes();

		int length = list.getLength();
		for (int i = 0; i < length; i++) {
			nnode = list.item(i);

			name = nnode.getNodeName().toUpperCase();
			if (name.equals(KEY_SEVENZIP)) {

				value = nnode.getChildNodes().item(0).getNodeValue();
				value = value.substring(1, value.length() - 1);

				config.setConfigParameter(ConfigurationKeys.PATH_PROGRAM_7ZIP,
						value);

			}
		}
	}
1171540
public void getConfigurationInto(Entries configuration) {
    for (String prefix : prefixes) {
      configuration.setBoolean(prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX, isServiceAccountEnabled());
      if (getServiceAccountEmail() != null) {
        configuration.set(prefix + SERVICE_ACCOUNT_EMAIL_SUFFIX, getServiceAccountEmail());
      }
      if (getServiceAccountPrivateKeyId() != null) {
        configuration.set(
            prefix + SERVICE_ACCOUNT_PRIVATE_KEY_ID_SUFFIX, getServiceAccountPrivateKeyId());
      }
      if (getServiceAccountPrivateKey() != null) {
        configuration.set(
            prefix + SERVICE_ACCOUNT_PRIVATE_KEY_SUFFIX, getServiceAccountPrivateKey());
      }
      if (getServiceAccountKeyFile() != null) {
        configuration.set(prefix + SERVICE_ACCOUNT_KEYFILE_SUFFIX, getServiceAccountKeyFile());
      }
      if (getServiceAccountJsonKeyFile() != null) {
        configuration.set(prefix + JSON_KEYFILE_SUFFIX, getServiceAccountJsonKeyFile());
      }
      if (getClientId() != null) {
        configuration.set(prefix + CLIENT_ID_SUFFIX, getClientId());
      }
      if (getClientSecret() != null) {
        configuration.set(prefix + CLIENT_SECRET_SUFFIX, getClientSecret());
      }
      if (getOAuthCredentialFile() != null) {
        configuration.set(prefix + OAUTH_CLIENT_FILE_SUFFIX, getOAuthCredentialFile());
      }
      configuration.setBoolean(prefix + ENABLE_NULL_CREDENTIAL_SUFFIX, isNullCredentialEnabled());
    }

    // Transport configuration does not use prefixes
    if (getProxyAddress() != null) {
      configuration.set(PROXY_ADDRESS_KEY, getProxyAddress());
    }
    if (getProxyUsername() != null) {
      configuration.set(PROXY_USERNAME_KEY, getProxyUsername());
    }
    if (getProxyPassword() != null) {
      configuration.set(PROXY_PASSWORD_KEY, getProxyPassword());
    }
    configuration.set(HTTP_TRANSPORT_KEY, getTransportType().name());
  }
169803
public Map<String, List<? extends SipApplicationRouterInfo>> parse(String configuration) throws ParseException {
        Properties tempProperties = new Properties();
        // tempProperties.load(new StringReader(configuration)); // This needs Java 1.6
        ByteArrayInputStream stringStream = new ByteArrayInputStream(configuration.getBytes());
        try {
            tempProperties.load(stringStream);
        } catch (IOException e) {
            log.warn("Failed to update AR configuration. Will use the old properties.");
            return null;
        }
        this.properties = tempProperties;
        return parse();
    }
382876
@SuppressWarnings("deprecation")
	private static int calculateNumberOfNetworkBuffers(Configuration configuration, long maxJvmHeapMemory) {
		final int numberOfNetworkBuffers;
		if (!hasNewNetworkConfig(configuration)) {
			// fallback: number of network buffers
			numberOfNetworkBuffers = configuration.getInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS);

			checkOldNetworkConfig(numberOfNetworkBuffers);
		} else {
			if (configuration.contains(TaskManagerOptions.NETWORK_NUM_BUFFERS)) {
				LOG.info("Ignoring old (but still present) network buffer configuration via {}.",
					TaskManagerOptions.NETWORK_NUM_BUFFERS.key());
			}

			final long networkMemorySize = calculateNewNetworkBufferMemory(configuration, maxJvmHeapMemory);

			// tolerate offcuts between intended and allocated memory due to segmentation (will be available to the user-space memory)
			long numberOfNetworkBuffersLong = networkMemorySize / getPageSize(configuration);
			if (numberOfNetworkBuffersLong > Integer.MAX_VALUE) {
				throw new IllegalArgumentException("The given number of memory bytes (" + networkMemorySize
					+ ") corresponds to more than MAX_INT pages.");
			}
			numberOfNetworkBuffers = (int) numberOfNetworkBuffersLong;
		}

		return numberOfNetworkBuffers;
	}
337632
function (value) {
        if (value === null || value === undefined) {
            return this.slot.keys.length;
        } else {
            assertType(value, Number);

            if (value !== this.slot.keys.length) {
                if (value < this.slot.size) {
                    error(ERROR_ARGUMENT_OUT_OF_RANGE);
                }

                this.slot.keys.length = value;
                this.slot.values.length = value;
            }
        }
    }
23181
private void parseLoggingConfig(final Node node, final ConfigSettings config)
	{

		String name;
		String value;
		Node nnode;
		NodeList list = node.getChildNodes();

		int length = list.getLength();
		for (int i = 0; i < length; i++) {
			nnode = list.item(i);

			name = nnode.getNodeName().toUpperCase();
			if (name.equals(KEY_ROOT_FOLDER)) {

				value = nnode.getChildNodes().item(0).getNodeValue();
				value = value.substring(1, value.length() - 1);

				config.setConfigParameter(
						ConfigurationKeys.LOGGING_PATH_DIFFTOOL, value);

			}
			else if (name.equals(SUBSUBSECTION_DIFF_TOOL)) {

				parseLoggerConfig(nnode, config, null,
						ConfigurationKeys.LOGGING_LOGLEVEL_DIFFTOOL);

			}
		}
	}
1327374
public double pathLength (Configuration configuration) {
        double distance = 0.0;
        for (int i = 1; i < this.dimension; ++i) {
            distance += distances[configuration.valueAt(i - 1)][configuration.valueAt(i)];
        }
        distance += distances[configuration.valueAt(configuration.getDimension() - 1)][configuration.valueAt(0)];

        return distance;
    }
513536
public static Configuration getConfiguration() {
	    if(configuration == null){
            try {
                configuration = (Configuration) getContext().getBean("configuration");
            } catch (BeansException e) {
                LOGGER.error("Can't load config. Error: {}",e ,e);
            }
        }
	    return configuration;
	}
352076
def _sge_get_slots(xmlstring):
    
    rootxml = ET.fromstring(xmlstring)
    my_machine_dict = {}
    for queue_list in rootxml.iter("Queue-List"):
        # find all hosts supporting queues
        my_hostname = queue_list.find("name").text.rsplit("@")[-1]
        my_slots = queue_list.find("slots_total").text
        my_machine_dict[my_hostname] = {}
        my_machine_dict[my_hostname]["slots_total"] = int(my_slots)
    return my_machine_dict