protected Config parse(String file, Config... overrides) throws IOException {
   File tmpFile = File.createTempFile("morphlines_", ".conf");
   IOUtils.copy(getClass().getResourceAsStream(file), new FileOutputStream(tmpFile));
   Config config = new Compiler().parse(tmpFile, overrides);
   config = config.getConfigList("morphlines").get(0);
   Preconditions.checkNotNull(config);
   return config;
 }
Example #2
0
  /** @return the piece of config (if any), associated with a given relationship. */
  @SuppressWarnings("unchecked")
  public Config getConfig() {
    Config conf = ConfigFactory.load();
    List<Config> rels = (List<Config>) conf.getConfigList("relationships");
    for (Config rel : rels) {
      String name = rel.getString("relationship");
      // System.out.println(this.getClass().getName());
      if (name.equalsIgnoreCase(this.getClass().getName())) {
        return rel.getConfig("config");
      }
    }

    return null;
  }
 public static void main(String[] args) throws Exception {
   Queue queue = new Queue();
   HostRouteHttpServer server =
       new HostRouteHttpServer(
           new HttpServerConfigurator(queue)
               .withAddress(
                   new Address(
                       CONFIG.getString("http.route.bind.host"),
                       CONFIG.getInt("http.route.bind.port"))),
           new HttpClientConfigurator(queue).withTrust(new Trust()));
   for (Config c : CONFIG.getConfigList("http.route.map")) {
     server.route(
         c.getStringList("hosts"),
         new Address(c.getString("to.host"), c.getInt("to.port")),
         c.getString("to.path"));
   }
   server.start();
 }