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$
    }
  }
  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$
    }
  }
  public CalculatorMetaFunction(Repository rep, long id_step, int nr) throws KettleException {
    fieldName = rep.getStepAttributeString(id_step, nr, "field_name");
    calcType = getCalcFunctionType(rep.getStepAttributeString(id_step, nr, "calc_type"));
    fieldA = rep.getStepAttributeString(id_step, nr, "field_a");
    fieldB = rep.getStepAttributeString(id_step, nr, "field_b");
    fieldC = rep.getStepAttributeString(id_step, nr, "field_c");
    fieldD = rep.getStepAttributeString(id_step, nr, "field_d");
    fieldE = rep.getStepAttributeString(id_step, nr, "field_e");
    valueType = ValueMeta.getType(rep.getStepAttributeString(id_step, nr, "value_type"));
    valueLength = (int) rep.getStepAttributeInteger(id_step, nr, "value_length");
    valuePrecision = (int) rep.getStepAttributeInteger(id_step, nr, "value_precision");
    removedFromResult = rep.getStepAttributeBoolean(id_step, nr, "remove");
    conversionMask = rep.getStepAttributeString(id_step, nr, "conversion_mask");
    decimalSymbol = rep.getStepAttributeString(id_step, nr, "decimal_symbol");
    groupingSymbol = rep.getStepAttributeString(id_step, nr, "grouping_symbol");
    currencySymbol = rep.getStepAttributeString(id_step, nr, "currency_symbol");

    // Fix 2.x backward compatibility
    // The conversion mask was added in a certain revision.
    // Anything that we load from before then should get masks set to retain backward compatibility
    //
    if (rep.findStepAttributeID(id_step, nr, "conversion_mask") < 0) {
      fixBackwardCompatibility();
    }
  }
示例#4
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");

      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);
    }
  }
  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$
    }
  }
  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);
    }
  }
  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$
    }
  }
  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 = (int) rep.getStepAttributeInteger(id_step, "commit");
      sqlField = rep.getStepAttributeString(id_step, "sql_field");

      insertField = rep.getStepAttributeString(id_step, "insert_field");
      updateField = rep.getStepAttributeString(id_step, "update_field");
      deleteField = rep.getStepAttributeString(id_step, "delete_field");
      readField = rep.getStepAttributeString(id_step, "read_field");
      sqlFromfile = rep.getStepAttributeBoolean(id_step, "sqlFromfile");

      String sendOneStatementString = rep.getStepAttributeString(id_step, "sendOneStatement");
      if (Const.isEmpty(sendOneStatementString)) {
        sendOneStatement = true;
      } else {
        sendOneStatement = rep.getStepAttributeBoolean(id_step, "sendOneStatement");
      }

    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "ExecSQLRowMeta.Exception.UnexpectedErrorReadingStepInfo"),
          e);
    }
  }
  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
  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$
    }
  }
  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);
    }
  }
  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$
    }
  }
示例#13
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$
    }
  }
示例#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);

      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);
    }
  }
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      filename = rep.getStepAttributeString(id_step, "filename");
      tablename = rep.getStepAttributeString(id_step, "table");
      tableTruncated = rep.getStepAttributeBoolean(id_step, "truncate");
      fileCreated = rep.getStepAttributeBoolean(id_step, "create_file");
      tableCreated = rep.getStepAttributeBoolean(id_step, "create_table");
      commitSize = (int) rep.getStepAttributeInteger(id_step, "commit_size");
      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");
      }
      doNotOpeNnewFileInit = rep.getStepAttributeBoolean(id_step, "do_not_open_newfile_init");

    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
示例#16
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);
    }
  }
  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);
    }
  }
  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);
    }
  }
  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);
    }
  }