Codota Logo
com.hotels.styx.api.configuration
Code IndexAdd Codota to your IDE (free)

How to use com.hotels.styx.api.configuration

Best Java code snippets using com.hotels.styx.api.configuration (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: HotelsDotCom/styx

/**
 * Returns the value to which the specified key is mapped, converted to String
 * or {@code Optional.absent} if this configuration source contains no mapping for the key.
 *
 * @param key the key whose associated value is to be returned
 * @return the value to which the specified key is mapped, or
 * {@code Optional.absent} if this map contains no mapping for the key
 */
default Optional<String> get(String key) {
  return get(key, String.class);
}
origin: com.hotels.styx/styx-api

  /**
   * Create an instance of the product.
   *
   * @param environment                 environment
   * @param serviceConfiguration configuration specific to the factory product
   * @param objects objects that service might depend on
   * @return product instance
   */
  default E create(Environment environment, Configuration serviceConfiguration, ActiveOrigins objects) {
    return create(environment, serviceConfiguration);
  }
}
origin: HotelsDotCom/styx

@Override
public <X> X as(Class<X> type) {
  return configuration.as(type);
}
origin: HotelsDotCom/styx

@Override
public Registry<BackendService> create(Environment environment, Configuration registryConfiguration) {
  String originsFile = registryConfiguration.get("originsFile", String.class)
      .map(Factory::requireNonEmpty)
      .orElseThrow(() -> new ConfigurationException(
          "missing [services.registry.factory.config.originsFile] config value for factory class FileBackedBackendServicesRegistry.Factory"));
  FileMonitorSettings monitorSettings = registryConfiguration.get("monitor", FileMonitorSettings.class)
      .orElseGet(FileMonitorSettings::new);
  return registry(originsFile, monitorSettings);
}
origin: HotelsDotCom/styx

  private String factoryClassName(String strategyName) {
    String key = format("loadBalancing.strategies.%s.factory.class", strategyName);

    return configurations.get(key).orElseThrow(() -> new MissingConfigurationException(key));
  }
}
origin: com.hotels.styx/styx-api

@Override
protected Path convert(java.lang.String value) {
  Path location = Paths.get(removeFilePrefix(value));
  if (!isReadable(location)) {
    throw new ConfigurationException(format("%s=%s is not a readable configuration path.", name(), location));
  }
  return location;
}
origin: com.hotels.styx/styx-api

/**
 * Return the value associated with the setting.
 *
 * @param setting a setting
 * @param <T>     setting value type
 * @return the value associated with the setting
 * @throws com.hotels.styx.api.configuration.NoSystemPropertyDefined if there is no associated value
 */
public static <T> T valueOf(Setting<T> setting) {
  return setting.value().orElseThrow(() -> new NoSystemPropertyDefined(setting.name()));
}
origin: HotelsDotCom/styx

  private static String requireNonEmpty(String originsFile) {
    if (originsFile.isEmpty()) {
      throw new ConfigurationException("empty [services.registry.factory.config.originsFile] config value for factory class FileBackedBackendServicesRegistry.Factory");
    } else {
      return originsFile;
    }
  }
}
origin: HotelsDotCom/styx

private static StyxConfig styxConfig(Builder builder) {
  return new StyxConfig(new MapBackedConfiguration()
      .set("proxy", proxyServerConfig(builder))
      .set("admin", adminServerConfig(builder)));
}
origin: com.hotels.styx/styx-api

default <X> X as(Class<X> type) throws ConversionException {
  throw new ConversionException("Cannot convert self to " + type);
}
origin: com.hotels.styx/styx-api

/**
 * Return the value associated with the setting, or default value if no value is associated.
 *
 * @param setting      a setting
 * @param defaultValue default value
 * @param <T>          setting value type
 * @return the value associated with the setting
 */
public static <T> T valueOf(Setting<T> setting, T defaultValue) {
  return setting.value().orElse(defaultValue);
}
origin: HotelsDotCom/styx

  @Override
  public Eventual<LiveHttpResponse> intercept(LiveHttpRequest request, Chain chain) {
    Configuration.Context context = configurationContextResolver.resolve(request);
    chain.context().add("config.context", context);
    return chain.proceed(request);
  }
}
origin: com.hotels.styx/styx-api

/**
 * Returns the value to which the specified key is mapped, converted to String
 * or {@code Optional.absent} if this configuration source contains no mapping for the key.
 *
 * @param key the key whose associated value is to be returned
 * @return the value to which the specified key is mapped, or
 * {@code Optional.absent} if this map contains no mapping for the key
 */
default Optional<String> get(String key) {
  return get(key, String.class);
}
origin: HotelsDotCom/styx

  @Override
  public Registry<BackendService> create(Environment environment, Configuration registryConfiguration) {
    BackendService service = registryConfiguration.get("backendService", BackendService.class)
        .orElseThrow(() -> new ConfigurationException(
            "missing [services.registry.factory.config.backendService] config value for factory class TestBackendProvider.Factory"));
    return new TestBackendProvider(service);
  }
}
origin: HotelsDotCom/styx

  /**
   * Create an instance of the product.
   *
   * @param environment                 environment
   * @param serviceConfiguration configuration specific to the factory product
   * @param objects objects that service might depend on
   * @return product instance
   */
  default E create(Environment environment, Configuration serviceConfiguration, ActiveOrigins objects) {
    return create(environment, serviceConfiguration);
  }
}
origin: HotelsDotCom/styx

default <X> X as(Class<X> type) throws ConversionException {
  throw new ConversionException("Cannot convert self to " + type);
}
origin: HotelsDotCom/styx

@Override
public <T> Optional<T> get(String key, Class<T> tClass) {
  return configuration.get(key, tClass);
}
origin: HotelsDotCom/styx

private Optional<PluginsMetadata> readPluginsConfig() {
  return configuration.get("plugins", PluginsMetadata.class);
}
origin: HotelsDotCom/styx

@Override
public LoadBalancerFactory get() {
  return configurations.get(LOAD_BALANCING_STRATEGY_KEY)
      .map(this::newFactoryInstance)
      .orElseGet(this::busyConnectionBalancer);
}
origin: com.hotels.styx/styx-client

  @Override
  public RetryPolicy create(Environment environment, Configuration retryPolicyConfiguration) {
    int retriesCount = retryPolicyConfiguration.get("count", Integer.class)
        .orElse(1);
    return new RetryNTimes(retriesCount);
  }
}
com.hotels.styx.api.configuration

Most used classes

  • Configuration
    Static configuration.
  • ConfigurationException
    This exception is thrown when there is a configuration problem.
  • ServiceFactory
    A generic factory that can be implemented in order to facilitate creating objects whose type is not
  • SimpleConverter
    Converter of object to Boolean, Double, Integer, String, enum or array types.
  • Configuration$MapBackedConfiguration
    Allows a configuration object to be programmatically created. Primarily intended for testing.
  • ConversionException,
  • MissingConfigurationException,
  • NoSystemPropertyDefined,
  • Setting,
  • SystemSettings$Location,
  • SimpleConverterTest$ConfigurationValue
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now