Examples of MorphlineCompilationException


Examples of org.kitesdk.morphline.api.MorphlineCompilationException

  @Override
  public Command build(Config config, Command parent, Command child, MorphlineContext context) {
    try {
      return new Java(this, config, parent, child, context);
    } catch (ScriptException e) {
      throw new MorphlineCompilationException("Cannot compile script", config, e);
    }
  }
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 XQuery(this, config, parent, child, context);
    } catch (SaxonApiException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    } catch (IOException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    } catch (XMLStreamException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    }
  }
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 DownloadHdfsFile(this, config, parent, child, context);
    } catch (IOException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    }
  }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      this.inputFieldName = getConfigs().getString(config, "inputField");
     
      this.outputFieldName = getConfigs().getString(config, "outputField", null);
      this.outputFieldNames = getConfigs().getStringList(config, "outputFields", null);
      if (outputFieldName == null && outputFieldNames == null) {
        throw new MorphlineCompilationException("Either outputField or outputFields must be defined", config);
      }
      if (outputFieldName != null && outputFieldNames != null) {
        throw new MorphlineCompilationException("Must not define both outputField and outputFields at the same time", config);
      }
     
      String separator = getConfigs().getString(config, "separator");
      boolean isRegex = getConfigs().getBoolean(config, "isRegex", false);
      GrokDictionaries dict = new GrokDictionaries(config, getConfigs());
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

    public XQuery(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) throws SaxonApiException, IOException, XMLStreamException {
      super(builder, config, parent, child, context);
     
      List<? extends Config> fragmentConfigs = getConfigs().getConfigList(config, "fragments");
      if (fragmentConfigs.size() == 0) {
        throw new MorphlineCompilationException("At least one fragment must be defined", config);
      }
      if (fragmentConfigs.size() > 1) {
        throw new MorphlineCompilationException("More than one fragment is not yet supported", config);
      }
      for (Config fragment : fragmentConfigs) {
        String fragmentPath = getConfigs().getString(fragment, "fragmentPath");
        if (!fragmentPath.equals("/")) {
          throw new MorphlineCompilationException("Non-root fragment paths are not yet supported", config);
       
       
        XQueryCompiler compiler = processor.newXQueryCompiler();
        compiler.setErrorListener(new DefaultErrorListener());
        compiler.setCompileWithTracing(isTracing);
        compiler.setLanguageVersion(getConfigs().getString(config, "languageVersion", "1.0"));
       
        XQueryExecutable executable = null;
        String query = getConfigs().getString(fragment, "queryString", null);
        if (query != null) {
          executable = compiler.compile(query);    
        }
        String queryFile = getConfigs().getString(fragment, "queryFile", null);
        if (queryFile != null) {
          executable = compiler.compile(new File(queryFile));
        }
        if (query == null && queryFile == null) {
          throw new MorphlineCompilationException("Either query or queryFile must be defined", config);
        }
        if (query != null && queryFile != null) {
          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)) {
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 XSLT(this, config, parent, child, context);
    } catch (SaxonApiException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    } catch (IOException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    } catch (XMLStreamException e) {
      throw new MorphlineCompilationException("Cannot compile", config, e);
    }
  }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

    // work around the fact that SimpleDateFormat doesn't understand Unix time format
    private SimpleDateFormat getUnixTimeFormat(String format, TimeZone timeZone) {
      if (format.equals("unixTimeInMillis")) {
        if (!"UTC".equals(timeZone.getID())) {
          throw new MorphlineCompilationException("timeZone must be UTC for date format 'unixTimeInMillis'", getConfig());
        }
        return UNIX_TIME_IN_MILLIS;
      } else if (format.equals("unixTimeInSeconds")) {
        if (!"UTC".equals(timeZone.getID())) {
          throw new MorphlineCompilationException("timeZone must be UTC for date format 'unixTimeInSeconds'", getConfig());
        }
        return UNIX_TIME_IN_SECONDS;
      } else {
        return null;
      }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      }
    }
   
    private TimeZone getTimeZone(String timeZoneID) {
      if (!Arrays.asList(TimeZone.getAvailableIDs()).contains(timeZoneID)) {
        throw new MorphlineCompilationException("Unknown timezone: " + timeZoneID, getConfig());
      }
      return TimeZone.getTimeZone(timeZoneID);
    }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

      }
      assert Locale.ROOT.toString().equals("");
      if (name.equals(Locale.ROOT.toString())) {
        return Locale.ROOT;
      }
      throw new MorphlineCompilationException("Unknown locale: " + name, getConfig());
    }
View Full Code Here

Examples of org.kitesdk.morphline.api.MorphlineCompilationException

    public XSLT(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) throws SaxonApiException, IOException, XMLStreamException {
      super(builder, config, parent, child, context);
     
      List<? extends Config> fragmentConfigs = getConfigs().getConfigList(config, "fragments");
      if (fragmentConfigs.size() == 0) {
        throw new MorphlineCompilationException("At least one fragment must be defined", config);
      }
      if (fragmentConfigs.size() > 1) {
        throw new MorphlineCompilationException("More than one fragment is not yet supported", config);
      }
      for (Config fragment : fragmentConfigs) {
        String fragmentPath = getConfigs().getString(fragment, "fragmentPath");
        if (!fragmentPath.equals("/")) {
          throw new MorphlineCompilationException("Non-root fragment paths are not yet supported", config);
       
       
        XsltCompiler compiler = processor.newXsltCompiler();
        compiler.setErrorListener(new DefaultErrorListener());
        compiler.setCompileWithTracing(isTracing);
        String version = getConfigs().getString(config, "languageVersion", null);
        if (version != null) {
          compiler.setXsltLanguageVersion(version);
        }
       
        XsltExecutable executable = null;
        String query = getConfigs().getString(fragment, "queryString", null);
        if (query != null) {
          executable = compiler.compile(new StreamSource(new StringReader(query)));    
        }
        String queryFile = getConfigs().getString(fragment, "queryFile", null);
        if (queryFile != null) {
          executable = compiler.compile(new StreamSource(new File(queryFile)));    
        }
        if (query == null && queryFile == null) {
          throw new MorphlineCompilationException("Either query or queryFile must be defined", config);
        }
        if (query != null && queryFile != null) {
          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)) {
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.