예제 #1
0
  public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
    meta = (AccessOutputMeta) smi;
    data = (AccessOutputData) sdi;

    Object[] r = getRow(); // this also waits for a previous step to be finished.
    if (r == null) // no more input to be expected...
    {
      setOutputDone();
      return false;
    }

    if (first && meta.isDoNotOpenNewFileInit()) {
      try {
        if (!OpenFile()) {
          return false;
        }

      } catch (Exception e) {
        logError("An error occurred intialising this step: " + e.getMessage());
        stopAll();
        setErrors(1);
      }
    }
    try {
      writeToTable(r);
      putRow(data.outputRowMeta, r); // in case we want it go further...

      if (checkFeedback(getLinesOutput())) {
        if (log.isBasic()) {
          logBasic("linenr " + getLinesOutput());
        }
      }
    } catch (KettleException e) {
      logError("Because of an error, this step can't continue: " + e.getMessage());
      setErrors(1);
      stopAll();
      setOutputDone(); // signal end to receiver(s)
      return false;
    }

    return true;
  }
예제 #2
0
  public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
    meta = (AccessOutputMeta) smi;
    data = (AccessOutputData) sdi;

    if (super.init(smi, sdi)) {
      if (!meta.isDoNotOpenNewFileInit()) {
        try {
          return OpenFile();

        } catch (Exception e) {
          logError("An error occurred intialising this step: " + e.getMessage());
          stopAll();
          setErrors(1);
        }
      } else {
        return true;
      }
    }
    return false;
  }