Java Code Examples for org.kurento.jsonrpc.JsonUtils#toStringList()

The following examples show how to use org.kurento.jsonrpc.JsonUtils#toStringList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KurentoRoomServerApp.java    From kurento-room with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public KurentoClientProvider kmsManager() {

  JsonArray kmsUris = getPropertyJson(KMSS_URIS_PROPERTY, KMSS_URIS_DEFAULT, JsonArray.class);
  List<String> kmsWsUris = JsonUtils.toStringList(kmsUris);

  if (kmsWsUris.isEmpty()) {
    throw new IllegalArgumentException(KMSS_URIS_PROPERTY
        + " should contain at least one kms url");
  }

  String firstKmsWsUri = kmsWsUris.get(0);

  if (firstKmsWsUri.equals("autodiscovery")) {
    log.info("Using autodiscovery rules to locate KMS on every pipeline");
    return new AutodiscoveryKurentoClientProvider();
  } else {
    log.info("Configuring Kurento Room Server to use first of the following kmss: " + kmsWsUris);
    return new FixedOneKmsManager(firstKmsWsUri);
  }
}
 
Example 2
Source File: OpenviduConfig.java    From openvidu with Apache License 2.0 5 votes vote down vote up
protected List<String> asJsonStringsArray(String property) {
	try {
		Gson gson = new Gson();
		JsonArray jsonArray = gson.fromJson(getValue(property), JsonArray.class);
		List<String> list = JsonUtils.toStringList(jsonArray);
		if (list.size() == 1 && list.get(0).isEmpty()) {
			list = new ArrayList<>();
		}
		return list;
	} catch (JsonSyntaxException e) {
		addError(property, "Is not a valid strings array in JSON format. " + e.getMessage());
		return Arrays.asList();
	}
}
 
Example 3
Source File: KurentoRoomDemoApp.java    From kurento-room with Apache License 2.0 5 votes vote down vote up
@Override
public KmsManager kmsManager() {
  JsonArray kmsUris = getPropertyJson(KurentoRoomServerApp.KMSS_URIS_PROPERTY,
      KurentoRoomServerApp.KMSS_URIS_DEFAULT, JsonArray.class);
  List<String> kmsWsUris = JsonUtils.toStringList(kmsUris);

  log.info("Configuring Kurento Room Server to use the following kmss: {}", kmsWsUris);

  FixedNKmsManager fixedKmsManager = new FixedNKmsManager(kmsWsUris, DEMO_KMS_NODE_LIMIT);
  fixedKmsManager.setAuthRegex(DEMO_AUTH_REGEX);
  log.debug("Authorization regex for new rooms: {}", DEMO_AUTH_REGEX);
  return fixedKmsManager;
}