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


Java TableMetaData类代码示例

本文整理汇总了Java中com.goldengate.atg.datasource.meta.TableMetaData的典型用法代码示例。如果您正苦于以下问题:Java TableMetaData类的具体用法?Java TableMetaData怎么用?Java TableMetaData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Override
public void init(DsConfiguration arg0, DsMetaData arg1) {
	super.init(arg0, arg1);
	// TODO: Do something with the config file
	kafkaConfigFile = KAFKA_CONFIG_FILE; // set default value
	MutationMapper<Op, TableMetaData> mapper = new TypedMutationMapper();// TODO:
																			// get
																			// this
																			// from
																			// a
																			// config
																			// file
	handler = new KafkaAvroHandler<Op, TableMetaData, MutationMapper<Op, TableMetaData>>(
			mapper, kafkaConfigFile);
	super.init(arg0, arg1);
	logger.info("Done Initializing Kafka Handler");
}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:18,代码来源:KafkaHandler.java

示例2: operationAdded

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Override
final public Status operationAdded(DsEvent e, DsTransaction transaction,
		DsOperation operation) {

	logger.info("Operation added event. Operation type = "
			+ operation.getOperationType());
	Status status = Status.OK;
	super.operationAdded(e, transaction, operation);

	if (isOperationMode()) {
		final Tx tx = new Tx(transaction, getMetaData(), getConfig());
		final TableMetaData tMeta = getMetaData().getTableMetaData(
				operation.getTableName());
		final Op op = new Op(operation, tMeta, getConfig());

		status = processOp(tx, op); // process data...

		// TODO: Should we flush somewhere here?
	}

	return status;

}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:24,代码来源:CleanAbstractHandler.java

示例3: createRow

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
private Row createRow(Op op, Schema schema, boolean onlyChanged ) throws IOException{
   Row row = new Row();
    TableMetaData tbl_meta = op.getTableMeta(); 
int i = 0;
for(DsColumn column : op) {
           ColumnMetaData col_meta = tbl_meta.getColumnMetaData(i);; 
            // TODO: DO we really need key columns here? Yes, for now!. Considering adding a key field or row (since keys can be aggregates) to Mutation
             if (!onlyChanged || column.isChanged() || col_meta.isKeyCol()){
            	 String name = col_meta.getColumnName(); 
            	 if (column.getAfter() == null){
            		 logger.warn("column {}.{} of SQL type {} in null" , tbl_meta.getTableName(), name , column,   col_meta.getDataType().getJDBCType());
            	 }else{ 
  		    logger.debug("\t convertColumn {} = {} colType =  {}" , name , column,   col_meta.getDataType().getJDBCType());
  		                   
  		    row.addColumn(name,convertColumn(column.getAfter(),col_meta.getDataType().getJDBCType()));
            	 }
  	 }
         i++;
  } 
       logger.info("row: {} ", row);
 return row;
}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:23,代码来源:AbstractMutationMapper.java

示例4: createBeforeKeyRow

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
private Row createBeforeKeyRow(Op op, Schema schema) throws IOException{
   Row row = new Row();
    TableMetaData tbl_meta = op.getTableMeta(); 
int i = 0;
for(DsColumn column : op) {
           ColumnMetaData col_meta = tbl_meta.getColumnMetaData(i);; 
             if ( col_meta.isKeyCol()){
            	 String name = col_meta.getColumnName(); 
            	 row.addColumn(name,convertColumn(column.getBefore(),col_meta.getDataType().getJDBCType()));
  	 }
         i++;
  } 
      logger.info("row: {}", row);
 return row;
}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:16,代码来源:AbstractMutationMapper.java

示例5: toTable

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Override
protected Table toTable(TableMetaData tb){
 String tableName = tb.getTableName().getOriginalShortName().toLowerCase();
 String databaseName = tb.getTableName().getOriginalSchemaName().toLowerCase();
 Table table=  new Table(databaseName, tableName);
 SchemaBuilder builder = SchemaBuilder.struct().name(table.schemaName());
 
 List<String> pkColumnNames = new ArrayList();
 setSchema(builder, tb, pkColumnNames);
 Schema schema = builder.build();

 table.setSchema( schema, pkColumnNames );
 return table;

}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:16,代码来源:TypedMutationMapper.java

示例6: setSchema

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
private void setSchema( SchemaBuilder builder, TableMetaData tb, List<String> pkColumnNames){
 for(ColumnMetaData column : tb.getColumnMetaData()) {
       //  logger.debug("meta for column = " + column.getColumnName()  );
           if ( column.isKeyCol()){
          	      pkColumnNames.add(column.getColumnName());
          	 
  	 }
             addFieldSchema(builder,column );
  }    
}
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:11,代码来源:TypedMutationMapper.java

示例7: toTable

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Override
 protected Table toTable(TableMetaData tb){
 	 String tableName = tb.getTableName().getOriginalShortName().toLowerCase();
String databaseName = tb.getTableName().getOriginalSchemaName().toLowerCase();
  
List<String> pkColumnNames = new ArrayList();
getPks( tb, pkColumnNames);
//We don't really care about the schema here, it should never be used 
Table table=  new Table(databaseName, tableName);
table.setSchema( null, pkColumnNames );
return table;
 }
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:13,代码来源:StringMutationMapper.java

示例8: getPks

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
private void getPks( TableMetaData tb,  List<String> pkColumnNames){

  for(ColumnMetaData column : tb.getColumnMetaData()) {
            logger.debug("meta for column = {}", column.getColumnName()  );
            if ( column.isKeyCol()){
        	      pkColumnNames.add(column.getColumnName());	
   	 }
   } 
  
 }
 
开发者ID:rogers,项目名称:change-data-capture,代码行数:11,代码来源:StringMutationMapper.java

示例9: operationAdded

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Override
public Status operationAdded(DsEvent e, DsTransaction transaction, DsOperation operation) {
    Status overallStatus = Status.OK;
    super.operationAdded(e, transaction, operation);
    numOps.incrementAndGet();

    final Tx tx = new Tx(transaction, getMetaData(), getConfig());
    final TableMetaData tMeta = getMetaData().getTableMetaData(operation.getTableName());
    final Op op = new Op(operation, tMeta, getConfig());

    operation.getTokens();
    if (isOperationMode()) {

        if (log.isDebugEnabled()) {
            log.debug(" Received operation: table='"
                    + op.getTableName() + "'"
                    + ", pos=" + op.getPosition()
                    + " (total_ops= " + tx.getTotalOps()
                    + ", buffered=" + tx.getSize() + ")"
                    + ", ts=" + op.getTimestamp());

        }

        Status operationStatus = processOperation(tx, op);

        if (Status.ABEND.equals(operationStatus)) {
            overallStatus = Status.ABEND;
        }
    }
    return overallStatus;
}
 
开发者ID:MonsantoCo,项目名称:goldengate-kafka-adapter,代码行数:32,代码来源:EventHandler.java

示例10: testWriteOp

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@Test(testName = "测试写入op")
public void testWriteOp(){
    ArrayList<ColumnMetaData> columnMetaDatas = new ArrayList<ColumnMetaData>();

    ColumnMetaData columnMetaData = new ColumnMetaData("c1", 1);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c2", 2);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c3", 3);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c4", 4);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c5", 5);
    columnMetaDatas.add(columnMetaData);



    TableName tableName = new TableName("ogg_test.t_person");

    TableMetaData tableMetaData = new TableMetaData(tableName, columnMetaDatas);

    DsMetaData dsMetaData = new DsMetaData();
    dsMetaData.setTableMetaData(tableMetaData);
    DsColumn[] columns = new DsColumn[5];
    columns[0] = new DsColumnAfterValue("testNormal");
    columns[1] = new DsColumnAfterValue("2");
    columns[2] = new DsColumnAfterValue("3");
    columns[3] = new DsColumnAfterValue("2016-05-20 09:00:00");
    columns[4] = new DsColumnAfterValue("6");


    DsRecord dsRecord = new DsRecord(columns);

    DsOperation dsOperation = new DsOperation(tableName, DsOperation.OpType.DO_INSERT, "2016-05-13 19:15:15.010",0l, 0l, dsRecord);

    Op op = new Op(dsOperation, tableMetaData, null);

    BadOperateWriter.write(op,
            "ogg_test.t_person",
            "t_person",
            "op.txt",
            10000,
            "op error");

    FileUtils.deleteQuietly(new File("op.txt"));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:47,代码来源:BadOperateWriterTest.java

示例11: init

import com.goldengate.atg.datasource.meta.TableMetaData; //导入依赖的package包/类
@BeforeClass
public void init() throws DocumentException {
    datahubHandler = new DatahubHandler();

    datahubHandler.setState(DataSourceListener.State.READY);

    configure = ConfigureReader.reader("src/test/resources/configure.xml");

    datahubHandler.setConfigure(configure);

    RecordBuilder.init(configure);

    DataHubWriter.init(configure);

    OperationHandlerManager.init();

    ArrayList<ColumnMetaData> columnMetaDatas = new ArrayList<ColumnMetaData>();

    ColumnMetaData columnMetaData = new ColumnMetaData("c1", 1);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c2", 2);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c3", 3);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c4", 4);
    columnMetaDatas.add(columnMetaData);
    columnMetaData = new ColumnMetaData("c5", 5);
    columnMetaDatas.add(columnMetaData);



    tableName = new TableName("ogg_test.t_person");

    TableMetaData tableMetaData = new TableMetaData(tableName, columnMetaDatas);

    DsMetaData dsMetaData = new DsMetaData();
    dsMetaData.setTableMetaData(tableMetaData);


    GGTranID ggTranID = GGTranID.getID(0l, 0l);
    dsTransaction = new DsTransaction(ggTranID);

    e = new DsEventManager.TxEvent(dsTransaction, dsMetaData, "");
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:45,代码来源:DatahubHandlerTest.java


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