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$
    }
  }
  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);
    }
  }
  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);
    }
  }
Example #4
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); // $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);
    }
  }
  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 {
      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);
    }
  }
  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);
    }
  }
Example #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);

      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);
    }
  }