当前位置: 首页>>代码示例>>Java>>正文


Java TableInputMeta.setDatabaseMeta方法代码示例

本文整理汇总了Java中org.pentaho.di.trans.steps.tableinput.TableInputMeta.setDatabaseMeta方法的典型用法代码示例。如果您正苦于以下问题:Java TableInputMeta.setDatabaseMeta方法的具体用法?Java TableInputMeta.setDatabaseMeta怎么用?Java TableInputMeta.setDatabaseMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.trans.steps.tableinput.TableInputMeta的用法示例。


在下文中一共展示了TableInputMeta.setDatabaseMeta方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTableInputStep

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta getTableInputStep(GraphConfigurationInfo configurationInfo)
    throws GraphGeneratorException {
  TableInputMeta tableInput = new TableInputMeta();
  tableInput.setDatabaseMeta(getDatabaseMeta(configurationInfo));
  tableInput.setSQL(configurationInfo.getTableInputSqlQuery());
  //
  StepMeta tableInputStep =
      new StepMeta(GraphGeneratorConstants.TABLE_INPUT, (StepMetaInterface) tableInput);
  xAxixLocation += 120;
  tableInputStep.setLocation(xAxixLocation, yAxixLocation);
  //
  tableInputStep.setDraw(true);
  tableInputStep
      .setDescription("Read Data From Fact Table: " + GraphGeneratorConstants.TABLE_INPUT);

  return tableInputStep;
}
 
开发者ID:carbondata,项目名称:carbondata,代码行数:18,代码来源:GraphGenerator.java

示例2: getInfo

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta)
{
    meta.setSQL( wSQL.getText() );
    meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
    meta.setRowLimit( Const.toInt(wLimit.getText(), 0) );
    meta.setLookupFromStep( transMeta.findStep( wDatefrom.getText() ) );
    meta.setExecuteEachInputRow(wEachRow.getSelection());
    meta.setVariableReplacementActive(wVariables.getSelection());
    meta.setLazyConversionActive(wLazyConversion.getSelection());
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:11,代码来源:TableInputDialog.java

示例3: getInfo

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview)
{
    meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText())?wSQL.getSelectionText():wSQL.getText());
    meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
    meta.setRowLimit( wLimit.getText() );
    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
    meta.setExecuteEachInputRow(wEachRow.getSelection());
    meta.setVariableReplacementActive(wVariables.getSelection());
    meta.setLazyConversionActive(wLazyConversion.getSelection());
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:TableInputDialog.java

示例4: getInfo

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview) {
  meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText()) ? wSQL.getSelectionText() : wSQL.getText());
  meta.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
  meta.setRowLimit(wLimit.getText());
  StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
  infoStream.setStepMeta(transMeta.findStep(wDatefrom.getText()));
  meta.setExecuteEachInputRow(wEachRow.getSelection());
  meta.setVariableReplacementActive(wVariables.getSelection());
  meta.setLazyConversionActive(wLazyConversion.getSelection());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:11,代码来源:TableInputDialog.java

示例5: getInfo

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private void getInfo( TableInputMeta meta, boolean preview ) {
  meta.setSQL( preview && !Utils.isEmpty( wSQL.getSelectionText() ) ? wSQL.getSelectionText() : wSQL.getText() );
  meta.setDatabaseMeta( transMeta.findDatabase( wConnection.getText() ) );
  meta.setRowLimit( wLimit.getText() );
  StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get( 0 );
  infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
  meta.setExecuteEachInputRow( wEachRow.getSelection() );
  meta.setVariableReplacementActive( wVariables.getSelection() );
  meta.setLazyConversionActive( wLazyConversion.getSelection() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:11,代码来源:TableInputDialog.java

示例6: testCombinationLookup

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
  public void testCombinationLookup() throws Exception
  {
      EnvUtil.environmentInit();
      try
      {
          //
          // Create a new transformation...
          //
          TransMeta transMeta = new TransMeta();
          transMeta.setName("transname");

          // Add the database connections
          for (int i=0;i<databasesXML.length;i++)
          {
              DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
              transMeta.addDatabase(databaseMeta);
          }

          DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");

          // Execute our setup SQLs in the database.
          Database lookupDatabase = new Database(lookupDBInfo);
          lookupDatabase.connect();
          createTables(lookupDatabase);
          createData(lookupDatabase);

          StepLoader steploader = StepLoader.getInstance();            

          // 
          // create the source step...
          //
          String fromstepname = "read from [" + source_table + "]";
          TableInputMeta tii = new TableInputMeta();
          tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
          String selectSQL = "SELECT "+Const.CR;
          selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
          selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
          tii.setSQL(selectSQL);

          String fromstepid = steploader.getStepPluginID(tii);
          StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
          fromstep.setLocation(150, 100);
          fromstep.setDraw(true);
          fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
          transMeta.addStep(fromstep);

          // 
          // create the combination lookup/update step...
          //
          String lookupstepname = "lookup from [lookup]";
          CombinationLookupMeta clm = new CombinationLookupMeta();
          String lookupKey[] = { "DLR_CD" };
          clm.setTablename(target_table);
          clm.setKeyField(lookupKey);
          clm.setKeyLookup(lookupKey);
          clm.setTechnicalKeyField("ID");
          clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
          clm.setDatabaseMeta(lookupDBInfo);

          String lookupstepid = steploader.getStepPluginID(clm);
          StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
          lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
          transMeta.addStep(lookupstep);                              

          TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
          transMeta.addTransHop(hi);

          // Now execute the transformation...
          Trans trans = new Trans(transMeta);
          trans.execute(null);            

          trans.waitUntilFinished();            

          checkResults(lookupDatabase);
      }    	
      finally {}    
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:81,代码来源:CombinationLookupTest.java

示例7: testCombinationLookup

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
  public void testCombinationLookup() throws Exception
  {
      KettleEnvironment.init();

      try
      {
          //
          // Create a new transformation...
          //
          TransMeta transMeta = new TransMeta();
          transMeta.setName("transname");

          // Add the database connections
          for (int i=0;i<databasesXML.length;i++)
          {
              DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
              transMeta.addDatabase(databaseMeta);
          }

          DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");

          // Execute our setup SQLs in the database.
          Database lookupDatabase = new Database(transMeta, lookupDBInfo);
          lookupDatabase.connect();
          createTables(lookupDatabase);
          createData(lookupDatabase);

          PluginRegistry registry = PluginRegistry.getInstance();            

          // 
          // create the source step...
          //
          String fromstepname = "read from [" + source_table + "]";
          TableInputMeta tii = new TableInputMeta();
          tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
          String selectSQL = "SELECT "+Const.CR;
          selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
          selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
          tii.setSQL(selectSQL);

          String fromstepid = registry.getPluginId(StepPluginType.class, tii);
          StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
          fromstep.setLocation(150, 100);
          fromstep.setDraw(true);
          fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
          transMeta.addStep(fromstep);

          // 
          // create the combination lookup/update step...
          //
          String lookupstepname = "lookup from [lookup]";
          CombinationLookupMeta clm = new CombinationLookupMeta();
          String lookupKey[] = { "DLR_CD" };
          clm.setTablename(target_table);
          clm.setKeyField(lookupKey);
          clm.setKeyLookup(lookupKey);
          clm.setTechnicalKeyField("ID");
          clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
          clm.setDatabaseMeta(lookupDBInfo);

          String lookupstepid = registry.getPluginId(StepPluginType.class, clm);
          StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
          lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
          transMeta.addStep(lookupstep);                              

          TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
          transMeta.addTransHop(hi);

          // Now execute the transformation...
          Trans trans = new Trans(transMeta);
          trans.execute(null);            

          trans.waitUntilFinished();            

          checkResults(lookupDatabase);
      }    	
      finally {}    
  }
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:82,代码来源:CombinationLookupTest.java

示例8: generateTableInputStepFromLogicalTable

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta generateTableInputStepFromLogicalTable(LogicalTable logicalTable) {
  
  String name = ConceptUtil.getName(logicalTable, locale);
  String description = ConceptUtil.getDescription(logicalTable, locale);
  
  TableInputMeta meta = new TableInputMeta();
  
  // Source database, retain first
  // Source table, retain first
  // Source columns, retain all
  //
  DatabaseMeta sourceDatabaseMeta = null;
  String sourceTable = null;
  List<String> sourceColumns = new ArrayList<String>();
  for (LogicalColumn column : logicalTable.getLogicalColumns()) {
    String phDb = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB);
    String phTable = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE);
    String phCol = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN);
    if (!Const.isEmpty(phDb) && sourceDatabaseMeta==null) {
      sourceDatabaseMeta = DatabaseMeta.findDatabase(databases, phDb);
    }
    if (!Const.isEmpty(phTable)) {
      sourceTable = phDb;
    }
    if (!Const.isEmpty(phCol)) {
      sourceColumns.add(phCol);
    }
  }
  String sql = "SELECT * FROM --< Source query for dimension '"+name+"'";
  
  meta.setDatabaseMeta(sourceDatabaseMeta);
  
  if (sourceDatabaseMeta!=null && !Const.isEmpty(sourceTable)) {
    sql = "SELECT ";
    if (sourceColumns.isEmpty()) {
      sql+=" * ";
    } else {
      sql+=Const.CR;
    }
    boolean first=true;
    for (String sourceColumn : sourceColumns) {
      if (first) {
        first=false;
      } else {
        sql+="      , ";
      }
      sql+=sourceDatabaseMeta.quoteField(sourceColumn)+Const.CR;
    }
    sql+="FROM "+sourceDatabaseMeta.getQuotedSchemaTableCombination(null, sourceTable);
  }
  meta.setSQL(sql);
  
  // Wrap it up...
  //
  StepMeta stepMeta = new StepMeta("Source data for '"+name+"'", meta);
  stepMeta.drawStep();
  stepMeta.setDescription("Reads data for '"+name+"' : "+description);
  
  return stepMeta;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:61,代码来源:JobGenerator.java

示例9: testCombinationLookup

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
/**
 * Test case for Combination lookup/update.
 */
public void testCombinationLookup() throws Exception {
  //
  // Create a new transformation...
  //
  TransMeta transMeta = new TransMeta();
  transMeta.setName( "transname" );

  // Add the database connections
  for ( int i = 0; i < databasesXML.length; i++ ) {
    DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
    transMeta.addDatabase( databaseMeta );
  }

  DatabaseMeta lookupDBInfo = transMeta.findDatabase( "lookup" );

  // Execute our setup SQLs in the database.
  Database lookupDatabase = new Database( transMeta, lookupDBInfo );
  lookupDatabase.connect();
  createTables( lookupDatabase );
  createData( lookupDatabase );

  PluginRegistry registry = PluginRegistry.getInstance();

  //
  // create the source step...
  //
  String fromstepname = "read from [" + source_table + "]";
  TableInputMeta tii = new TableInputMeta();
  tii.setDatabaseMeta( transMeta.findDatabase( "lookup" ) );
  String selectSQL = "SELECT " + Const.CR;
  selectSQL += "DLR_CD, DLR_NM, DLR_DESC ";
  selectSQL += "FROM " + source_table + " ORDER BY ORDNO;";
  tii.setSQL( selectSQL );

  String fromstepid = registry.getPluginId( StepPluginType.class, tii );
  StepMeta fromstep = new StepMeta( fromstepid, fromstepname, tii );
  fromstep.setLocation( 150, 100 );
  fromstep.setDraw( true );
  fromstep.setDescription( "Reads information from table ["
    + source_table + "] on database [" + lookupDBInfo + "]" );
  transMeta.addStep( fromstep );

  //
  // create the combination lookup/update step...
  //
  String lookupstepname = "lookup from [lookup]";
  CombinationLookupMeta clm = new CombinationLookupMeta();
  String[] lookupKey = { "DLR_CD" };
  clm.setTablename( target_table );
  clm.setKeyField( lookupKey );
  clm.setKeyLookup( lookupKey );
  clm.setTechnicalKeyField( "ID" );
  clm.setTechKeyCreation( CombinationLookupMeta.CREATION_METHOD_TABLEMAX );
  clm.setDatabaseMeta( lookupDBInfo );

  String lookupstepid = registry.getPluginId( StepPluginType.class, clm );
  StepMeta lookupstep = new StepMeta( lookupstepid, lookupstepname, clm );
  lookupstep.setDescription( "Looks up information from table [lookup] on database [" + lookupDBInfo + "]" );
  transMeta.addStep( lookupstep );

  TransHopMeta hi = new TransHopMeta( fromstep, lookupstep );
  transMeta.addTransHop( hi );

  // Now execute the transformation...
  Trans trans = new Trans( transMeta );
  trans.execute( null );

  trans.waitUntilFinished();

  checkResults( lookupDatabase );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:75,代码来源:CombinationLookupIT.java

示例10: testExport

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
@Test
public void testExport() throws Exception {
  final String exportFileName = new File( "test.export" ).getAbsolutePath(); //$NON-NLS-1$

  RepositoryDirectoryInterface rootDir = initRepo();
  String uniqueTransName = EXP_TRANS_NAME.concat( EXP_DBMETA_NAME );
  TransMeta transMeta = createTransMeta( EXP_DBMETA_NAME );

  // Create a database association
  DatabaseMeta dbMeta = createDatabaseMeta( EXP_DBMETA_NAME );
  repository.save( dbMeta, VERSION_COMMENT_V1, null );

  TableInputMeta tableInputMeta = new TableInputMeta();
  tableInputMeta.setDatabaseMeta( dbMeta );

  transMeta.addStep( new StepMeta( EXP_TRANS_STEP_1_NAME, tableInputMeta ) );

  RepositoryDirectoryInterface transDir = rootDir.findDirectory( DIR_TRANSFORMATIONS );
  repository.save( transMeta, VERSION_COMMENT_V1, null );
  deleteStack.push( transMeta ); // So this transformation is cleaned up afterward
  assertNotNull( transMeta.getObjectId() );
  ObjectRevision version = transMeta.getObjectRevision();
  assertNotNull( version );
  assertTrue( hasVersionWithComment( transMeta, VERSION_COMMENT_V1 ) );
  assertTrue( repository.exists( uniqueTransName, transDir, RepositoryObjectType.TRANSFORMATION ) );

  JobMeta jobMeta = createJobMeta( EXP_JOB_NAME );
  RepositoryDirectoryInterface jobsDir = rootDir.findDirectory( DIR_JOBS );
  repository.save( jobMeta, VERSION_COMMENT_V1, null );
  deleteStack.push( jobMeta );
  assertNotNull( jobMeta.getObjectId() );
  version = jobMeta.getObjectRevision();
  assertNotNull( version );
  assertTrue( hasVersionWithComment( jobMeta, VERSION_COMMENT_V1 ) );
  assertTrue( repository.exists( EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB ) );

  LogListener errorLogListener = new LogListener( LogLevel.ERROR );
  KettleLogStore.getAppender().addLoggingEventListener( errorLogListener );

  try {
    repository.getExporter().exportAllObjects( new MockProgressMonitorListener(), exportFileName, null, "all" ); //$NON-NLS-1$
    FileObject exportFile = KettleVFS.getFileObject( exportFileName );
    assertFalse( "file left open", exportFile.getContent().isOpen() );
    assertNotNull( exportFile );
    MockRepositoryExportParser parser = new MockRepositoryExportParser();
    SAXParserFactory.newInstance().newSAXParser().parse( KettleVFS.getInputStream( exportFile ), parser );
    if ( parser.getFatalError() != null ) {
      throw parser.getFatalError();
    }
    assertNotNull( "No nodes found in export", parser.getNodeNames() ); //$NON-NLS-1$
    assertTrue( "No nodes found in export", !parser.getNodeNames().isEmpty() ); //$NON-NLS-1$
    assertEquals( "Incorrect number of nodes", 5, parser.getNodeNames().size() ); //$NON-NLS-1$
    assertEquals( "Incorrect number of transformations", 1, parser.getNodesWithName( "transformation" ).size() ); //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals( "Incorrect number of jobs", 1, parser.getNodesWithName( "job" ).size() ); //$NON-NLS-1$ //$NON-NLS-2$
    assertTrue( "log error", errorLogListener.getEvents().isEmpty() );

  } finally {
    KettleVFS.getFileObject( exportFileName ).delete();
    KettleLogStore.getAppender().removeLoggingEventListener( errorLogListener );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:62,代码来源:PurRepositoryIT.java

示例11: generateTableInputStepFromLogicalTable

import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入方法依赖的package包/类
private StepMeta generateTableInputStepFromLogicalTable(LogicalTable logicalTable) {

    String name = ConceptUtil.getName(logicalTable, locale);
    String description = ConceptUtil.getDescription(logicalTable, locale);

    TableInputMeta meta = new TableInputMeta();

    // Source database, retain first
    // Source table, retain first
    // Source columns, retain all
    //
    DatabaseMeta sourceDatabaseMeta = null;
    String sourceTable = null;
    List<String> sourceColumns = new ArrayList<String>();
    for (LogicalColumn column : logicalTable.getLogicalColumns()) {
      String phDb = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB);
      String phTable = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE);
      String phCol = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN);
      if (!Utils.isEmpty(phDb) && sourceDatabaseMeta==null) {
        sourceDatabaseMeta = DatabaseMeta.findDatabase(databases, phDb);
      }
      if (!Utils.isEmpty(phTable)) {
        sourceTable = phDb;
      }
      if (!Utils.isEmpty(phCol)) {
        sourceColumns.add(phCol);
      }
    }
    String sql = "SELECT * FROM --< Source query for dimension '"+name+"'";

    meta.setDatabaseMeta(sourceDatabaseMeta);

    if (sourceDatabaseMeta!=null && !Utils.isEmpty(sourceTable)) {
      sql = "SELECT ";
      if (sourceColumns.isEmpty()) {
        sql+=" * ";
      } else {
        sql+=Const.CR;
      }
      boolean first=true;
      for (String sourceColumn : sourceColumns) {
        if (first) {
          first=false;
        } else {
          sql+="      , ";
        }
        sql+=sourceDatabaseMeta.quoteField(sourceColumn)+Const.CR;
      }
      sql+="FROM "+sourceDatabaseMeta.getQuotedSchemaTableCombination(null, sourceTable);
    }
    meta.setSQL(sql);

    // Wrap it up...
    //
    StepMeta stepMeta = new StepMeta("Source data for '"+name+"'", meta);
    stepMeta.drawStep();
    stepMeta.setDescription("Reads data for '"+name+"' : "+description);

    return stepMeta;
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:61,代码来源:JobGenerator.java


注:本文中的org.pentaho.di.trans.steps.tableinput.TableInputMeta.setDatabaseMeta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。