Esempio n. 1
0
  private Method findMethod(Class<?> clz, Object[] args) throws LocalRunException {
    if (args == null || args.length == 0) {
      throw new LocalRunException("Input data can't be null");
    }
    Method method = ClassUtils.findMethod(clz, "evaluate", args);
    // method "evaluate" can't be static
    if (Modifier.toString(method.getModifiers()).contains("static")) {
      throw new LocalRunException("'evaluate' method can't be static");
    }

    return method;
  }
Esempio n. 2
0
  public UDFRunner(Odps odps, String className) throws LocalRunException {
    super(odps);
    if (StringUtils.isBlank(className)) {
      throw new IllegalArgumentException("Missing arguments:className");
    }

    try {
      udf = (UDF) ClassUtils.newInstance(UDFRunner.class.getClassLoader(), className);

      SecurityClient.open();
      udf.setup(context);

    } catch (LocalRunException e) {
      throw e;
    } catch (UDFException e) {
      throw new LocalRunException(e);
    } finally {
      SecurityClient.close();
    }
  }