Examples of MorphlineCompilationException


Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      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

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

          } finally {
            Closeables.closeQuietly(in);
          }
        }       
      } catch (IOException e) {
        throw new MorphlineCompilationException("Cannot parse UserAgent database: " + databaseFile, config, e);
      }
     
      Meter numCacheHitsMeter = isMeasuringMetrics() ? getMeter(Metrics.NUM_CACHE_HITS) : null;
      Meter numCacheMissesMeter = isMeasuringMetrics() ? getMeter(Metrics.NUM_CACHE_MISSES) : null;
     
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      SolrLocator locator = new SolrLocator(solrLocatorConfig, context);
      LOG.debug("solrLocator: {}", locator);
      IndexSchema schema = locator.getIndexSchema();
      FieldType fieldType = schema.getFieldTypeByName(solrFieldType);
      if (fieldType == null) {
        throw new MorphlineCompilationException("Missing Solr field type in schema.xml for name: " + solrFieldType, config);
      }
      this.analyzer = fieldType.getAnalyzer();
      Preconditions.checkNotNull(analyzer);
      try { // register CharTermAttribute for later (implicit) reuse
        this.token = analyzer.tokenStream("content", reader).addAttribute(CharTermAttribute.class);
      } catch (IOException e) {
        throw new MorphlineCompilationException("Cannot create token stream", config, e);
      }
      Preconditions.checkNotNull(token);
      validateArguments();
    }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      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);
        }
        if (path.startsWith("/")) {
          path = path.substring(1);
        }
        if (path.endsWith("/")) {
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      String jsonFactoryClassName = getConfigs().getString(config, "jsonFactory", null);
      if (jsonFactoryClassName != null) {
        try {
          jsonFactory = (JsonFactory) Class.forName(jsonFactoryClassName).newInstance();
        } catch (Exception e) {
          throw new MorphlineCompilationException("Cannot create instance", config, e);
        }
      }
     
      String objectMapperClassName = getConfigs().getString(config, "objectMapper", null);
      ObjectMapper objectMapper = null;
      if (objectMapperClassName != null) {
        try {
          objectMapper = (ObjectMapper) Class.forName(objectMapperClassName).newInstance();
        } catch (Exception e) {
          throw new MorphlineCompilationException("Cannot create instance", config, e);
        }
      } else {
        objectMapper = new ObjectMapper(jsonFactory);
      }
     
      String outputClassName = getConfigs().getString(config, "outputClass", JsonNode.class.getName());
      Class outputClass;
      try {
        outputClass = Class.forName(outputClassName);
      } catch (ClassNotFoundException e) {
        throw new MorphlineCompilationException("Class not found", config, e);
      }
     
      reader = objectMapper.reader(outputClass);
      validateArguments();
    }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      InputStream in = null;
      try {
        in = getClass().getResourceAsStream("morphlineRecord.avsc");
        this.schema = new Schema.Parser().parse(in);
      } catch (IOException e) {
        throw new MorphlineCompilationException("Cannot parse morphlineRecord schema", config, e, builder);
      } finally {
        Closeables.closeQuietly(in);
      }
     
      validateArguments();
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

  @Override
  public Command build(Config config, Command parent, Command child, MorphlineContext context) {
    try {
      return new ConvertHTML(this, config, parent, child, context);
    } catch (SAXNotRecognizedException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    } catch (SAXNotSupportedException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    }
  }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

    if (expr.equals("*")) {
      expr = "glob:*";
    }
    int i = expr.indexOf(':');
    if (i < 0) {
      throw new MorphlineCompilationException("Illegal match expression: " + expr, config);
    }
    String type = expr.substring(0, i);
    String pattern = expr.substring(i + 1, expr.length());
    if (type.equals("literal")) {
      return new LiteralExpression(pattern);
    } else if (type.equals("regex")) {
      if (pattern.equals(".*")) {
        return new MatchAllExpression(); // optimization
      }
      return new RegexExpression(Pattern.compile(pattern));
    } else if (type.equals("glob")) {
      if (pattern.equals("*")) {
        return new MatchAllExpression(); // optimization
      }
      return new GlobExpression(pattern);
    } else {
      throw new MorphlineCompilationException("Illegal match type: " + type, config);
    }
  }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      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);
        }
        if (path.startsWith("/")) {
          path = path.substring(1);
        }
        if (path.endsWith("/")) {
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      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);
        }
        if (path.startsWith("/")) {
          path = path.substring(1);
        }
        if (path.endsWith("/")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.