当前位置: 首页>>代码示例>>Java>>正文


Java Code.SUCCESS属性代码示例

本文整理汇总了Java中org.apache.zeppelin.interpreter.InterpreterResult.Code.SUCCESS属性的典型用法代码示例。如果您正苦于以下问题:Java Code.SUCCESS属性的具体用法?Java Code.SUCCESS怎么用?Java Code.SUCCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.zeppelin.interpreter.InterpreterResult.Code的用法示例。


在下文中一共展示了Code.SUCCESS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HandleHelp

private InterpreterResult HandleHelp(JLineShell shell, String st) {
  java.util.logging.StreamHandler sh = null;
  java.util.logging.Logger springLogger = null;
  java.util.logging.Formatter formatter = new java.util.logging.Formatter() {
    public String format(java.util.logging.LogRecord record) {
      return record.getMessage();
    }
  };
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  try {
    sh = new java.util.logging.StreamHandler(baos, formatter);
    springLogger = HandlerUtils.getLogger(org.springframework.shell.core.SimpleParser.class);
    springLogger.addHandler(sh);
    shell.executeCommand(st);
  } catch (Exception e) {
    s_logger.error(e.getMessage(), e);
    return new InterpreterResult(Code.ERROR, e.getMessage());
  }
  finally {
    sh.flush();
    springLogger.removeHandler(sh);
    sh.close();
  }
  return new InterpreterResult(Code.SUCCESS, baos.toString());
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:25,代码来源:LensInterpreter.java

示例2: renderTable

private InterpreterResult renderTable(List<String> cols, List<List<String>> lines) {
  logger.info("Executing renderTable method");
  StringBuilder msg = null;
  if (cols.isEmpty()) {
    msg = new StringBuilder();
  } else {
    msg = new StringBuilder(TABLE);
    msg.append(NEW_LINE);
    msg.append(StringUtils.join(cols, TAB));
    msg.append(NEW_LINE);
    for (List<String> line : lines) {
      if (line.size() < cols.size()) {
        for (int i = line.size(); i < cols.size(); i++) {
          line.add(null);
        }
      }
      msg.append(StringUtils.join(line, TAB));
      msg.append(NEW_LINE);
    }
  }
  return new InterpreterResult(Code.SUCCESS, msg.toString());
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:22,代码来源:Neo4jCypherInterpreter.java

示例3: getResultCode

private Code getResultCode(scala.tools.nsc.interpreter.Results.Result r) {
  if (r instanceof scala.tools.nsc.interpreter.Results.Success$) {
    return Code.SUCCESS;
  } else if (r instanceof scala.tools.nsc.interpreter.Results.Incomplete$) {
    return Code.INCOMPLETE;
  } else {
    return Code.ERROR;
  }
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:9,代码来源:ScaldingInterpreter.java

示例4: interpret

@Override
public InterpreterResult interpret(String st, InterpreterContext interpreterContext) {
  String html;
  try {
    html = md.process(st);
  } catch (IOException | java.lang.RuntimeException e) {
    return new InterpreterResult(Code.ERROR, InterpreterUtils.getMostRelevantMessage(e));
  }
  return new InterpreterResult(Code.SUCCESS, "%html " + html);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:10,代码来源:Markdown.java

示例5: interpret

@Override
public InterpreterResult interpret(String line, InterpreterContext context) {
  if (initEx != null) {
    return IgniteInterpreterUtils.buildErrorResult(initEx);
  }

  if (line == null || line.trim().length() == 0) {
    return new InterpreterResult(Code.SUCCESS);
  }

  return interpret(line.split("\n"));
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:12,代码来源:IgniteInterpreter.java

示例6: getResultCode

private Code getResultCode(Result res) {
  if (res instanceof scala.tools.nsc.interpreter.Results.Success$) {
    return Code.SUCCESS;
  } else if (res instanceof scala.tools.nsc.interpreter.Results.Incomplete$) {
    return Code.INCOMPLETE;
  } else {
    return Code.ERROR;
  }
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:9,代码来源:IgniteInterpreter.java

示例7: interpret

@Override
public InterpreterResult interpret(String st, InterpreterContext context) {
  MockInterpreterA intpA = getInterpreterA();
  String intpASt = intpA.getLastStatement();
  long timeToSleep = Long.parseLong(st);
  if (intpASt != null) {
    timeToSleep += Long.parseLong(intpASt);
  }
  try {
    Thread.sleep(timeToSleep);
  } catch (NumberFormatException | InterruptedException e) {
    throw new InterpreterException(e);
  }
  return new InterpreterResult(Code.SUCCESS, Long.toString(timeToSleep));
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:15,代码来源:MockInterpreterB.java

示例8: interpret

@Override
public InterpreterResult interpret(String st, InterpreterContext context) {
  try {
    Thread.sleep(Long.parseLong(st));
    this.lastSt = st;
  } catch (NumberFormatException | InterruptedException e) {
    throw new InterpreterException(e);
  }
  return new InterpreterResult(Code.SUCCESS, st);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:10,代码来源:MockInterpreterA.java

示例9: interpret

/**
 * Interpret a single line.
 */
@Override
public InterpreterResult interpret(String line, InterpreterContext context) {
  if (sparkVersion.isUnsupportedVersion()) {
    return new InterpreterResult(Code.ERROR, "Spark " + sparkVersion.toString()
        + " is not supported");
  }

  z.setInterpreterContext(context);
  if (line == null || line.trim().length() == 0) {
    return new InterpreterResult(Code.SUCCESS);
  }
  return interpret(line.split("\n"), context);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:16,代码来源:SparkInterpreter.java

示例10: interpret

@Override
public InterpreterResult interpret(String st, InterpreterContext context) {
  SQLContext sqlc = null;
  SparkInterpreter sparkInterpreter = getSparkInterpreter();

  if (sparkInterpreter.getSparkVersion().isUnsupportedVersion()) {
    return new InterpreterResult(Code.ERROR, "Spark "
        + sparkInterpreter.getSparkVersion().toString() + " is not supported");
  }

  sqlc = getSparkInterpreter().getSQLContext();
  SparkContext sc = sqlc.sparkContext();
  if (concurrentSQL()) {
    sc.setLocalProperty("spark.scheduler.pool", "fair");
  } else {
    sc.setLocalProperty("spark.scheduler.pool", null);
  }

  sc.setJobGroup(getJobGroup(context), "Zeppelin", false);
  Object rdd = null;
  try {
    // method signature of sqlc.sql() is changed
    // from  def sql(sqlText: String): SchemaRDD (1.2 and prior)
    // to    def sql(sqlText: String): DataFrame (1.3 and later).
    // Therefore need to use reflection to keep binary compatibility for all spark versions.
    Method sqlMethod = sqlc.getClass().getMethod("sql", String.class);
    rdd = sqlMethod.invoke(sqlc, st);
  } catch (NoSuchMethodException | SecurityException | IllegalAccessException
      | IllegalArgumentException | InvocationTargetException e) {
    throw new InterpreterException(e);
  }

  String msg = ZeppelinContext.showDF(sc, context, rdd, maxResult);
  sc.clearJobGroup();
  return new InterpreterResult(Code.SUCCESS, msg);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:36,代码来源:SparkSqlInterpreter.java

示例11: interpret

@Override
public InterpreterResult interpret(String line, InterpreterContext context) {
  if (line == null || line.trim().length() == 0) {
    return new InterpreterResult(Code.SUCCESS);
  }

  InterpreterResult result = interpret(line.split("\n"), context);
  return result;
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:9,代码来源:FlinkInterpreter.java

示例12: interpret

@Override
public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) {
  logger.info("Running Scalding command '" + cmd + "'");

  if (cmd == null || cmd.trim().length() == 0) {
    return new InterpreterResult(Code.SUCCESS);
  }
  return interpret(cmd.split("\n"), contextInterpreter);
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:9,代码来源:ScaldingInterpreter.java

示例13: interpret

@Override
public InterpreterResult interpret(String markdownText, InterpreterContext interpreterContext) {
  String html;

  try {
    html = parser.render(markdownText);
  } catch (RuntimeException e) {
    LOGGER.error("Exception in MarkdownInterpreter while interpret ", e);
    return new InterpreterResult(Code.ERROR, InterpreterUtils.getMostRelevantMessage(e));
  }

  return new InterpreterResult(Code.SUCCESS, "%html " + html);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:13,代码来源:Markdown.java

示例14: interpret

private InterpreterResult interpret(String[] commands, InterpreterContext context) {
  boolean isSuccess = true;
  totalCommands = commands.length;
  completedCommands = 0;
  
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  PrintStream ps = new PrintStream(baos);
  PrintStream old = System.out;
  
  System.setOut(ps);
  
  for (String command : commands) {
    int commandResult = 1;
    String[] args = splitAndRemoveEmpty(command, " ");
    if (args.length > 0 && args[0].equals("help")) {
      System.out.println(getCommandList());
    } else {
      commandResult = fs.run(args);
    }
    if (commandResult != 0) {
      isSuccess = false;
      break;
    } else {
      completedCommands += 1;
    }
    System.out.println();
  }

  System.out.flush();
  System.setOut(old);
  
  if (isSuccess) {
    return new InterpreterResult(Code.SUCCESS, baos.toString());
  } else {
    return new InterpreterResult(Code.ERROR, baos.toString());
  }
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:37,代码来源:AlluxioInterpreter.java

示例15: interpret

@Override
public InterpreterResult interpret(String st, InterpreterContext context)
    throws InterpreterException {
  if (getProperties().containsKey("progress")) {
    context.setProgress(Integer.parseInt(getProperty("progress")));
  }
  try {
    Thread.sleep(Long.parseLong(st));
    this.lastSt = st;
  } catch (NumberFormatException | InterruptedException e) {
    throw new InterpreterException(e);
  }
  return new InterpreterResult(Code.SUCCESS, st);
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:14,代码来源:MockInterpreterA.java


注:本文中的org.apache.zeppelin.interpreter.InterpreterResult.Code.SUCCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。