Package org.kitesdk.morphline.base

Examples of org.kitesdk.morphline.base.Configs


    private final Set<Map.Entry<String, Object>> entrySet;
    private final String renderedConfig; // cached value
   
    public Contains(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);     
      this.entrySet = new Configs().getEntrySet(config);
      for (Map.Entry<String, Object> entry : entrySet) {
        if (!(entry.getValue() instanceof Collection)) {
          entry.setValue(new FieldExpression(entry.getValue().toString(), getConfig()));       
        }
      }
View Full Code Here


    boolean isLicensedSaxonEdition = getConfigs().getBoolean(config, "isLicensedSaxonEdition", false);
    this.processor = new Processor(isLicensedSaxonEdition);
    this.documentBuilder = processor.newDocumentBuilder();
   
    Config features = getConfigs().getConfig(config, "features", ConfigFactory.empty());
    for (Map.Entry<String, Object> entry : new Configs().getEntrySet(features)) {
      processor.setConfigurationProperty(entry.getKey(), entry.getValue());
    }
  }
View Full Code Here

          throw new MorphlineCompilationException("Must not define both query and queryFile at the same time", config);
        }
       
        XQueryEvaluator evaluator = executable.load();
        Config variables = getConfigs().getConfig(fragment, "externalVariables", ConfigFactory.empty());
        for (Map.Entry<String, Object> entry : new Configs().getEntrySet(variables)) {
          XdmValue xdmValue = XdmNode.wrap(new UntypedAtomicValue(entry.getValue().toString()));
          evaluator.setExternalVariable(new QName(entry.getKey()), xdmValue);
        }
        Config fileVariables = getConfigs().getConfig(fragment, "externalFileVariables", ConfigFactory.empty());
        for (Map.Entry<String, Object> entry : new Configs().getEntrySet(fileVariables)) {
          File file = new File(entry.getValue().toString());
          XdmValue doc = parseXmlDocument(file);
          evaluator.setExternalVariable(new QName(entry.getKey()), doc);
        }
        if (isTracing) {
View Full Code Here

          throw new MorphlineCompilationException("Must not define both query and queryFile at the same time", config);
        }
       
        XsltTransformer evaluator = executable.load();
        Config variables = getConfigs().getConfig(fragment, "parameters", ConfigFactory.empty());
        for (Map.Entry<String, Object> entry : new Configs().getEntrySet(variables)) {
          XdmValue xdmValue = XdmNode.wrap(new UntypedAtomicValue(entry.getValue().toString()));
          evaluator.setParameter(new QName(entry.getKey()), xdmValue);
        }
        Config fileVariables = getConfigs().getConfig(fragment, "fileParameters", ConfigFactory.empty());
        for (Map.Entry<String, Object> entry : new Configs().getEntrySet(fileVariables)) {
          File file = new File(entry.getValue().toString());
          XdmValue doc = parseXmlDocument(file);
          evaluator.setParameter(new QName(entry.getKey()), doc);
        }
        if (isTracing) {
View Full Code Here

      private final Class<Writable> writableClass;
      private final Configuration conf;

      public RCFileColumn(Config columnConfig, Configuration conf) {
        this.conf = conf;
        Configs configs = new Configs();
        this.inputField = configs.getInt(columnConfig, "inputField");
        if (inputField < 0) {
          throw new MorphlineCompilationException(
              "Invalid column inputField specified: " + inputField, columnConfig);
        }

        this.outputField = configs.getString(columnConfig, "outputField");
        String writableClassString = configs.getString(columnConfig, "writableClass");

        if (writableClassString == null || writableClassString.isEmpty()) {
          throw new MorphlineCompilationException(
              "No writableClass specified for column " + outputField, columnConfig);
        }
        try {
          Class clazz = Class.forName(writableClassString);
          if (!Writable.class.isAssignableFrom(clazz)) {
            throw new MorphlineCompilationException("writableClass provided "
                + writableClassString + " for column " + outputField
                + " does not implement " + Writable.class.getName(), columnConfig);
          }
          this.writableClass = clazz;
        } catch (ClassNotFoundException e) {
          throw new MorphlineCompilationException("Could not load class "
              + writableClassString + " definition", columnConfig, e);
        }
        configs.validateArguments(columnConfig);
      }
View Full Code Here

      SolrLocator locator = new SolrLocator(solrLocatorConfig, context);
      LOG.debug("solrLocator: {}", locator);
      this.loader = locator.getLoader();

      Config boostsConfig = getConfigs().getConfig(config, "boosts", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(boostsConfig)) {
        String fieldName = entry.getKey();       
        float boost = Float.parseFloat(entry.getValue().toString().trim());
        boosts.put(fieldName, boost);
      }
      this.isDryRun = context.getTypedSettings().getBoolean(TypedSettings.DRY_RUN_SETTING_NAME, false);
View Full Code Here

     
      Meter numCacheHitsMeter = isMeasuringMetrics() ? getMeter(Metrics.NUM_CACHE_HITS) : null;
      Meter numCacheMissesMeter = isMeasuringMetrics() ? getMeter(Metrics.NUM_CACHE_MISSES) : null;
     
      Config outputFields = getConfigs().getConfig(config, "outputFields", ConfigFactory.empty());
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(outputFields)) {
        mappings.add(
            new Mapping(
                entry.getKey(),
                entry.getValue().toString().trim(),
                parser,
View Full Code Here

    public ExtractJsonPaths(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);
      ListMultimap<String, String> stepMultiMap = ArrayListMultimap.create();
      this.flatten = getConfigs().getBoolean(config, "flatten", true);
      Config paths = getConfigs().getConfig(config, "paths");
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(paths)) {
        String fieldName = entry.getKey();       
        String path = entry.getValue().toString().trim();
        if (path.contains("//")) {
          throw new MorphlineCompilationException("No support for descendant axis available yet", config);
        }
View Full Code Here

      return new PatternMetricFilter(filterConfig);
    }
  }
 
  private PatternMetricFilter(Config config) {
    Configs configs = new Configs();
    Config includesConfig = configs.getConfig(config, "includes", null);
    if (includesConfig == null) {
      includes.add(new ExpressionPair(new MatchAllExpression(), new MatchAllExpression()));
    } else {
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(includesConfig)) {
        includes.add(parseExpressionPair(entry.getKey(), entry.getValue().toString(), includesConfig));
      }
    }
    Config excludesConfig = configs.getConfig(config, "excludes", null);
    if (excludesConfig != null) {
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(excludesConfig)) {
        excludes.add(parseExpressionPair(entry.getKey(), entry.getValue().toString(), excludesConfig));
      }
    }
    configs.validateArguments(config);
  }
View Full Code Here

    public ExtractAvroPaths(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
      super(builder, config, parent, child, context);
      ListMultimap<String, String> stepMultiMap = ArrayListMultimap.create();
      this.flatten = getConfigs().getBoolean(config, "flatten", true);
      Config paths = getConfigs().getConfig(config, "paths");
      for (Map.Entry<String, Object> entry : new Configs().getEntrySet(paths)) {
        String fieldName = entry.getKey();       
        String path = entry.getValue().toString().trim();
        if (path.contains("//")) {
          throw new MorphlineCompilationException("No support for descendant axis available yet", config);
        }
View Full Code Here

TOP

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

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.