Package org.kitesdk.morphline.base

Examples of org.kitesdk.morphline.base.Compiler


        .setMetricRegistry(SharedMetricRegistries.getOrCreate(morphlineFileAndId))
        .build();
    }
   
    Config override = ConfigFactory.parseMap(context.getSubProperties(MORPHLINE_VARIABLE_PARAM + "."));
    morphline = new Compiler().compile(new File(morphlineFile), morphlineId, morphlineContext, finalChild, override);     
   
    this.mappingTimer = morphlineContext.getMetricRegistry().timer(
        MetricRegistry.name("morphline.app", Metrics.ELAPSED_TIME));
    this.numRecords = morphlineContext.getMetricRegistry().meter(
        MetricRegistry.name("morphline.app", Metrics.NUM_RECORDS));
View Full Code Here


            if (entry.getKey().startsWith(variablePrefix)) {
                morphlineVariables.put(entry.getKey().substring(variablePrefix.length()), entry.getValue());
            }
        }
        Config override = ConfigFactory.parseMap(morphlineVariables);
        this.morphline = new Compiler().compile(new File(morphlineFile), morphlineId, morphlineContext, collector,
                override);
       
        for (Map.Entry<String,String> entry : params.entrySet()) {
            String fieldPrefix = MorphlineResultToSolrMapper.MORPHLINE_FIELD_PARAM + ".";
            if (entry.getKey().startsWith(fieldPrefix)) {
View Full Code Here

  public static void main(String[] args) throws IOException {
    // compile morphline.conf file on the fly
    File morphlineFile = new File(args[0]);
    String morphlineId = null;
    MorphlineContext morphlineContext = new MorphlineContext.Builder().build();
    Command morphline = new Compiler().compile(morphlineFile, morphlineId, morphlineContext, null);
   
    // process each input data file
    Notifications.notifyBeginTransaction(morphline);
    try {
      for (int i = 1; i < args.length; i++) {
View Full Code Here

  }
 
  @Test
  public void testCompile() throws Exception {
    String file = "test-morphlines/pipeWithTwoBasicCommands";
    morphline = new Compiler().compile(
        new File(RESOURCES_DIR + "/" + file + ".conf"),
        "",
        new MorphlineContext.Builder().build(),
        null);
    assertNotNull(morphline);
View Full Code Here

  }
 
  @Test
  public void testCompileWithExplicitMorphlineId() throws Exception {
    String file = "test-morphlines/pipeWithTwoBasicCommands";
    morphline = new Compiler().compile(
        new File(RESOURCES_DIR + "/" + file + ".conf"),
        "morphline1",
        new MorphlineContext.Builder().build(),
        null);
    assertNotNull(morphline);
View Full Code Here

 
  @Test
  public void testCompileWithUnknownMorphlineId() throws Exception {
    String file = "test-morphlines/pipeWithTwoBasicCommands";
    try {
      new Compiler().compile(
        new File(RESOURCES_DIR + "/" + file + ".conf"),
        "morphline2",
        new MorphlineContext.Builder().build(),
        null);
      fail();
View Full Code Here

 
  @Test
  public void testCompileWithMissingMorphline() throws Exception {
    String file = "test-morphlines/compileWithMissingMorphline";
    try {
      new Compiler().compile(
          new File(RESOURCES_DIR + "/" + file + ".conf"),
          "morphline1",
          new MorphlineContext.Builder().build(),
          null);
      fail();
View Full Code Here

    expected.put(Fields.MESSAGE, msg);
    Assert.assertEquals(expected, collector.getFirstRecord());
  }

  private Command createMorphline(String file) {
    return new Compiler().compile(
        new File(RESOURCES_DIR + "/" + file + ".conf"),
        null,
        createMorphlineContext(),
        collector);
  }
View Full Code Here

        ConfigFactory.parseMap(
            ImmutableMap.of("inputFile", inputFile.toString(), "outputDir", cwd.toString())));   
  }
 
  private Command createMorphline(String file, Config... overrides) {
    return new Compiler().compile(
        new File(RESOURCES_DIR + "/" + file + ".conf"),
        null,
        createMorphlineContext(),
        null,
        overrides);
View Full Code Here

    morphContext = new MorphlineContext.Builder().setMetricRegistry(new MetricRegistry()).build();
    return new PipeBuilder().build(config, null, collector, morphContext);
  }
 
  protected Config parse(String file, Config... overrides) throws IOException {
    Config config = new Compiler().parse(new File(RESOURCES_DIR + "/" + file + ".conf"), overrides);
    config = config.getConfigList("morphlines").get(0);
    Preconditions.checkNotNull(config);
    return config;
  }
View Full Code Here

TOP

Related Classes of org.kitesdk.morphline.base.Compiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.