Codota Logo
ConfigurationException.<init>
Code IndexAdd Codota to your IDE (free)

How to use
com.nextdoor.bender.config.ConfigurationException
constructor

Best Java code snippets using com.nextdoor.bender.config.ConfigurationException.<init> (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: Nextdoor/bender

public BenderSchema(File schemaFile) {
 ObjectMapper objectMapper = new ObjectMapper();
 objectMapper.registerSubtypes(BenderConfig.subtypes);
 try {
  this.schema = objectMapper.readTree(schemaFile);
 } catch (IOException e) {
  throw new ConfigurationException("unable to load schema file", e);
 }
}
origin: Nextdoor/bender

public BenderSchema(File schemaFile) {
 ObjectMapper objectMapper = new ObjectMapper();
 objectMapper.registerSubtypes(BenderConfig.subtypes);
 try {
  this.schema = objectMapper.readTree(schemaFile);
 } catch (IOException e) {
  throw new ConfigurationException("unable to load schema file", e);
 }
}
origin: Nextdoor/bender

public Subtypes() {
 long start = System.nanoTime();
 try {
  subtypes.addAll(ClassScanner.getSubtypes(abstractConfigClasses));
 } catch (InterruptedException | ExecutionException e) {
  throw new ConfigurationException("unable to find config classes", e);
 }
 logger.debug(
   "Generating config subtype list took " + ((System.nanoTime() - start) / 1000000) + "ms");
 /*
  * Sort the subtypes so that the order is deterministic. Without this locally generated
  * schemas differ in order from those generated by CircleCI.
  */
 subtypes.sort(new Comparator<Class>() {
  @Override
  public int compare(Class o1, Class o2) {
   return o1.getName().compareToIgnoreCase(o2.getName());
  }
 });
}
origin: Nextdoor/bender

public Subtypes() {
 long start = System.nanoTime();
 try {
  subtypes.addAll(ClassScanner.getSubtypes(abstractConfigClasses));
 } catch (InterruptedException | ExecutionException e) {
  throw new ConfigurationException("unable to find config classes", e);
 }
 logger.debug(
   "Generating config subtype list took " + ((System.nanoTime() - start) / 1000000) + "ms");
 /*
  * Sort the subtypes so that the order is deterministic. Without this locally generated
  * schemas differ in order from those generated by CircleCI.
  */
 subtypes.sort(new Comparator<Class>() {
  @Override
  public int compare(Class o1, Class o2) {
   return o1.getName().compareToIgnoreCase(o2.getName());
  }
 });
}
origin: Nextdoor/bender

public static BenderConfig load(String filename, String data, ObjectMapper mapper,
  boolean validate) {
 String swappedData = swapEnvironmentVariables(data);
 if (validate) {
  BenderConfig.validate(swappedData, mapper);
 }
 BenderConfig config = null;
 try {
  config = mapper.readValue(swappedData, BenderConfig.class);
 } catch (IOException e) {
  throw new ConfigurationException("invalid config file", e);
 }
 return config;
}
origin: Nextdoor/bender

public static BenderConfig load(String filename, String data, ObjectMapper mapper,
  boolean validate) {
 String swappedData = swapEnvironmentVariables(data);
 if (validate) {
  BenderConfig.validate(swappedData, mapper);
 }
 BenderConfig config = null;
 try {
  config = mapper.readValue(swappedData, BenderConfig.class);
 } catch (IOException e) {
  throw new ConfigurationException("invalid config file", e);
 }
 return config;
}
origin: Nextdoor/bender

 throw new ConfigurationException("unable to find " + resource);
 data = IOUtils.toString(new InputStreamReader(url.openStream(), "UTF-8"));
} catch (NullPointerException | IOException e) {
 throw new ConfigurationException("unable to read " + resource, e);
origin: Nextdoor/bender

 throw new ConfigurationException("unable to find " + resource);
 data = IOUtils.toString(new InputStreamReader(url.openStream(), "UTF-8"));
} catch (NullPointerException | IOException e) {
 throw new ConfigurationException("unable to read " + resource, e);
origin: Nextdoor/bender

public String getValue() {
 if (this.value == null) {
  return value;
 }
 /*
  * Ensure that the value is only decrypted once regardless of usage. This prevents KMS from
  * being called over and over from within the function to decrypt the same field.
  */
 if (!this.decrypted) {
  try {
   this.value = Passwords.decrypt(this.value, Region.getRegion(this.region));
  } catch (UnsupportedEncodingException e) {
   throw new ConfigurationException("Unable to decrypt", e);
  }
  this.decrypted = true;
 }
 return this.value;
}
origin: Nextdoor/bender

 return this.schema;
} catch (Exception e) {
 throw new ConfigurationException("unable generate schema");
origin: Nextdoor/bender

 return this.schema;
} catch (Exception e) {
 throw new ConfigurationException("unable generate schema");
origin: Nextdoor/bender

public String getValue() {
 if (this.value == null) {
  return value;
 }
 /*
  * Ensure that the value is only decrypted once regardless of usage. This prevents KMS from
  * being called over and over from within the function to decrypt the same field.
  */
 if (!this.decrypted) {
  try {
   this.value = Passwords.decrypt(this.value, Region.getRegion(this.region));
  } catch (UnsupportedEncodingException e) {
   throw new ConfigurationException("Unable to decrypt", e);
  }
  this.decrypted = true;
 }
 return this.value;
}
origin: Nextdoor/bender

public static BenderConfig load(AmazonS3ClientFactory s3ClientFactory, AmazonS3URI s3Uri) {
 AmazonS3Client s3 = s3ClientFactory.newInstance();
 S3Object s3object = s3.getObject(s3Uri.getBucket(), s3Uri.getKey());
 StringWriter writer = new StringWriter();
 try {
  IOUtils.copy(s3object.getObjectContent(), writer, "UTF-8");
 } catch (IOException e) {
  throw new ConfigurationException("Unable to read file from s3", e);
 }
 BenderConfig config = load(s3Uri.getKey().toString(), writer.toString());
 config.setConfigFile(s3Uri.getURI().toString());
 return config;
}
origin: Nextdoor/bender

public static BenderConfig load(AmazonS3ClientFactory s3ClientFactory, AmazonS3URI s3Uri) {
 AmazonS3Client s3 = s3ClientFactory.newInstance();
 S3Object s3object = s3.getObject(s3Uri.getBucket(), s3Uri.getKey());
 StringWriter writer = new StringWriter();
 try {
  IOUtils.copy(s3object.getObjectContent(), writer, "UTF-8");
 } catch (IOException e) {
  throw new ConfigurationException("Unable to read file from s3", e);
 }
 BenderConfig config = load(s3Uri.getKey().toString(), writer.toString());
 config.setConfigFile(s3Uri.getURI().toString());
 return config;
}
origin: Nextdoor/bender

/**
 * Parses an input String and replaces instances of {@literal <XXX>}" with the value of the XXX OS
 * Environment Variable. This is used as a pre-parser for the Config files, allowing environment
 * variables to be swapped at run-time.
 *
 * @param raw A raw string (not necessarily valid configuration data)
 * @return A parsed string with OS variables swapped in
 * @throws ConfigurationException If any discovered {@literal <WRAPPED_VALUES>} are not found in
 *         System.getenv().
 */
public static String swapEnvironmentVariables(String raw) throws ConfigurationException {
 ErrorBuffer errors = new ErrorBuffer();
 ST template = new ST(raw);
 STGroup g = template.groupThatCreatedThisInstance;
 g.setListener(errors);
 Map<String, String> env = System.getenv();
 for (String envName : env.keySet()) {
  if (envName.contains(".")) {
   logger.warn("skipping " + envName + " because it contains '.' which is not allowed");
   continue;
  }
  template.add(envName, env.get(envName));
 }
 String parsed = template.render();
 if (errors.errors.size() > 0) {
  throw new ConfigurationException(errors.toString());
 }
 return parsed;
}
origin: Nextdoor/bender

/**
 * Parses an input String and replaces instances of {@literal <XXX>}" with the value of the XXX OS
 * Environment Variable. This is used as a pre-parser for the Config files, allowing environment
 * variables to be swapped at run-time.
 *
 * @param raw A raw string (not necessarily valid configuration data)
 * @return A parsed string with OS variables swapped in
 * @throws ConfigurationException If any discovered {@literal <WRAPPED_VALUES>} are not found in
 *         System.getenv().
 */
public static String swapEnvironmentVariables(String raw) throws ConfigurationException {
 ErrorBuffer errors = new ErrorBuffer();
 ST template = new ST(raw);
 STGroup g = template.groupThatCreatedThisInstance;
 g.setListener(errors);
 Map<String, String> env = System.getenv();
 for (String envName : env.keySet()) {
  if (envName.contains(".")) {
   logger.warn("skipping " + envName + " because it contains '.' which is not allowed");
   continue;
  }
  template.add(envName, env.get(envName));
 }
 String parsed = template.render();
 if (errors.errors.size() > 0) {
  throw new ConfigurationException(errors.toString());
 }
 return parsed;
}
origin: Nextdoor/bender

public static boolean validate(String data, ObjectMapper objectMapper, BenderSchema benderSchema)
  throws ConfigurationException {
 ProcessingReport report;
 try {
  /*
   * Create object
   */
  JsonNode node = objectMapper.readTree(data);
  /*
   * Create JSON schema
   */
  JsonNode jsonSchema = benderSchema.getSchema();
  /*
   * Validate
   */
  final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
  final JsonSchema schema = factory.getJsonSchema(jsonSchema);
  report = schema.validate(node);
 } catch (IOException | ProcessingException ioe) {
  throw new ConfigurationException("unable to validate config", ioe);
 }
 if (report.isSuccess()) {
  return true;
 } else {
  throw new ConfigurationException("invalid config file",
    report.iterator().next().asException());
 }
}
origin: Nextdoor/bender

public static boolean validate(String data, ObjectMapper objectMapper, BenderSchema benderSchema)
  throws ConfigurationException {
 ProcessingReport report;
 try {
  /*
   * Create object
   */
  JsonNode node = objectMapper.readTree(data);
  /*
   * Create JSON schema
   */
  JsonNode jsonSchema = benderSchema.getSchema();
  /*
   * Validate
   */
  final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
  final JsonSchema schema = factory.getJsonSchema(jsonSchema);
  report = schema.validate(node);
 } catch (IOException | ProcessingException ioe) {
  throw new ConfigurationException("unable to validate config", ioe);
 }
 if (report.isSuccess()) {
  return true;
 } else {
  throw new ConfigurationException("invalid config file",
    report.iterator().next().asException());
 }
}
origin: Nextdoor/bender

 @Override
 public void setConf(AbstractConfig config) {
  this.config = (GeoIpOperationConfig) config;
  AmazonS3Client client = this.s3Factory.newInstance();

  AmazonS3URI uri = new AmazonS3URI(this.config.getGeoLiteDb());
  GetObjectRequest req = new GetObjectRequest(uri.getBucket(), uri.getKey());
  S3Object obj = client.getObject(req);

  try {
   this.databaseReader =
     new DatabaseReader.Builder(obj.getObjectContent()).withCache(new CHMCache()).build();
  } catch (IOException e) {
   throw new ConfigurationException("Unable to read " + this.config.getGeoLiteDb(), e);
  }
 }
}
origin: Nextdoor/bender

 @Override
 public void setConf(AbstractConfig config) {
  this.config = (GeoIpOperationConfig) config;
  AmazonS3Client client = this.s3Factory.newInstance();

  AmazonS3URI uri = new AmazonS3URI(this.config.getGeoLiteDb());
  GetObjectRequest req = new GetObjectRequest(uri.getBucket(), uri.getKey());
  S3Object obj = client.getObject(req);

  try {
   this.databaseReader =
     new DatabaseReader.Builder(obj.getObjectContent()).withCache(new CHMCache()).build();
  } catch (IOException e) {
   throw new ConfigurationException("Unable to read " + this.config.getGeoLiteDb(), e);
  }
 }
}
com.nextdoor.bender.configConfigurationException<init>

Popular methods of ConfigurationException

  • printStackTrace

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JTextField (javax.swing)
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