Пример #1
0
  /**
   * Creates a TalendDataSet with the data retrieved from an input/output tFileInputOutputXXX Talend
   * Graphical Node.
   *
   * @param schema The Hashmap of column name and column type of the component.
   * @param componentName The component name
   * @param fileSystemPath The HDFS path to the file where the component read/write data
   * @param fileFormat The file format as a FileFormat
   */
  public void addDataset(
      Map<String, String> schema,
      String componentName,
      String fileSystemPath,
      FileFormat fileFormat) {
    HdfsEntity container =
        new HdfsEntity(fileSystemPath, EntityType.DIRECTORY, this.fileSystem.getIdentity());

    TalendDataset dataset =
        new TalendDataset(
            ClouderaAPIUtil.getDatasetName(fileSystemPath),
            componentName,
            this.jobName + this.projectName);
    dataset.setDataContainer(container);
    dataset.setFileFormat(fileFormat);
    dataset.setFields(ClouderaFieldConvertor.convertToTalendField(schema));
    dataset.addTags(ImmutableList.of("Talend", this.jobName)); // $NON-NLS-1$
    dataset.setCreated(this.creationInstant);

    this.datasets.add(dataset);
  }