Java Code Examples for org.pentaho.di.repository.Repository#loadDatabaseMetaFromStepAttribute()

The following examples show how to use org.pentaho.di.repository.Repository#loadDatabaseMetaFromStepAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PaloCellInputMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute( idStep, "connection", databases );
    this.cube = rep.getStepAttributeString( idStep, "cube" );
    String cubeMeasureName = rep.getStepAttributeString( idStep, "cubemeasurename" );
    String cubeMeasureType = rep.getStepAttributeString( idStep, "cubemeasuretype" );
    this.cubeMeasure = new DimensionField( "Measure", cubeMeasureName, cubeMeasureType );

    int nrFields = rep.countNrStepAttributes( idStep, "dimensionname" );

    for ( int i = 0; i < nrFields; i++ ) {
      String dimensionName = rep.getStepAttributeString( idStep, i, "dimensionname" );
      String fieldName = rep.getStepAttributeString( idStep, i, "fieldname" );
      String fieldType = rep.getStepAttributeString( idStep, i, "fieldtype" );
      this.fields.add( new DimensionField( dimensionName, fieldName, fieldType ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step" + " information from the repository", e );
  }
}
 
Example 2
Source File: ExecSQLMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    executedEachInputRow = rep.getStepAttributeBoolean( id_step, "execute_each_row" );
    singleStatement = rep.getStepAttributeBoolean( id_step, "single_statement" );
    replaceVariables = rep.getStepAttributeBoolean( id_step, "replace_variables" );
    quoteString = rep.getStepAttributeBoolean( id_step, "quoteString" );
    sql = rep.getStepAttributeString( id_step, "sql" );
    setParams = rep.getStepAttributeBoolean( id_step, "set_params" );
    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" );

    int nrargs = rep.countNrStepAttributes( id_step, "arg_name" );
    allocate( nrargs );

    for ( int i = 0; i < nrargs; i++ ) {
      arguments[i] = rep.getStepAttributeString( id_step, i, "arg_name" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "ExecSQLMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 3
Source File: DBProcMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    database = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    procedure = rep.getStepAttributeString( id_step, "procedure" );

    int nrargs = rep.countNrStepAttributes( id_step, "arg_name" );
    allocate( nrargs );

    for ( int i = 0; i < nrargs; i++ ) {
      argument[i] = rep.getStepAttributeString( id_step, i, "arg_name" );
      argumentDirection[i] = rep.getStepAttributeString( id_step, i, "arg_direction" );
      argumentType[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "arg_type" ) );
    }

    resultName = rep.getStepAttributeString( id_step, "result_name" );
    resultType = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, "result_type" ) );
    autoCommit = rep.getStepAttributeBoolean( id_step, 0, "auto_commit", true );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "DBProcMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 4
Source File: PGBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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" );
    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 );
  }
}
 
Example 5
Source File: DatabaseJoinMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    rowLimit = (int) rep.getStepAttributeInteger( id_step, "rowlimit" );
    sql = rep.getStepAttributeString( id_step, "sql" );
    outerJoin = rep.getStepAttributeBoolean( id_step, "outer_join" );
    replacevars = rep.getStepAttributeBoolean( id_step, "replace_vars" );

    int nrparam = rep.countNrStepAttributes( id_step, "parameter_field" );

    allocate( nrparam );

    for ( int i = 0; i < nrparam; i++ ) {
      parameterField[i] = rep.getStepAttributeString( id_step, i, "parameter_field" );
      String stype = rep.getStepAttributeString( id_step, i, "parameter_type" );
      parameterType[i] = ValueMetaFactory.getIdForValueMeta( stype );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "DatabaseJoinMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 6
Source File: OpenERPObjectInputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute( idStep, "connection", databases );
    this.modelName = rep.getStepAttributeString( idStep, "modelName" );
    this.readBatchSize = Integer.parseInt( rep.getStepAttributeString( idStep, "readBatchSize" ) );

    int nrMappings = rep.countNrStepAttributes( idStep, "source_model" );

    for ( int i = 0; i < nrMappings; i++ ) {
      FieldMapping map = new FieldMapping();

      map.source_model = rep.getStepAttributeString( idStep, i, "source_model" );
      map.source_field = rep.getStepAttributeString( idStep, i, "source_field" );
      map.source_index = Integer.valueOf( rep.getStepAttributeString( idStep, i, "source_index" ) );
      map.target_model = rep.getStepAttributeString( idStep, i, "target_model" );
      map.target_field = rep.getStepAttributeString( idStep, i, "target_field" );
      map.target_field_label = rep.getStepAttributeString( idStep, i, "target_field_label" );
      map.target_field_type = Integer.valueOf( rep.getStepAttributeString( idStep, i, "target_field_type" ) );

      this.getMappings().add( map );
    }

    int nrFilters = rep.countNrStepAttributes( idStep, "field_name" );
    for ( int i = 0; i < nrFilters; i++ ) {
      ReadFilter filter = new ReadFilter();

      filter.setOperator( rep.getStepAttributeString( idStep, i, "operator" ) );
      filter.setFieldName( rep.getStepAttributeString( idStep, i, "field_name" ) );
      filter.setComparator( rep.getStepAttributeString( idStep, i, "comparator" ) );
      filter.setValue( rep.getStepAttributeString( idStep, i, "value" ) );

      this.getFilterList().add( filter );
    }

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 7
Source File: TableOutputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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" );
    commitSize = rep.getStepAttributeString( id_step, "commit" );
    truncateTable = rep.getStepAttributeBoolean( id_step, "truncate" );
    ignoreErrors = rep.getStepAttributeBoolean( id_step, "ignore_errors" );
    useBatchUpdate = rep.getStepAttributeBoolean( id_step, "use_batch" );
    specifyFields = rep.getStepAttributeBoolean( id_step, "specify_fields" );

    partitioningEnabled = rep.getStepAttributeBoolean( id_step, "partitioning_enabled" );
    partitioningField = rep.getStepAttributeString( id_step, "partitioning_field" );
    partitioningDaily = rep.getStepAttributeBoolean( id_step, "partitioning_daily" );
    partitioningMonthly = rep.getStepAttributeBoolean( id_step, "partitioning_monthly" );

    tableNameInField = rep.getStepAttributeBoolean( id_step, "tablename_in_field" );
    tableNameField = rep.getStepAttributeString( id_step, "tablename_field" );
    tableNameInTable = rep.getStepAttributeBoolean( id_step, "tablename_in_table" );

    returningGeneratedKeys = rep.getStepAttributeBoolean( id_step, "return_keys" );
    generatedKeyField = rep.getStepAttributeString( id_step, "return_field" );

    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 );
  }
}
 
Example 8
Source File: SQLFileOutputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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" );
    truncateTable = rep.getStepAttributeBoolean( id_step, "truncate" );
    createTable = rep.getStepAttributeBoolean( id_step, "create" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    dateformat = rep.getStepAttributeString( id_step, "dateformat" );
    AddToResult = rep.getStepAttributeBoolean( id_step, "addtoresult" );
    StartNewLine = rep.getStepAttributeBoolean( id_step, "startnewline" );

    fileName = rep.getStepAttributeString( id_step, "file_name" );
    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" );
    createparentfolder = rep.getStepAttributeBoolean( id_step, "create_parent_folder" );
    DoNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "DoNotOpenNewFileInit" );

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 9
Source File: DeleteMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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 );
  }
}
 
Example 10
Source File: MySQLBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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 11
Source File: TableCompareMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {

    referenceConnection = rep.loadDatabaseMetaFromStepAttribute( id_step, "reference_connection_id", databases );
    referenceSchemaField = rep.getStepAttributeString( id_step, "reference_schema_field" );
    referenceTableField = rep.getStepAttributeString( id_step, "reference_table_field" );

    compareConnection = rep.loadDatabaseMetaFromStepAttribute( id_step, "compare_connection_id", databases );
    compareSchemaField = rep.getStepAttributeString( id_step, "compare_schema_field" );
    compareTableField = rep.getStepAttributeString( id_step, "compare_table_field" );

    keyFieldsField = rep.getStepAttributeString( id_step, "key_fields_field" );
    excludeFieldsField = rep.getStepAttributeString( id_step, "exclude_fields_field" );
    nrErrorsField = rep.getStepAttributeString( id_step, "nr_errors_field" );

    nrRecordsReferenceField = rep.getStepAttributeString( id_step, "nr_records_reference_field" );
    nrRecordsCompareField = rep.getStepAttributeString( id_step, "nr_records_compare_field" );
    nrErrorsLeftJoinField = rep.getStepAttributeString( id_step, "nr_errors_left_join_field" );
    nrErrorsInnerJoinField = rep.getStepAttributeString( id_step, "nr_errors_inner_join_field" );
    nrErrorsRightJoinField = rep.getStepAttributeString( id_step, "nr_errors_right_join_field" );

    keyDescriptionField = rep.getStepAttributeString( id_step, "key_description_field" );
    valueReferenceField = rep.getStepAttributeString( id_step, "value_reference_field" );
    valueCompareField = rep.getStepAttributeString( id_step, "value_compare_field" );
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 12
Source File: LucidDBBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    maxErrors = (int) rep.getStepAttributeInteger( id_step, "errors" );
    bufferSize = rep.getStepAttributeString( id_step, "buffer_size" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    fifoDirectory = rep.getStepAttributeString( id_step, "fifo_directory" );
    fifoServerName = rep.getStepAttributeString( id_step, "fifo_server_name" );

    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];
      }
      fieldFormatOk[i] = rep.getStepAttributeBoolean( id_step, i, "field_format_ok" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "LucidDBBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 13
Source File: PaloDimOutputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute( idStep, "connection", databases );
    this.dimension = rep.getStepAttributeString( idStep, "dimension" );
    this.elementType = rep.getStepAttributeString( idStep, "elementtype" );
    this.createNewDimension = rep.getStepAttributeBoolean( idStep, "createdimension" );
    this.clearDimension = rep.getStepAttributeBoolean( idStep, "cleardimension" );
    this.clearConsolidations = rep.getStepAttributeBoolean( idStep, "clearconsolidations" );
    this.recreateDimension = rep.getStepAttributeBoolean( idStep, "recreatedimension" );
    this.enableElementCache = rep.getStepAttributeBoolean( idStep, "enableElementCache" );
    this.preloadElementCache = rep.getStepAttributeBoolean( idStep, "preloadElementCache" );

    int nrLevels = rep.countNrStepAttributes( idStep, "levelname" );

    for ( int i = 0; i < nrLevels; i++ ) {
      String levelName = rep.getStepAttributeString( idStep, i, "levelname" );
      int levelNumber = (int) rep.getStepAttributeInteger( idStep, i, "levelnumber" );
      String fieldName = rep.getStepAttributeString( idStep, i, "fieldname" );
      String fieldType = rep.getStepAttributeString( idStep, i, "fieldtype" );
      String consolidationField = rep.getStepAttributeString( idStep, i, "consolidationfieldname" );
      this.levels.add( new PaloDimensionLevel( levelName, levelNumber, fieldName, fieldType, consolidationField ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 14
Source File: TableInputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  this.databases = databases;
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );

    sql = rep.getStepAttributeString( id_step, "sql" );
    rowLimit = rep.getStepAttributeString( id_step, "limit" );
    if ( rowLimit == null ) {
      rowLimit = Long.toString( rep.getStepAttributeInteger( id_step, "limit" ) );
    }

    String lookupFromStepname = rep.getStepAttributeString( id_step, "lookup" );
    StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
    infoStream.setSubject( lookupFromStepname );

    executeEachInputRow = rep.getStepAttributeBoolean( id_step, "execute_each_row" );
    variableReplacementActive = rep.getStepAttributeBoolean( id_step, "variables_active" );
    lazyConversionActive = rep.getStepAttributeBoolean( id_step, "lazy_conversion_active" );
    cachedRowMetaActive = rep.getStepAttributeBoolean( id_step, "cached_row_meta_active" );

    String sRowMeta = rep.getStepAttributeString( id_step, RowMeta.XML_META_TAG );
    if ( sRowMeta != null ) {
      Node node = XmlParserFactoryProducer.createSecureDocBuilderFactory()
        .newDocumentBuilder()
        .parse( new ByteArrayInputStream( sRowMeta.getBytes() ) )
        .getDocumentElement();
      cachedRowMeta = new RowMeta( node );
    }

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 15
Source File: MondrianInputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );

    sql = rep.getStepAttributeString( id_step, "sql" );
    catalog = rep.getStepAttributeString( id_step, "catalog" );
    role = rep.getStepAttributeString( id_step, "role" );
    variableReplacementActive = rep.getStepAttributeBoolean( id_step, "variables_active" );
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 16
Source File: ColumnExistsMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    database = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    tablename = rep.getStepAttributeString( id_step, "tablename" );
    schemaname = rep.getStepAttributeString( id_step, "schemaname" );
    istablenameInfield = rep.getStepAttributeBoolean( id_step, "istablenameInfield" );
    tablenamefield = rep.getStepAttributeString( id_step, "tablenamefield" );
    columnnamefield = rep.getStepAttributeString( id_step, "columnnamefield" );
    resultfieldname = rep.getStepAttributeString( id_step, "resultfieldname" );
  } catch ( Exception e ) {
    throw new KettleException(
        BaseMessages.getString( PKG, "ColumnExistsMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 17
Source File: DynamicSQLRowMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    rowLimit = (int) rep.getStepAttributeInteger( id_step, "rowlimit" );
    sql = rep.getStepAttributeString( id_step, "sql" );
    outerJoin = rep.getStepAttributeBoolean( id_step, "outer_join" );
    replacevars = rep.getStepAttributeBoolean( id_step, "replace_vars" );
    sqlfieldname = rep.getStepAttributeString( id_step, "sql_fieldname" );
    queryonlyonchange = rep.getStepAttributeBoolean( id_step, "query_only_on_change" );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "DynamicSQLRowMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 18
Source File: UpdateMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  this.databases = databases;
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    skipLookup = rep.getStepAttributeBoolean( id_step, "skip_lookup" );
    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 );
      }
    }
    useBatchUpdate = rep.getStepAttributeBoolean( id_step, "use_batch" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );

    errorIgnored = rep.getStepAttributeBoolean( id_step, "error_ignored" );
    ignoreFlagField = rep.getStepAttributeString( id_step, "ignore_flag_field" );

    int nrKeyName = rep.countNrStepAttributes( id_step, "key_name" );
    int nrKeyField = rep.countNrStepAttributes( id_step, "key_field" );
    int nrKeyCondition = rep.countNrStepAttributes( id_step, "key_condition" );
    int nrKeyName2 = rep.countNrStepAttributes( id_step, "key_name2" );

    int nrkeys = Ints.max( nrKeyName, nrKeyCondition, nrKeyField, nrKeyName2 );

    int nrValueName = rep.countNrStepAttributes( id_step, "value_name" );
    int nrValueRename = rep.countNrStepAttributes( id_step, "value_rename" );

    int nrvalues = Ints.max( nrValueName, nrValueRename );

    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" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "UpdateMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 19
Source File: GPLoadMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    maxErrors = rep.getStepAttributeString( id_step, "errors" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );
    errorTableName = rep.getStepAttributeString( id_step, "error_table" );
    loadMethod = rep.getStepAttributeString( id_step, "load_method" );
    loadAction = rep.getStepAttributeString( id_step, "load_action" );
    gploadPath = rep.getStepAttributeString( id_step, "gpload_path" );
    controlFile = rep.getStepAttributeString( id_step, "control_file" );
    dataFile = rep.getStepAttributeString( id_step, "data_file" );
    delimiter = rep.getStepAttributeString( id_step, "delimiter" );
    logFile = rep.getStepAttributeString( id_step, "log_file" );
    nullAs = rep.getStepAttributeString( id_step, "null_as" );
    eraseFiles = rep.getStepAttributeBoolean( id_step, "erase_files" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    localhostPort = rep.getStepAttributeString( id_step, "localhost_port" );
    encloseNumbers =
        ( rep.getStepAttributeString( id_step, "enclose_numbers" ).equalsIgnoreCase( "Y" ) ? true : false );
    updateCondition = rep.getStepAttributeString( id_step, "update_condition" );

    int numberOfLocalHosts = rep.countNrStepAttributes( id_step, "local_host" );
    allocateLocalHosts( numberOfLocalHosts );
    for ( int i = 0; i < numberOfLocalHosts; i++ ) {
      localHosts[i] = rep.getStepAttributeString( id_step, i, "local_host" );
    }

    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" );
      matchColumn[i] = rep.getStepAttributeBoolean( id_step, i, "match_column" );
      updateColumn[i] = rep.getStepAttributeBoolean( id_step, i, "update_column" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG,
        "GPLoadMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 20
Source File: OraBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    this.databases = databases;
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    commitSize = rep.getStepAttributeString( id_step, "commit" );
    bindSize = rep.getStepAttributeString( id_step, "bind_size" );
    readSize = rep.getStepAttributeString( id_step, "read_size" );
    maxErrors = rep.getStepAttributeString( id_step, "errors" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );
    loadMethod = rep.getStepAttributeString( id_step, "load_method" );
    loadAction = rep.getStepAttributeString( id_step, "load_action" );
    sqlldr = rep.getStepAttributeString( id_step, "sqlldr" );
    controlFile = rep.getStepAttributeString( id_step, "control_file" );
    dataFile = rep.getStepAttributeString( id_step, "data_file" );
    logFile = rep.getStepAttributeString( id_step, "log_file" );
    badFile = rep.getStepAttributeString( id_step, "bad_file" );
    discardFile = rep.getStepAttributeString( id_step, "discard_file" );

    directPath = rep.getStepAttributeBoolean( id_step, "direct_path" );
    eraseFiles = rep.getStepAttributeBoolean( id_step, "erase_files" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    dbNameOverride = rep.getStepAttributeString( id_step, "dbname_override" );

    characterSetName = rep.getStepAttributeString( id_step, "character_set" );
    failOnWarning = rep.getStepAttributeBoolean( id_step, "fail_on_warning" );
    failOnError = rep.getStepAttributeBoolean( id_step, "fail_on_error" );
    parallel = rep.getStepAttributeBoolean( id_step, "parallel" );
    altRecordTerm = rep.getStepAttributeString( id_step, "alt_rec_term" );

    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, "OraBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}