コード例 #1
0
  public void readRep(
      Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      long id_connection = rep.getStepAttributeInteger(id_step, "id_connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, id_connection);

      cached = rep.getStepAttributeBoolean(id_step, "cache"); // $NON-NLS-1$
      loadingAllDataInCache = rep.getStepAttributeBoolean(id_step, "cache_load_all"); // $NON-NLS-1$
      cacheSize = (int) rep.getStepAttributeInteger(id_step, "cache_size"); // $NON-NLS-1$
      schemaName = rep.getStepAttributeString(id_step, "lookup_schema"); // $NON-NLS-1$
      tablename = rep.getStepAttributeString(id_step, "lookup_table"); // $NON-NLS-1$
      orderByClause = rep.getStepAttributeString(id_step, "lookup_orderby"); // $NON-NLS-1$
      failingOnMultipleResults =
          rep.getStepAttributeBoolean(id_step, "fail_on_multiple"); // $NON-NLS-1$
      eatingRowOnLookupFailure =
          rep.getStepAttributeBoolean(id_step, "eat_row_on_failure"); // $NON-NLS-1$

      int nrkeys = rep.countNrStepAttributes(id_step, "lookup_key_name"); // $NON-NLS-1$
      int nrvalues = rep.countNrStepAttributes(id_step, "return_value_name"); // $NON-NLS-1$

      allocate(nrkeys, nrvalues);

      for (int i = 0; i < nrkeys; i++) {
        streamKeyField1[i] =
            rep.getStepAttributeString(id_step, i, "lookup_key_name"); // $NON-NLS-1$
        tableKeyField[i] =
            rep.getStepAttributeString(id_step, i, "lookup_key_field"); // $NON-NLS-1$
        keyCondition[i] =
            rep.getStepAttributeString(id_step, i, "lookup_key_condition"); // $NON-NLS-1$
        streamKeyField2[i] =
            rep.getStepAttributeString(id_step, i, "lookup_key_name2"); // $NON-NLS-1$
      }

      for (int i = 0; i < nrvalues; i++) {
        returnValueField[i] =
            rep.getStepAttributeString(id_step, i, "return_value_name"); // $NON-NLS-1$
        returnValueNewName[i] =
            rep.getStepAttributeString(id_step, i, "return_value_rename"); // $NON-NLS-1$
        returnValueDefault[i] =
            rep.getStepAttributeString(id_step, i, "return_value_default"); // $NON-NLS-1$
        returnValueDefaultType[i] =
            ValueMeta.getType(
                rep.getStepAttributeString(id_step, i, "return_value_type")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          Messages.getString(
              "DatabaseLookupMeta.ERROR0002.UnexpectedErrorReadingFromTheRepository"),
          e); //$NON-NLS-1$
    }
  }
コード例 #2
0
ファイル: SapInputMeta.java プロジェクト: hoverzheng/kettle
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      databaseMeta =
          rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases); // $NON-NLS-1$

      String functionName = rep.getStepAttributeString(id_step, "function_name");
      String functionDescription = rep.getStepAttributeString(id_step, "function_description");
      String functionGroup = rep.getStepAttributeString(id_step, "function_group");
      String functionApplication = rep.getStepAttributeString(id_step, "function_application");
      String functionHost = rep.getStepAttributeString(id_step, "function_host");

      if (!Const.isEmpty(functionName)) {
        function =
            new SAPFunction(
                functionName,
                functionDescription,
                functionGroup,
                functionApplication,
                functionHost);
      } else {
        function = null;
      }

      int nrParameters = rep.countNrStepAttributes(id_step, "parameter_field_name");
      for (int i = 0; i < nrParameters; i++) {
        String fieldName = rep.getStepAttributeString(id_step, i, "parameter_field_name");
        SapType sapType =
            SapType.findTypeForCode(rep.getStepAttributeString(id_step, i, "parameter_sap_type"));
        String tableName = rep.getStepAttributeString(id_step, i, "parameter_table_name");
        int targetType =
            ValueMeta.getType(rep.getStepAttributeString(id_step, i, "parameter_target_type"));
        String parameterName = rep.getStepAttributeString(id_step, i, "parameter_name");
        parameters.add(new SapParameter(fieldName, sapType, tableName, parameterName, targetType));
      }

      int nrFields = rep.countNrStepAttributes(id_step, "field_sap_field_name");
      for (int i = 0; i < nrFields; i++) {
        String sapFieldName = rep.getStepAttributeString(id_step, i, "field_sap_field_name");
        SapType sapType =
            SapType.findTypeForCode(rep.getStepAttributeString(id_step, i, "field_sap_type"));
        String tableName = rep.getStepAttributeString(id_step, i, "field_table_name");
        int targetType =
            ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_target_type"));
        String newName = rep.getStepAttributeString(id_step, i, "field_new_name");
        outputFields.add(new SapOutputField(sapFieldName, sapType, tableName, newName, targetType));
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #3
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {

      urlInField = rep.getStepAttributeBoolean(id_step, "url_in_field");
      urlFieldname = rep.getStepAttributeString(id_step, "url_field_name");
      includeRowNumber = rep.getStepAttributeBoolean(id_step, "rownum");
      rowNumberField = rep.getStepAttributeString(id_step, "rownum_field");
      includeUrl = rep.getStepAttributeBoolean(id_step, "include_url");
      urlField = rep.getStepAttributeString(id_step, "url_Field");
      readfrom = rep.getStepAttributeString(id_step, "read_from");
      rowLimit = rep.getStepAttributeInteger(id_step, "limit");

      int nrFields = rep.countNrStepAttributes(id_step, "field_name");
      int nrUrls = rep.countNrStepAttributes(id_step, "url_name");

      allocate(nrUrls, nrFields);

      for (int i = 0; i < nrUrls; i++) {
        url[i] = rep.getStepAttributeString(id_step, i, "url_name");
      }

      for (int i = 0; i < nrFields; i++) {
        RssInputField field = new RssInputField();

        field.setName(rep.getStepAttributeString(id_step, i, "field_name"));
        field.setColumn(
            RssInputField.getColumnByCode(rep.getStepAttributeString(id_step, i, "field_column")));
        field.setType(
            ValueMetaFactory.getIdForValueMeta(
                rep.getStepAttributeString(id_step, i, "field_type")));
        field.setFormat(rep.getStepAttributeString(id_step, i, "field_format"));
        field.setCurrencySymbol(rep.getStepAttributeString(id_step, i, "field_currency"));
        field.setDecimalSymbol(rep.getStepAttributeString(id_step, i, "field_decimal"));
        field.setGroupSymbol(rep.getStepAttributeString(id_step, i, "field_group"));
        field.setLength((int) rep.getStepAttributeInteger(id_step, i, "field_length"));
        field.setPrecision((int) rep.getStepAttributeInteger(id_step, i, "field_precision"));
        field.setTrimType(
            RssInputField.getTrimTypeByCode(
                rep.getStepAttributeString(id_step, i, "field_trim_type")));
        field.setRepeated(rep.getStepAttributeBoolean(id_step, i, "field_repeat"));

        inputFields[i] = field;
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "RssInputMeta.Exception.ErrorReadingRepository"), e);
    }
  }
コード例 #4
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      directory = rep.getStepAttributeString(id_step, "directory");
      prefix = rep.getStepAttributeString(id_step, "prefix");
      sortSize = rep.getStepAttributeString(id_step, "sort_size");
      freeMemoryLimit = rep.getStepAttributeString(id_step, "free_memory");

      compressFiles = rep.getStepAttributeBoolean(id_step, "compress");
      compressFilesVariable = rep.getStepAttributeString(id_step, "compress_variable");

      onlyPassingUniqueRows = rep.getStepAttributeBoolean(id_step, "unique_rows");

      int nrfields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name");
        ascending[i] = rep.getStepAttributeBoolean(id_step, i, "field_ascending");
        caseSensitive[i] = rep.getStepAttributeBoolean(id_step, i, "field_case_sensitive", true);
        collatorEnabled[i] =
            rep.getStepAttributeBoolean(id_step, i, "field_collator_enabled", false);
        collatorStrength[i] =
            Integer.parseInt(rep.getStepAttributeString(id_step, i, "field_collator_strength"));
        preSortedField[i] = rep.getStepAttributeBoolean(id_step, i, "field_presorted", false);
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #5
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      int nrfields = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name"); // $NON-NLS-1$
        fieldType[i] =
            ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_type")); // $NON-NLS-1$
        fieldLength[i] =
            (int) rep.getStepAttributeInteger(id_step, i, "field_length"); // $NON-NLS-1$
        fieldPrecision[i] =
            (int) rep.getStepAttributeInteger(id_step, i, "field_precision"); // $NON-NLS-1$
      }

      selectingAndSortingUnspecifiedFields =
          rep.getStepAttributeBoolean(id_step, "select_unspecified");
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "MappingInputMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #6
0
ファイル: RowGeneratorMeta.java プロジェクト: cnopens/BA
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      int nrfields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name");
        fieldType[i] = rep.getStepAttributeString(id_step, i, "field_type");

        fieldFormat[i] = rep.getStepAttributeString(id_step, i, "field_format");
        currency[i] = rep.getStepAttributeString(id_step, i, "field_currency");
        decimal[i] = rep.getStepAttributeString(id_step, i, "field_decimal");
        group[i] = rep.getStepAttributeString(id_step, i, "field_group");
        value[i] = rep.getStepAttributeString(id_step, i, "field_nullif");
        fieldLength[i] = (int) rep.getStepAttributeInteger(id_step, i, "field_length");
        fieldPrecision[i] = (int) rep.getStepAttributeInteger(id_step, i, "field_precision");
        setEmptyString[i] = rep.getStepAttributeBoolean(id_step, i, "set_empty_string", false);
      }

      long longLimit = rep.getStepAttributeInteger(id_step, "limit");
      if (longLimit <= 0) {
        rowLimit = rep.getStepAttributeString(id_step, "limit");
      } else {
        rowLimit = Long.toString(longLimit);
      }

    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #7
0
  public void readRep(
      Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      long id_connection = rep.getStepAttributeInteger(id_step, "id_connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, id_connection);

      commitSize = (int) rep.getStepAttributeInteger(id_step, "commit"); // $NON-NLS-1$
      schemaName = rep.getStepAttributeString(id_step, "schema"); // $NON-NLS-1$
      tableName = rep.getStepAttributeString(id_step, "table"); // $NON-NLS-1$

      int nrkeys = rep.countNrStepAttributes(id_step, "key_name"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        keyStream[i] = rep.getStepAttributeString(id_step, i, "key_name"); // $NON-NLS-1$
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "key_field"); // $NON-NLS-1$
        keyCondition[i] = rep.getStepAttributeString(id_step, i, "key_condition"); // $NON-NLS-1$
        keyStream2[i] = rep.getStepAttributeString(id_step, i, "key_name2"); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          Messages.getString("DeleteMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #8
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);
      schemaName = rep.getStepAttributeString(id_step, "schema");
      tableName = rep.getStepAttributeString(id_step, "table");
      loadAction = rep.getStepAttributeString(id_step, "load_action");
      PsqlPath = rep.getStepAttributeString(id_step, "PsqlPath");
      stopOnError = rep.getStepAttributeBoolean(id_step, "stop_on_error");

      dbNameOverride = rep.getStepAttributeString(id_step, "dbname_override");
      enclosure = rep.getStepAttributeString(id_step, "enclosure");
      delimiter = rep.getStepAttributeString(id_step, "delimiter");

      int nrvalues = rep.countNrStepAttributes(id_step, "stream_name");

      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        fieldTable[i] = rep.getStepAttributeString(id_step, i, "stream_name");
        fieldStream[i] = rep.getStepAttributeString(id_step, i, "field_name");
        dateMask[i] = rep.getStepAttributeString(id_step, i, "date_mask");
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "GPBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository"),
          e);
    }
  }
コード例 #9
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);
      maxErrors = (int) rep.getStepAttributeInteger(id_step, "errors"); // $NON-NLS-1$
      schemaName = rep.getStepAttributeString(id_step, "schema"); // $NON-NLS-1$
      tableName = rep.getStepAttributeString(id_step, "table"); // $NON-NLS-1$
      loadMethod = rep.getStepAttributeString(id_step, "load_method"); // $NON-NLS-1$
      loadAction = rep.getStepAttributeString(id_step, "load_action"); // $NON-NLS-1$
      PsqlPath = rep.getStepAttributeString(id_step, "PsqlPath"); // $NON-NLS-1$
      controlFile = rep.getStepAttributeString(id_step, "control_file"); // $NON-NLS-1$
      dataFile = rep.getStepAttributeString(id_step, "data_file"); // $NON-NLS-1$
      logFile = rep.getStepAttributeString(id_step, "log_file"); // $NON-NLS-1$

      eraseFiles = rep.getStepAttributeBoolean(id_step, "erase_files"); // $NON-NLS-1$
      encoding = rep.getStepAttributeString(id_step, "encoding"); // $NON-NLS-1$
      dbNameOverride = rep.getStepAttributeString(id_step, "dbname_override"); // $NON-NLS-1$		

      int nrvalues = rep.countNrStepAttributes(id_step, "stream_name"); // $NON-NLS-1$

      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        fieldTable[i] = rep.getStepAttributeString(id_step, i, "stream_name"); // $NON-NLS-1$
        fieldStream[i] = rep.getStepAttributeString(id_step, i, "field_name"); // $NON-NLS-1$
        dateMask[i] = rep.getStepAttributeString(id_step, i, "date_mask"); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "GPBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository"),
          e); //$NON-NLS-1$
    }
  }
コード例 #10
0
ファイル: DenormaliserMeta.java プロジェクト: cnopens/BA
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      keyField = rep.getStepAttributeString(id_step, "key_field"); // $NON-NLS-1$

      int groupsize = rep.countNrStepAttributes(id_step, "group_name"); // $NON-NLS-1$
      int nrvalues = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$

      allocate(groupsize, nrvalues);

      for (int i = 0; i < groupsize; i++) {
        groupField[i] = rep.getStepAttributeString(id_step, i, "group_name"); // $NON-NLS-1$
      }

      for (int i = 0; i < nrvalues; i++) {
        denormaliserTargetField[i] = new DenormaliserTargetField();
        denormaliserTargetField[i].setFieldName(
            rep.getStepAttributeString(id_step, i, "field_name")); // $NON-NLS-1$
        denormaliserTargetField[i].setKeyValue(
            rep.getStepAttributeString(id_step, i, "key_value")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetName(
            rep.getStepAttributeString(id_step, i, "target_name")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetType(
            rep.getStepAttributeString(id_step, i, "target_type")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetFormat(
            rep.getStepAttributeString(id_step, i, "target_format")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetLength(
            (int) rep.getStepAttributeInteger(id_step, i, "target_length")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetPrecision(
            (int) rep.getStepAttributeInteger(id_step, i, "target_precision")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetDecimalSymbol(
            rep.getStepAttributeString(id_step, i, "target_decimal_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetGroupingSymbol(
            rep.getStepAttributeString(id_step, i, "target_grouping_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetCurrencySymbol(
            rep.getStepAttributeString(id_step, i, "target_currency_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetNullString(
            rep.getStepAttributeString(id_step, i, "target_null_string")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetAggregationType(
            rep.getStepAttributeString(id_step, i, "target_aggregation_type")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          "Unexpected error reading step information from the repository", e); // $NON-NLS-1$
    }
  }
コード例 #11
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);

      commitSize = rep.getStepAttributeString(id_step, "commit");
      if (commitSize == null) {
        long comSz = 0;
        try {
          comSz = rep.getStepAttributeInteger(id_step, "commit");
        } catch (Exception ex) {
          commitSize = "100";
        }
        if (comSz > 0) {
          commitSize = Long.toString(comSz);
        }
      }
      schemaName = rep.getStepAttributeString(id_step, "schema");
      tableName = rep.getStepAttributeString(id_step, "table");
      updateBypassed = rep.getStepAttributeBoolean(id_step, "update_bypassed");

      int nrkeys = rep.countNrStepAttributes(id_step, "key_field");
      int nrvalues = rep.countNrStepAttributes(id_step, "value_name");

      allocate(nrkeys, nrvalues);

      for (int i = 0; i < nrkeys; i++) {
        keyStream[i] = rep.getStepAttributeString(id_step, i, "key_name");
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "key_field");
        keyCondition[i] = rep.getStepAttributeString(id_step, i, "key_condition");
        keyStream2[i] = rep.getStepAttributeString(id_step, i, "key_name2");
      }

      for (int i = 0; i < nrvalues; i++) {
        updateLookup[i] = rep.getStepAttributeString(id_step, i, "value_name");
        updateStream[i] = rep.getStepAttributeString(id_step, i, "value_rename");
        update[i] = Boolean.valueOf(rep.getStepAttributeBoolean(id_step, i, "value_update", true));
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "InsertUpdateMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository"),
          e);
    }
  }
コード例 #12
0
  @Override
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      passAllRows = rep.getStepAttributeBoolean(id_step, "all_rows");
      aggregateIgnored = rep.getStepAttributeBoolean(id_step, "ignore_aggregate");
      aggregateIgnoredField = rep.getStepAttributeString(id_step, "field_ignore");
      directory = rep.getStepAttributeString(id_step, "directory");
      prefix = rep.getStepAttributeString(id_step, "prefix");
      addingLineNrInGroup = rep.getStepAttributeBoolean(id_step, "add_linenr");
      lineNrInGroupField = rep.getStepAttributeString(id_step, "linenr_fieldname");

      int groupsize = rep.countNrStepAttributes(id_step, "group_name");
      int nrvalues = rep.countNrStepAttributes(id_step, "aggregate_name");

      allocate(groupsize, nrvalues);

      for (int i = 0; i < groupsize; i++) {
        groupField[i] = rep.getStepAttributeString(id_step, i, "group_name");
      }

      boolean hasNumberOfValues = false;
      for (int i = 0; i < nrvalues; i++) {
        aggregateField[i] = rep.getStepAttributeString(id_step, i, "aggregate_name");
        subjectField[i] = rep.getStepAttributeString(id_step, i, "aggregate_subject");
        aggregateType[i] = getType(rep.getStepAttributeString(id_step, i, "aggregate_type"));

        if (aggregateType[i] == TYPE_GROUP_COUNT_ALL
            || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT
            || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
          hasNumberOfValues = true;
        }
        valueField[i] = rep.getStepAttributeString(id_step, i, "aggregate_value_field");
      }

      alwaysGivingBackOneRow =
          rep.getStepAttributeBoolean(id_step, 0, "give_back_row", hasNumberOfValues);
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "GroupByMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository"),
          e);
    }
  }
コード例 #13
0
 public void readRep(
     Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
     throws KettleException {
   int nrCalcs = rep.countNrStepAttributes(id_step, "field_name");
   allocate(nrCalcs);
   for (int i = 0; i < nrCalcs; i++) {
     calculation[i] = new CalculatorMetaFunction(rep, id_step, i);
   }
 }
コード例 #14
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);
      tablename = rep.getStepAttributeString(id_step, "table");
      fifoFileName = rep.getStepAttributeString(id_step, "fifo_file_name");
      sqlPath = rep.getStepAttributeString(id_step, "sql_path");
      encoding = rep.getStepAttributeString(id_step, "encoding");
      delimiter = rep.getStepAttributeString(id_step, "delimiter");
      continueOnError = rep.getStepAttributeBoolean(id_step, "continue_on_error");
      errorFileName = rep.getStepAttributeString(id_step, "error_file_name");
      useStandardConversion = rep.getStepAttributeBoolean(id_step, "use_standard_conversion");
      useAuthentication = rep.getStepAttributeBoolean(id_step, "use_authentication");
      useDynamicVNode = rep.getStepAttributeBoolean(id_step, "use_dynamic_vnode");
      useSSV = rep.getStepAttributeBoolean(id_step, "use_SSV_delimiter");
      escapingSpecialCharacters =
          rep.getStepAttributeBoolean(id_step, 0, "escape_special_characters", true);
      usingVwload = rep.getStepAttributeBoolean(id_step, "use_vwload");
      maxNrErrors = rep.getStepAttributeString(id_step, "max_errors");
      truncatingTable = rep.getStepAttributeBoolean(id_step, "truncate_table");
      bufferSize = rep.getStepAttributeString(id_step, "buffer_size");

      int nrCols = rep.countNrStepAttributes(id_step, "column_name");
      int nrStreams = rep.countNrStepAttributes(id_step, "stream_name");

      int nrRows = (nrCols < nrStreams ? nrStreams : nrCols);
      allocate(nrRows);

      for (int idx = 0; idx < nrRows; idx++) {
        fieldDatabase[idx] = Const.NVL(rep.getStepAttributeString(id_step, idx, "column_name"), "");
        fieldStream[idx] = Const.NVL(rep.getStepAttributeString(id_step, idx, "stream_name"), "");
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #15
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      encoding = rep.getStepAttributeString(id_step, "encoding"); // $NON-NLS-1$
      valueName = rep.getStepAttributeString(id_step, "valueName"); // $NON-NLS-1$
      rootNode = rep.getStepAttributeString(id_step, "xml_repeat_element"); // $NON-NLS-1$

      omitXMLheader = rep.getStepAttributeBoolean(id_step, "omitXMLheader"); // $NON-NLS-1$
      omitNullValues = rep.getStepAttributeBoolean(id_step, "omitNullValues"); // $NON-NLS-1$

      int nrfields = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        outputFields[i] = new XMLField();

        outputFields[i].setFieldName(
            rep.getStepAttributeString(id_step, i, "field_name")); // $NON-NLS-1$
        outputFields[i].setElementName(
            rep.getStepAttributeString(id_step, i, "field_element")); // $NON-NLS-1$
        outputFields[i].setType(
            rep.getStepAttributeString(id_step, i, "field_type")); // $NON-NLS-1$
        outputFields[i].setFormat(
            rep.getStepAttributeString(id_step, i, "field_format")); // $NON-NLS-1$
        outputFields[i].setCurrencySymbol(
            rep.getStepAttributeString(id_step, i, "field_currency")); // $NON-NLS-1$
        outputFields[i].setDecimalSymbol(
            rep.getStepAttributeString(id_step, i, "field_decimal")); // $NON-NLS-1$
        outputFields[i].setGroupingSymbol(
            rep.getStepAttributeString(id_step, i, "field_group")); // $NON-NLS-1$
        outputFields[i].setNullString(
            rep.getStepAttributeString(id_step, i, "field_nullif")); // $NON-NLS-1$
        outputFields[i].setLength(
            (int) rep.getStepAttributeInteger(id_step, i, "field_length")); // $NON-NLS-1$
        outputFields[i].setPrecision(
            (int) rep.getStepAttributeInteger(id_step, i, "field_precision")); // $NON-NLS-1$
        outputFields[i].setAttribute(
            rep.getStepAttributeBoolean(id_step, i, "field_attribute")); // $NON-NLS-1$
        outputFields[i].setAttributeParentName(
            rep.getStepAttributeString(id_step, i, "field_attributeName")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          "Unexpected error reading step information from the repository", e); // $NON-NLS-1$
    }
  }
コード例 #16
0
 public void readRep(
     Repository rep, IMetaStore metaStore, ObjectId stepId, List<DatabaseMeta> databases)
     throws KettleException {
   try {
     acceptingField = rep.getStepAttributeString(stepId, "accept_field");
     outputFields = new ArrayList<SasInputField>();
     int nrFields = rep.countNrStepAttributes(stepId, "field_name");
     for (int i = 0; i < nrFields; i++) {
       outputFields.add(new SasInputField(rep, stepId, i));
     }
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(
             PKG, "SASInputMeta.Exception.UnexpectedErrorReadingMetaDataFromRepository"),
         e);
   }
 }
コード例 #17
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      usevar = rep.getStepAttributeBoolean(id_step, "usevar");
      int nrfields = rep.countNrStepAttributes(id_step, "field_name");
      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name");
        replaceValue[i] = rep.getStepAttributeString(id_step, i, "replace_value");
        replaceMask[i] = rep.getStepAttributeString(id_step, i, "replace_mask");
        setEmptyString[i] = rep.getStepAttributeBoolean(id_step, i, "set_empty_string", false);
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #18
0
  public void readRep(
      Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      filename = rep.getStepAttributeString(id_step, "filename");
      filenameField = rep.getStepAttributeString(id_step, "filename_field");
      rowNumField = rep.getStepAttributeString(id_step, "rownum_field");
      includingFilename = rep.getStepAttributeBoolean(id_step, "include_filename");
      delimiter = rep.getStepAttributeString(id_step, "separator");
      enclosure = rep.getStepAttributeString(id_step, "enclosure");
      headerPresent = rep.getStepAttributeBoolean(id_step, "header");
      bufferSize = rep.getStepAttributeString(id_step, "buffer_size");
      lazyConversionActive = rep.getStepAttributeBoolean(id_step, "lazy_conversion");
      isaddresult = rep.getStepAttributeBoolean(id_step, "add_filename_result");
      runningInParallel = rep.getStepAttributeBoolean(id_step, "parallel");
      encoding = rep.getStepAttributeString(id_step, "encoding");

      int nrfields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        inputFields[i] = new TextFileInputField();

        inputFields[i].setName(rep.getStepAttributeString(id_step, i, "field_name"));
        inputFields[i].setType(
            ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_type")));
        inputFields[i].setFormat(rep.getStepAttributeString(id_step, i, "field_format"));
        inputFields[i].setCurrencySymbol(rep.getStepAttributeString(id_step, i, "field_currency"));
        inputFields[i].setDecimalSymbol(rep.getStepAttributeString(id_step, i, "field_decimal"));
        inputFields[i].setGroupSymbol(rep.getStepAttributeString(id_step, i, "field_group"));
        inputFields[i].setLength((int) rep.getStepAttributeInteger(id_step, i, "field_length"));
        inputFields[i].setPrecision(
            (int) rep.getStepAttributeInteger(id_step, i, "field_precision"));
        inputFields[i].setTrimType(
            ValueMeta.getTrimTypeByCode(rep.getStepAttributeString(id_step, i, "field_trim_type")));
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #19
0
  public void readRep(
      Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      long id_connection =
          rep.getStepAttributeInteger(id_step, "id_connection_read"); // $NON-NLS-1$
      databaseReadMeta = DatabaseMeta.findDatabase(databases, id_connection);
      id_connection = rep.getStepAttributeInteger(id_step, "id_connection_write"); // $NON-NLS-1$
      databaseWriteMeta = DatabaseMeta.findDatabase(databases, id_connection);

      schemaName = rep.getStepAttributeString(id_step, "schema"); // $NON-NLS-1$
      tablename = rep.getStepAttributeString(id_step, "table"); // $NON-NLS-1$
      commitSize = (int) rep.getStepAttributeInteger(id_step, "commit"); // $NON-NLS-1$
      cacheSize = (int) rep.getStepAttributeInteger(id_step, "cache_size"); // $NON-NLS-1$
      replaceFields = rep.getStepAttributeBoolean(id_step, "replace"); // $NON-NLS-1$
      useHash = rep.getStepAttributeBoolean(id_step, "crc"); // $NON-NLS-1$
      hashField = rep.getStepAttributeString(id_step, "crcfield"); // $NON-NLS-1$

      int nrkeys = rep.countNrStepAttributes(id_step, "lookup_key_name"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        keyField[i] = rep.getStepAttributeString(id_step, i, "lookup_key_name"); // $NON-NLS-1$
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "lookup_key_field"); // $NON-NLS-1$
      }

      technicalKeyField = rep.getStepAttributeString(id_step, "return_name"); // $NON-NLS-1$
      useAutoinc = rep.getStepAttributeBoolean(id_step, "use_autoinc"); // $NON-NLS-1$
      sequenceFrom = rep.getStepAttributeString(id_step, "sequence"); // $NON-NLS-1$
      techKeyCreation = rep.getStepAttributeString(id_step, "creation_method"); // $NON-NLS-1$
      lastUpdateField = rep.getStepAttributeString(id_step, "last_update_field"); // $NON-NLS-1$
    } catch (Exception e) {
      throw new KettleException(
          Messages.getString(
              "ConcurrentCombinationLookupMeta.Exception.UnexpectedErrorWhileReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #20
0
ファイル: AggregateRowsMeta.java プロジェクト: cnopens/BA
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {

    try {
      int nrfields = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name"); // $NON-NLS-1$
        fieldNewName[i] = rep.getStepAttributeString(id_step, i, "field_rename"); // $NON-NLS-1$
        aggregateType[i] =
            getType(rep.getStepAttributeString(id_step, i, "field_type")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "AggregateRowsMeta.Exception.UnexpectedErrorWhileReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #21
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    super.readRep(rep, metaStore, id_step, databases);
    try {
      setBatchSize(rep.getStepAttributeString(id_step, "batchSize"));
      setSalesforceIDFieldName(rep.getStepAttributeString(id_step, "salesforceIDFieldName"));
      int nrFields = rep.countNrStepAttributes(id_step, "field_name");
      allocate(nrFields);

      for (int i = 0; i < nrFields; i++) {
        updateLookup[i] = rep.getStepAttributeString(id_step, i, "field_name");
        updateStream[i] = rep.getStepAttributeString(id_step, i, "field_attribut");
        useExternalId[i] =
            Boolean.valueOf(rep.getStepAttributeBoolean(id_step, i, "field_useExternalId", false));
      }
      setRollbackAllChangesOnError(
          rep.getStepAttributeBoolean(id_step, "rollbackAllChangesOnError"));
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "SalesforceInsertMeta.Exception.ErrorReadingRepository"), e);
    }
  }
コード例 #22
0
ファイル: StringCutMeta.java プロジェクト: hoverzheng/kettle
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {

      int nrkeys = rep.countNrStepAttributes(id_step, "in_stream_name"); // $NON-NLS-1$

      allocate(nrkeys);
      for (int i = 0; i < nrkeys; i++) {
        fieldInStream[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "in_stream_name"), ""); // $NON-NLS-1$
        fieldOutStream[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "out_stream_name"), "");
        cutFrom[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "cut_from"), ""); // $NON-NLS-1$
        cutTo[i] = Const.NVL(rep.getStepAttributeString(id_step, i, "cut_to"), ""); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "StringCutMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #23
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);
      schemaName = rep.getStepAttributeString(id_step, "schema");
      tableName = rep.getStepAttributeString(id_step, "table");
      encoding = rep.getStepAttributeString(id_step, "encoding");
      enclosure = rep.getStepAttributeString(id_step, "enclosure");
      delimiter = rep.getStepAttributeString(id_step, "delimiter");
      escapeChar = rep.getStepAttributeString(id_step, "escape_char");
      fifoFileName = rep.getStepAttributeString(id_step, "fifo_file_name");
      replacingData = rep.getStepAttributeBoolean(id_step, "replace");
      ignoringErrors = rep.getStepAttributeBoolean(id_step, "ignore");
      localFile = rep.getStepAttributeBoolean(id_step, "local");
      bulkSize = rep.getStepAttributeString(id_step, "bulk_size");

      int nrvalues = rep.countNrStepAttributes(id_step, "stream_name");

      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        fieldTable[i] = rep.getStepAttributeString(id_step, i, "stream_name");
        fieldStream[i] = rep.getStepAttributeString(id_step, i, "field_name");
        if (fieldStream[i] == null) {
          fieldStream[i] = fieldTable[i];
        }
        fieldFormatType[i] =
            getFieldFormatType(rep.getStepAttributeString(id_step, i, "field_format_ok"));
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "MySQLBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository"),
          e);
    }
  }
コード例 #24
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      splitField = rep.getStepAttributeString(id_step, "splitfield"); // $NON-NLS-1$
      delimiter = rep.getStepAttributeString(id_step, "delimiter"); // $NON-NLS-1$

      int nrfields = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name"); // $NON-NLS-1$
        fieldID[i] = rep.getStepAttributeString(id_step, i, "field_id"); // $NON-NLS-1$
        fieldRemoveID[i] = rep.getStepAttributeBoolean(id_step, i, "field_idrem"); // $NON-NLS-1$
        fieldType[i] =
            ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_type")); // $NON-NLS-1$
        fieldFormat[i] = rep.getStepAttributeString(id_step, i, "field_format"); // $NON-NLS-1$
        fieldGroup[i] = rep.getStepAttributeString(id_step, i, "field_group"); // $NON-NLS-1$
        fieldDecimal[i] = rep.getStepAttributeString(id_step, i, "field_decimal"); // $NON-NLS-1$
        fieldLength[i] =
            (int) rep.getStepAttributeInteger(id_step, i, "field_length"); // $NON-NLS-1$
        fieldPrecision[i] =
            (int) rep.getStepAttributeInteger(id_step, i, "field_precision"); // $NON-NLS-1$
        fieldNullIf[i] = rep.getStepAttributeString(id_step, i, "field_nullif"); // $NON-NLS-1$
        fieldIfNull[i] = rep.getStepAttributeString(id_step, i, "field_ifnull"); // $NON-NLS-1$
        fieldTrimType[i] =
            ValueMeta.getTrimTypeByCode(
                rep.getStepAttributeString(id_step, i, "field_trimtype")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "FieldSplitterMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
コード例 #25
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);

      commitSize = rep.getStepAttributeString(id_step, "commit");
      if (commitSize == null) {
        long comSz = -1;
        try {
          comSz = rep.getStepAttributeInteger(id_step, "commit");
        } catch (Exception ex) {
          commitSize = "100";
        }
        if (comSz >= 0) {
          commitSize = Long.toString(comSz);
        }
      }
      schemaName = rep.getStepAttributeString(id_step, "schema");
      tableName = rep.getStepAttributeString(id_step, "table");

      int nrkeys = rep.countNrStepAttributes(id_step, "key_name");

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        keyStream[i] = rep.getStepAttributeString(id_step, i, "key_name");
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "key_field");
        keyCondition[i] = rep.getStepAttributeString(id_step, i, "key_condition");
        keyStream2[i] = rep.getStepAttributeString(id_step, i, "key_name2");
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "DeleteMeta.Exception.UnexpectedErrorInReadingStepInfo"), e);
    }
  }
コード例 #26
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      separator = rep.getStepAttributeString(id_step, "separator");
      enclosure = rep.getStepAttributeString(id_step, "enclosure");
      enclosureForced = rep.getStepAttributeBoolean(id_step, "enclosure_forced");
      disableEnclosureFix = rep.getStepAttributeBoolean(id_step, 0, "enclosure_fix_disabled", true);
      createparentfolder = rep.getStepAttributeBoolean(id_step, "create_parent_folder");
      headerEnabled = rep.getStepAttributeBoolean(id_step, "header");
      footerEnabled = rep.getStepAttributeBoolean(id_step, "footer");
      fileFormat = rep.getStepAttributeString(id_step, "format");
      fileCompression = rep.getStepAttributeString(id_step, "compression");
      fileNameInField = rep.getStepAttributeBoolean(id_step, "fileNameInField");
      fileNameField = rep.getStepAttributeString(id_step, "fileNameField");
      if (fileCompression == null) {
        if (rep.getStepAttributeBoolean(id_step, "zipped")) {
          fileCompression = fileCompressionTypeCodes[FILE_COMPRESSION_TYPE_ZIP];
        } else {
          fileCompression = fileCompressionTypeCodes[FILE_COMPRESSION_TYPE_NONE];
        }
      }
      encoding = rep.getStepAttributeString(id_step, "encoding");

      fileName = loadSourceRep(rep, id_step);
      fileAsCommand = rep.getStepAttributeBoolean(id_step, "file_is_command");
      servletOutput = rep.getStepAttributeBoolean(id_step, "file_servlet_output");
      doNotOpenNewFileInit = rep.getStepAttributeBoolean(id_step, "do_not_open_new_file_init");
      extension = rep.getStepAttributeString(id_step, "file_extention");
      fileAppended = rep.getStepAttributeBoolean(id_step, "file_append");
      splitEvery = (int) rep.getStepAttributeInteger(id_step, "file_split");
      stepNrInFilename = rep.getStepAttributeBoolean(id_step, "file_add_stepnr");
      partNrInFilename = rep.getStepAttributeBoolean(id_step, "file_add_partnr");
      dateInFilename = rep.getStepAttributeBoolean(id_step, "file_add_date");
      timeInFilename = rep.getStepAttributeBoolean(id_step, "file_add_time");
      specifyingFormat = rep.getStepAttributeBoolean(id_step, "SpecifyFormat");
      dateTimeFormat = rep.getStepAttributeString(id_step, "date_time_format");

      String AddToResultFiles = rep.getStepAttributeString(id_step, "add_to_result_filenames");
      if (Const.isEmpty(AddToResultFiles)) {
        addToResultFilenames = true;
      } else {
        addToResultFilenames = rep.getStepAttributeBoolean(id_step, "add_to_result_filenames");
      }

      padded = rep.getStepAttributeBoolean(id_step, "file_pad");
      fastDump = rep.getStepAttributeBoolean(id_step, "file_fast_dump");

      newline = getNewLine(fileFormat);

      int nrfields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        outputFields[i] = new TextFileField();

        outputFields[i].setName(rep.getStepAttributeString(id_step, i, "field_name"));
        outputFields[i].setType(rep.getStepAttributeString(id_step, i, "field_type"));
        outputFields[i].setFormat(rep.getStepAttributeString(id_step, i, "field_format"));
        outputFields[i].setCurrencySymbol(rep.getStepAttributeString(id_step, i, "field_currency"));
        outputFields[i].setDecimalSymbol(rep.getStepAttributeString(id_step, i, "field_decimal"));
        outputFields[i].setGroupingSymbol(rep.getStepAttributeString(id_step, i, "field_group"));
        outputFields[i].setTrimType(
            ValueMeta.getTrimTypeByCode(rep.getStepAttributeString(id_step, i, "field_trim_type")));
        outputFields[i].setNullString(rep.getStepAttributeString(id_step, i, "field_nullif"));
        outputFields[i].setLength((int) rep.getStepAttributeInteger(id_step, i, "field_length"));
        outputFields[i].setPrecision(
            (int) rep.getStepAttributeInteger(id_step, i, "field_precision"));
      }
      endedLine = rep.getStepAttributeString(id_step, "endedLine");

    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
コード例 #27
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {

      setIndex(rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_INDEX)));
      setType(rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_TYPE)));

      setBatchSize(
          rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_BATCH_SIZE)));
      setTimeOut(
          rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_TIMEOUT)));
      String timeoutStr =
          rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_TIMEOUT_UNIT));
      try {
        timeoutUnit = TimeUnit.valueOf(timeoutStr);
      } catch (Exception e) {
        timeoutUnit = DEFAULT_TIMEOUT_UNIT;
      }

      setJsonInsert(
          rep.getStepAttributeBoolean(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_IS_JSON)));
      setJsonField(
          (rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_JSON_FIELD))));

      setIdInField(
          (rep.getStepAttributeString(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_ID_IN_FIELD))));
      setOverWriteIfSameId(
          rep.getStepAttributeBoolean(
              id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_OVERWRITE_IF_EXISTS)));

      setIdOutField(
          (rep.getStepAttributeString(
              id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_ID_OUT_FIELD))));

      setUseOutput(
          rep.getStepAttributeBoolean(id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_USE_OUTPUT)));
      setStopOnError(
          rep.getStepAttributeBoolean(
              id_step, joinRepAttr(Dom.TAG_GENERAL, Dom.TAG_STOP_ON_ERROR)));

      // Fields
      clearFields();
      int fieldsNr = rep.countNrStepAttributes(id_step, joinRepAttr(Dom.TAG_FIELD, Dom.TAG_NAME));
      for (int i = 0; i < fieldsNr; i++) {
        String name =
            rep.getStepAttributeString(id_step, i, joinRepAttr(Dom.TAG_FIELD, Dom.TAG_NAME));
        String target =
            rep.getStepAttributeString(id_step, i, joinRepAttr(Dom.TAG_FIELD, Dom.TAG_TARGET));
        addField(name, target);
      }

      // Servers
      clearServers();
      int serversNr =
          rep.countNrStepAttributes(id_step, joinRepAttr(Dom.TAG_SERVER, Dom.TAG_SERVER_ADDRESS));
      for (int i = 0; i < serversNr; i++) {
        String addr =
            rep.getStepAttributeString(
                id_step, i, joinRepAttr(Dom.TAG_SERVER, Dom.TAG_SERVER_ADDRESS));
        int port =
            (int)
                rep.getStepAttributeInteger(
                    id_step, i, joinRepAttr(Dom.TAG_SERVER, Dom.TAG_SERVER_PORT));
        addServer(addr, port);
      }

      // Settings
      clearSettings();
      int settingsNr =
          rep.countNrStepAttributes(id_step, joinRepAttr(Dom.TAG_SETTING, Dom.TAG_SETTING_NAME));
      for (int i = 0; i < settingsNr; i++) {
        String name =
            rep.getStepAttributeString(
                id_step, i, joinRepAttr(Dom.TAG_SETTING, Dom.TAG_SETTING_NAME));
        String value =
            rep.getStepAttributeString(
                id_step, i, joinRepAttr(Dom.TAG_SETTING, Dom.TAG_SETTING_VALUE));
        addSetting(name, value);
      }

    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "ElasticSearchBulkMeta.Exception.ErrorReadingRepository"), e);
    }
  }
コード例 #28
0
ファイル: MappingMeta.java プロジェクト: cnopens/BA
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    String method = rep.getStepAttributeString(id_step, "specification_method");
    specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
    String transId = rep.getStepAttributeString(id_step, "trans_object_id");
    transObjectId = Const.isEmpty(transId) ? null : new StringObjectId(transId);
    transName = rep.getStepAttributeString(id_step, "trans_name"); // $NON-NLS-1$
    fileName = rep.getStepAttributeString(id_step, "filename"); // $NON-NLS-1$
    directoryPath = rep.getStepAttributeString(id_step, "directory_path"); // $NON-NLS-1$

    // Backward compatibility check for object specification
    //
    checkObjectLocationSpecificationMethod();
    inputMappings.clear();
    outputMappings.clear();

    int nrInput = rep.countNrStepAttributes(id_step, "input_field"); // $NON-NLS-1$
    int nrOutput = rep.countNrStepAttributes(id_step, "output_field"); // $NON-NLS-1$

    // Backward compatibility...
    //
    if (nrInput > 0 || nrOutput > 0) {
      MappingIODefinition inputMappingDefinition = new MappingIODefinition();
      inputMappingDefinition.setMainDataPath(true);

      for (int i = 0; i < nrInput; i++) {
        String inputField = rep.getStepAttributeString(id_step, i, "input_field"); // $NON-NLS-1$
        String inputMapping =
            rep.getStepAttributeString(id_step, i, "input_mapping"); // $NON-NLS-1$
        inputMappingDefinition
            .getValueRenames()
            .add(new MappingValueRename(inputField, inputMapping));
      }

      MappingIODefinition outputMappingDefinition = new MappingIODefinition();
      outputMappingDefinition.setMainDataPath(true);

      for (int i = 0; i < nrOutput; i++) {
        String outputField = rep.getStepAttributeString(id_step, i, "output_field"); // $NON-NLS-1$
        String outputMapping =
            rep.getStepAttributeString(id_step, i, "output_mapping"); // $NON-NLS-1$
        outputMappingDefinition
            .getValueRenames()
            .add(new MappingValueRename(outputMapping, outputField));
      }

      // Don't forget to add these to the input and output mapping
      // definitions...
      //
      inputMappings.add(inputMappingDefinition);
      outputMappings.add(outputMappingDefinition);

      // The default is to have no mapping parameters: the concept didn't exist
      // before.
      mappingParameters = new MappingParameters();
    } else {
      nrInput = rep.countNrStepAttributes(id_step, "input_main_path"); // $NON-NLS-1$
      nrOutput = rep.countNrStepAttributes(id_step, "output_main_path"); // $NON-NLS-1$

      for (int i = 0; i < nrInput; i++) {
        inputMappings.add(new MappingIODefinition(rep, id_step, "input_", i));
      }

      for (int i = 0; i < nrOutput; i++) {
        outputMappings.add(new MappingIODefinition(rep, id_step, "output_", i));
      }

      mappingParameters = new MappingParameters(rep, id_step);
    }

    allowingMultipleInputs =
        rep.getStepAttributeBoolean(id_step, 0, "allow_multiple_input", inputMappings.size() > 1);
    allowingMultipleOutputs =
        rep.getStepAttributeBoolean(id_step, 0, "allow_multiple_output", outputMappings.size() > 1);
  }
コード例 #29
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      fileType = rep.getStepAttributeString(id_step, "file_type");
      section = rep.getStepAttributeString(id_step, "section");
      encoding = rep.getStepAttributeString(id_step, "encoding");
      includeIniSection = rep.getStepAttributeBoolean(id_step, "ini_section");
      iniSectionField = rep.getStepAttributeString(id_step, "ini_section_field");
      includeFilename = rep.getStepAttributeBoolean(id_step, "include");
      filenameField = rep.getStepAttributeString(id_step, "include_field");
      dynamicFilenameField = rep.getStepAttributeString(id_step, "filename_Field");
      includeRowNumber = rep.getStepAttributeBoolean(id_step, "rownum");

      String addresult = rep.getStepAttributeString(id_step, "isaddresult");
      if (Utils.isEmpty(addresult)) {
        isaddresult = true;
      } else {
        isaddresult = rep.getStepAttributeBoolean(id_step, "isaddresult");
      }

      filefield = rep.getStepAttributeBoolean(id_step, "filefield");
      rowNumberField = rep.getStepAttributeString(id_step, "rownum_field");
      resetRowNumber = rep.getStepAttributeBoolean(id_step, "reset_rownumber");
      resolvevaluevariable = rep.getStepAttributeBoolean(id_step, "resolve_value_variable");

      rowLimit = rep.getStepAttributeInteger(id_step, "limit");
      int nrFiles = rep.countNrStepAttributes(id_step, "file_name");
      int nrFields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrFiles, nrFields);

      for (int i = 0; i < nrFiles; i++) {
        fileName[i] = rep.getStepAttributeString(id_step, i, "file_name");
        fileMask[i] = rep.getStepAttributeString(id_step, i, "file_mask");
        excludeFileMask[i] = rep.getStepAttributeString(id_step, i, "exclude_file_mask");
        fileRequired[i] = rep.getStepAttributeString(id_step, i, "file_required");
        if (!YES.equalsIgnoreCase(fileRequired[i])) {
          fileRequired[i] = RequiredFilesCode[0];
        }
        includeSubFolders[i] = rep.getStepAttributeString(id_step, i, "include_subfolders");
        if (!YES.equalsIgnoreCase(includeSubFolders[i])) {
          includeSubFolders[i] = RequiredFilesCode[0];
        }
      }

      for (int i = 0; i < nrFields; i++) {
        PropertyInputField field = new PropertyInputField();

        field.setName(rep.getStepAttributeString(id_step, i, "field_name"));
        field.setColumn(
            PropertyInputField.getColumnByCode(
                rep.getStepAttributeString(id_step, i, "field_column")));
        field.setType(
            ValueMetaFactory.getIdForValueMeta(
                rep.getStepAttributeString(id_step, i, "field_type")));
        field.setFormat(rep.getStepAttributeString(id_step, i, "field_format"));
        field.setCurrencySymbol(rep.getStepAttributeString(id_step, i, "field_currency"));
        field.setDecimalSymbol(rep.getStepAttributeString(id_step, i, "field_decimal"));
        field.setGroupSymbol(rep.getStepAttributeString(id_step, i, "field_group"));
        field.setLength((int) rep.getStepAttributeInteger(id_step, i, "field_length"));
        field.setPrecision((int) rep.getStepAttributeInteger(id_step, i, "field_precision"));
        field.setTrimType(
            PropertyInputField.getTrimTypeByCode(
                rep.getStepAttributeString(id_step, i, "field_trim_type")));
        field.setRepeated(rep.getStepAttributeBoolean(id_step, i, "field_repeat"));

        inputFields[i] = field;
      }
      shortFileFieldName = rep.getStepAttributeString(id_step, "shortFileFieldName");
      pathFieldName = rep.getStepAttributeString(id_step, "pathFieldName");
      hiddenFieldName = rep.getStepAttributeString(id_step, "hiddenFieldName");
      lastModificationTimeFieldName =
          rep.getStepAttributeString(id_step, "lastModificationTimeFieldName");
      uriNameFieldName = rep.getStepAttributeString(id_step, "uriNameFieldName");
      rootUriNameFieldName = rep.getStepAttributeString(id_step, "rootUriNameFieldName");
      extensionFieldName = rep.getStepAttributeString(id_step, "extensionFieldName");
      sizeFieldName = rep.getStepAttributeString(id_step, "sizeFieldName");
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "PropertyInputMeta.Exception.ErrorReadingRepository"), e);
    }
  }
コード例 #30
0
  @Override
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {

    ModelAnnotationGroup modelAnnotationGroup = new ModelAnnotationGroup();
    try {

      setModelAnnotationCategory(rep.getStepAttributeString(id_step, "CATEGORY_NAME"));
      setTargetOutputStep(rep.getStepAttributeString(id_step, "TARGET_OUTPUT_STEP"));

      int nrAnnotations = rep.countNrStepAttributes(id_step, "ANNOTATION_NAME");

      // Read annotations
      for (int i = 0; i < nrAnnotations; i++) {
        String annotationName = rep.getStepAttributeString(id_step, i, "ANNOTATION_NAME");
        String annotationFieldName =
            rep.getStepAttributeString(id_step, i, "ANNOTATION_FIELD_NAME");
        String annotationType = rep.getStepAttributeString(id_step, i, "ANNOTATION_TYPE");

        // Create model annotation
        ModelAnnotation<?> modelAnnotation =
            ModelAnnotationGroupXmlReader.create(annotationType, annotationFieldName);
        if (StringUtils.isNotBlank(annotationName)) {
          modelAnnotation.setName(annotationName);
        }

        if (StringUtils.isNotBlank(annotationType)) {
          // Populate annotation properties
          Map<String, Serializable> map = new HashMap<String, Serializable>();
          for (String key : modelAnnotation.getAnnotation().getModelPropertyIds()) {
            try {
              String value = rep.getStepAttributeString(id_step, i, "PROPERTY_VALUE_" + key);
              if (StringUtils.isNotBlank(value)) {
                map.put(key, value);
              }
            } catch (KettleException ke) {
              // Ignore - not found
            }
          }
          modelAnnotation.populateAnnotation(map);
        }

        // Add to group
        modelAnnotationGroup.add(modelAnnotation);
      }

      modelAnnotationGroup.setSharedDimension(
          BooleanUtils.toBoolean(rep.getStepAttributeString(id_step, "SHARED_DIMENSION")));
      sharedDimension = modelAnnotationGroup.isSharedDimension();
      modelAnnotationGroup.setDescription(rep.getStepAttributeString(id_step, "DESCRIPTION"));

      List<DataProvider> dataProviders = new ArrayList<DataProvider>();
      int nrDataProviders = rep.countNrStepAttributes(id_step, "DP_NAME");
      for (int i = 0; i < nrDataProviders; i++) {

        DataProvider dataProvider = new DataProvider();

        dataProvider.setName(rep.getStepAttributeString(id_step, i, "DP_NAME"));
        dataProvider.setSchemaName(rep.getStepAttributeString(id_step, i, "DP_SCHEMA_NAME"));
        dataProvider.setTableName(rep.getStepAttributeString(id_step, i, "DP_TABLE_NAME"));
        dataProvider.setDatabaseMetaNameRef(
            rep.getStepAttributeString(id_step, i, "DP_DATABASE_META_NAME_REF"));

        List<ColumnMapping> columnMappings = new ArrayList<ColumnMapping>();
        long nrColumnMappings =
            rep.getStepAttributeString(id_step, "CM_COUNT_" + i) != null
                ? Long.valueOf(rep.getStepAttributeString(id_step, "CM_COUNT_" + i))
                : 0;
        for (int j = 0; j < nrColumnMappings; j++) {

          ColumnMapping columnMapping = new ColumnMapping();

          columnMapping.setName(rep.getStepAttributeString(id_step, i, "CM_NAME_" + j));
          columnMapping.setColumnName(
              rep.getStepAttributeString(id_step, i, "CM_COLUMN_NAME_" + j));
          String dataType = rep.getStepAttributeString(id_step, i, "CM_DATA_TYPE_" + j);
          if (StringUtils.isNotBlank(dataType)) {
            columnMapping.setColumnDataType(DataType.valueOf(dataType));
          }

          columnMappings.add(columnMapping);
        }

        dataProvider.setColumnMappings(columnMappings);
        dataProviders.add(dataProvider);
      }
      modelAnnotationGroup.setDataProviders(dataProviders);

    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(
              PKG, "ModelAnnotationMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository"),
          e);
    }

    setModelAnnotations(modelAnnotationGroup);

    // This may override the loaded model annotation group
    if (StringUtils.isNotBlank(getModelAnnotationCategory())) {
      readDataFromMetaStore(metaStore);
    }
  }