コード例 #1
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$
    }
  }
コード例 #2
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 = (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);
    }
  }
コード例 #3
0
 public void readRep(
     Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
     throws KettleException {
   hostname = rep.getStepAttributeString(id_step, "hostname");
   port = rep.getStepAttributeString(id_step, "port");
   bufferSize = rep.getStepAttributeString(id_step, "buffer_size");
   compressed = rep.getStepAttributeBoolean(id_step, "compressed");
 }
コード例 #4
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);
    }
  }
コード例 #5
0
  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();
    }
  }
コード例 #6
0
 public void readRep(
     Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
     throws KettleException {
   try {
     valuename = rep.getStepAttributeString(id_step, "valuename");
     slaveServerName = rep.getStepAttributeString(id_step, "slave");
     sequenceName = rep.getStepAttributeString(id_step, "seqname");
     increment = rep.getStepAttributeString(id_step, "increment");
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(PKG, "GetSequenceMeta.Exception.UnableToReadStepInfo") + id_step,
         e);
   }
 }
コード例 #7
0
 public void readRep(
     Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
     throws KettleException {
   try {
     urlField = rep.getStepAttributeString(id_step, "urlField");
     connectTimeOut = rep.getStepAttributeString(id_step, "connectTimeOut");
     readTimeOut = rep.getStepAttributeString(id_step, "readTimeOut");
     resultfieldname = rep.getStepAttributeString(id_step, "resultfieldname");
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(
             PKG, "WebServiceAvailableMeta.Exception.UnexpectedErrorReadingStepInfo"),
         e);
   }
 }
コード例 #8
0
  public static ColumnFilter getFilter(Repository rep, int nodeNum, ObjectId id_step)
      throws KettleException {
    String alias = rep.getStepAttributeString(id_step, nodeNum, "cf_alias");

    ColumnFilter returnVal = new ColumnFilter(alias);
    String type = rep.getStepAttributeString(id_step, nodeNum, "cf_type");
    returnVal.setFieldType(type);
    String comp = rep.getStepAttributeString(id_step, nodeNum, "cf_comparison_opp");
    returnVal.setComparisonOperator(stringToOpp(comp));
    returnVal.setSignedComparison(rep.getStepAttributeBoolean(id_step, nodeNum, "cf_signed_comp"));
    String constant = rep.getStepAttributeString(id_step, nodeNum, "cf_constant");
    returnVal.setConstant(constant);
    String format = rep.getStepAttributeString(id_step, nodeNum, "cf_format");
    returnVal.setFormat(format);

    return returnVal;
  }
コード例 #9
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);
    }
  }
コード例 #10
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);
    }
  }
コード例 #11
0
 public void readRep(
     Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
     throws KettleException {
   try {
     splitField = rep.getStepAttributeString(id_step, "splitfield");
     delimiter = rep.getStepAttributeString(id_step, "delimiter");
     newFieldname = rep.getStepAttributeString(id_step, "newfield");
     includeRowNumber = rep.getStepAttributeBoolean(id_step, "rownum");
     rowNumberField = rep.getStepAttributeString(id_step, "rownum_field");
     resetRowNumber = rep.getStepAttributeBoolean(id_step, "reset_rownumber");
     isDelimiterRegex = rep.getStepAttributeBoolean(id_step, 0, "delimiter_is_regex", false);
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(
             PKG, "SplitFieldToRowsMeta.Exception.UnexpectedErrorInReadingStepInfo"),
         e);
   }
 }
コード例 #12
0
  public void loadRep(
      Repository rep,
      ObjectId id_jobentry,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers)
      throws KettleException {
    try {

      recordsetName = rep.getStepAttributeString(id_jobentry, "recordset_name");
      recordset = rep.getStepAttributeString(id_jobentry, "recordset");
      breakCriteria = rep.getStepAttributeString(id_jobentry, "breakCriteria");
      this.setIsAllString(rep.getStepAttributeString(id_jobentry, "isAll"));
      this.setRunLocalString(rep.getStepAttributeString(id_jobentry, "runLocal"));

    } catch (Exception e) {
      throw new KettleException("Unexpected Exception", e);
    }
  }
コード例 #13
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);
    }
  }
コード例 #14
0
  // Rogers (2012): Carregar campos a partir do repositorio
  @SuppressWarnings("unchecked")
  @Override
  public void readRep(
      Repository repository,
      ObjectId stepIdInRepository,
      List<DatabaseMeta> databases,
      Map<String, Counter> sequenceCounters)
      throws KettleException {

    endpointUri = repository.getStepAttributeString(stepIdInRepository, Field.ENDPOINT_URI.name());
    defaultGraph =
        repository.getStepAttributeString(stepIdInRepository, Field.DEFAULT_GRAPH.name());
    queryString = repository.getStepAttributeString(stepIdInRepository, Field.QUERY_STRING.name());
    prefixes =
        (List<List<String>>)
            new XStream()
                .fromXML(
                    repository.getStepAttributeString(stepIdInRepository, Field.PREFIXES.name()));
    varResult = repository.getStepAttributeString(stepIdInRepository, Field.VAR_RESULT.name());
  }
コード例 #15
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      ruleFilename = rep.getStepAttributeString(id_step, "rule_file_name");
      stepMain = rep.getStepAttributeString(id_step, "rule_step_main");
      stepRuleResults = rep.getStepAttributeString(id_step, "rule_step_rule_results");
      outputType = Integer.parseInt(rep.getStepAttributeString(id_step, "output_type"));

    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          "error reading rule engine step with id_step=" + id_step + " from the repository", dbe);
    } catch (Exception e) {
      throw new KettleException(
          "Unexpected error reading rule engine step with id_step="
              + id_step
              + " 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 = 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);
    }
  }
コード例 #17
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);
    }
  }
コード例 #18
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$
    }
  }
コード例 #19
0
  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);
    }
  }
コード例 #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
ファイル: AppendMeta.java プロジェクト: MarsChan/learngit
 public void readRep(
     Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
     throws KettleException {
   try {
     List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
     StreamInterface headStream = infoStreams.get(0);
     StreamInterface tailStream = infoStreams.get(1);
     headStream.setSubject(rep.getStepAttributeString(id_step, "head_name"));
     tailStream.setSubject(rep.getStepAttributeString(id_step, "tail_name"));
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(PKG, "AppendMeta.Exception.UnexpectedErrorReadingStepInfo"), e);
   }
 }
コード例 #24
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);
    }
  }
コード例 #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);
      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);
    }
  }
コード例 #26
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$
    }
  }
コード例 #27
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$
    }
  }
コード例 #28
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);
   }
 }
コード例 #29
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {

    m_zookeeperHosts = rep.getStepAttributeString(id_step, 0, "zookeeper_hosts");
    m_zookeeperPort = rep.getStepAttributeString(id_step, 0, "zookeeper_port");
    m_coreConfigURL = rep.getStepAttributeString(id_step, 0, "core_config_url");
    m_defaultConfigURL = rep.getStepAttributeString(id_step, 0, "default_config_url");
    m_targetTableName = rep.getStepAttributeString(id_step, 0, "target_table_name");
    m_targetMappingName = rep.getStepAttributeString(id_step, 0, "target_mapping_name");
    m_writeBufferSize = rep.getStepAttributeString(id_step, 0, "write_buffer_size");
    m_disableWriteToWAL = rep.getStepAttributeBoolean(id_step, 0, "disable_wal");

    Mapping tempMapping = new Mapping();
    if (tempMapping.readRep(rep, id_step)) {
      m_mapping = tempMapping;
    } else {
      m_mapping = null;
    }
  }
コード例 #30
0
  public void loadRep(
      Repository rep,
      ObjectId id_jobentry,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers)
      throws KettleException {
    try {
      if (rep.getStepAttributeString(id_jobentry, "fields") != null)
        fields = rep.getStepAttributeString(id_jobentry, "fields"); // $NON-NLS-1$
      if (rep.getStepAttributeString(id_jobentry, "datasetName") != null)
        datasetName = rep.getStepAttributeString(id_jobentry, "datasetName"); // $NON-NLS-1$
      if (rep.getStepAttributeString(id_jobentry, "recordset_name") != null)
        recordsetName = rep.getStepAttributeString(id_jobentry, "recordset_name"); // $NON-NLS-1$
      // recordName = rep.getStepAttributeString(id_jobentry, "recordName"); //$NON-NLS-1$
      // recordDef = rep.getStepAttributeString(id_jobentry, "recordDef"); //$NON-NLS-1$

    } catch (Exception e) {
      throw new KettleException("Unexpected Exception", e);
    }
  }