예제 #1
0
  @Override
  protected void doHadoopWork() throws BuildException {
    Tuple tuple = ContextManager.getCurrentTuple();
    if (tuple == null) {
      throw new BuildException(
          this.getTaskName()
              + " should be put inside task container which provides tuple to execution context");
    }

    try {
      if (tuple.getType(fieldNumber) != DataType.TUPLE
          || !(tuple.get(fieldNumber) instanceof Tuple)) {
        throw new BuildException("Tuple field " + fieldNumber + " doesn't represent a Tuple");
      }

      ContextManager.setCurrentTupleContext((Tuple) tuple.get(fieldNumber));

      try {
        for (Task task : tasks) {
          task.perform();
        }
      } finally {
        ContextManager.resetCurrentTupleContext();
      }
    } catch (ExecException e) {
      throw new BuildException("Failed to check type of tuple field " + fieldNumber, e);
    }
  }
예제 #2
0
  @Override
  public void doWork() throws BuildException {
    Object[] array = (Object[]) this.getReference(arrayRef);

    for (Object obj : array) {
      if (property != null) {
        this.setPropertyThreadSafe(property, obj == null ? null : obj.toString());
      }

      if (reference != null) {
        this.setReference(reference, obj);
      }

      for (Task task : tasks) {
        task.perform();
      }
    }
  }
예제 #3
0
  @Override
  public void doWork() throws BuildException {
    DescribeVpnGatewaysRequest request = new DescribeVpnGatewaysRequest();

    if (gatewayIds != null) {
      request.setVpnGatewayIds(CollectionsHelper.asList(gatewayIds));
    }

    if (filters != null) {
      request.setFilters(filters);
    }

    DescribeVpnGatewaysResult result = getEc2Client().describeVpnGateways(request);

    for (VpnGateway gateway : result.getVpnGateways()) {
      this.setPropertyThreadSafe(property, gateway.toString());

      for (Task task : tasks) {
        task.perform();
      }
    }
  }