Пример #1
0
  public void check(
      List<CheckResultInterface> remarks,
      TransMeta transMeta,
      StepMeta stepMeta,
      RowMetaInterface prev,
      String[] input,
      String[] output,
      RowMetaInterface info,
      VariableSpace space,
      Repository repository,
      IMetaStore metaStore) {

    CheckResult cr;

    // See if we get input...
    if (input.length > 0) {
      cr =
          new CheckResult(
              CheckResult.TYPE_RESULT_ERROR,
              BaseMessages.getString(PKG, "PropertyInputMeta.CheckResult.NoInputExpected"),
              stepMeta);
      remarks.add(cr);
    } else {
      cr =
          new CheckResult(
              CheckResult.TYPE_RESULT_OK,
              BaseMessages.getString(PKG, "PropertyInputMeta.CheckResult.NoInput"),
              stepMeta);
      remarks.add(cr);
    }

    FileInputList fileInputList = getFiles(transMeta);

    if (fileInputList == null || fileInputList.getFiles().size() == 0) {
      cr =
          new CheckResult(
              CheckResult.TYPE_RESULT_ERROR,
              BaseMessages.getString(PKG, "PropertyInputMeta.CheckResult.NoFiles"),
              stepMeta);
      remarks.add(cr);
    } else {
      cr =
          new CheckResult(
              CheckResult.TYPE_RESULT_OK,
              BaseMessages.getString(
                  PKG,
                  "PropertyInputMeta.CheckResult.FilesOk",
                  "" + fileInputList.getFiles().size()),
              stepMeta);
      remarks.add(cr);
    }
  }
Пример #2
0
 public FileInputList getFiles(VariableSpace space) {
   String[] required = new String[fileName.length];
   boolean[] subdirs = new boolean[fileName.length]; // boolean arrays are defaulted to false.
   for (int i = 0; i < required.length; i++) {
     required[i] = "Y";
   }
   return FileInputList.createFileList(
       space, fileName, fileMask, excludeFileMask, required, subdirs);
 }
Пример #3
0
  private void handleMissingFiles() throws KettleException {
    List<FileObject> nonExistantFiles = data.files.getNonExistantFiles();
    if (nonExistantFiles.size() != 0) {
      String message = FileInputList.getRequiredFilesDescription(nonExistantFiles);
      log.logError(
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredFilesTitle"),
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredFiles", message));

      throw new KettleException(
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredFilesMissing", message));
    }

    List<FileObject> nonAccessibleFiles = data.files.getNonAccessibleFiles();
    if (nonAccessibleFiles.size() != 0) {
      String message = FileInputList.getRequiredFilesDescription(nonAccessibleFiles);
      log.logError(
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredFilesTitle"),
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredNotAccessibleFiles", message));

      throw new KettleException(
          BaseMessages.getString(PKG, "JsonInput.Log.RequiredNotAccessibleFilesMissing", message));
    }
  }