Package com.alibaba.otter.shared.etl.model

Examples of com.alibaba.otter.shared.etl.model.Identity


    private Identity            identity = null;

    @BeforeMethod
    public void setUp() {
        identity = new Identity();
        identity.setChannelId(100L);
        identity.setPipelineId(100L);
        identity.setProcessId(100L);
    }
View Full Code Here


    private Identity            identity = null;

    @BeforeMethod
    public void setUp() {
        identity = new Identity();
        identity.setChannelId(100L);
        identity.setPipelineId(100L);
        identity.setProcessId(100L);
    }
View Full Code Here

        System.setProperty("nid", "1");
    }

    @Test
    public void test_simple() {
        Identity identity = new Identity();
        identity.setChannelId(100L);
        identity.setPipelineId(100L);
        identity.setProcessId(100L);

        RowBatch rowBatch = new RowBatch();
        rowBatch.setIdentity(identity);

        FileBatch fileBatch = new FileBatch();
View Full Code Here

    /**
     * 返回结果为已处理成功的记录
     */
    public DbLoadContext load(RowBatch rowBatch, WeightController controller) {
        Assert.notNull(rowBatch);
        Identity identity = rowBatch.getIdentity();
        DbLoadContext context = buildContext(identity);

        try {
            List<EventData> datas = rowBatch.getDatas();
            context.setPrepareDatas(datas);
View Full Code Here

    /**
     * 更新一下事务标记
     */
    private void updateMark(DbLoadContext context, DbDialect dialect, int threadId, String sql, boolean needInfo) {
        Identity identity = context.getIdentity();
        Channel channel = context.getChannel();
        // 获取dbDialect
        String markTableName = context.getPipeline().getParameters().getSystemSchema() + "."
                               + context.getPipeline().getParameters().getSystemMarkTable();
        String markTableColumn = context.getPipeline().getParameters().getSystemMarkTableColumn();
View Full Code Here

                            }

                            Channel channel = configClientService.findChannelByPipelineId(pipelineId);
                            RowBatch rowBatch = new RowBatch();
                            // 构造唯一标识
                            Identity identity = new Identity();
                            identity.setChannelId(channel.getId());
                            identity.setPipelineId(pipelineId);
                            identity.setProcessId(etlEventData.getProcessId());
                            rowBatch.setIdentity(identity);
                            // 进行数据合并
                            for (EventData data : eventData) {
                                rowBatch.merge(data);
                            }
View Full Code Here

    public void extract(DbBatch dbBatch) throws ExtractException {
        List<FileData> fileDatas = doFileExtract(dbBatch.getRowBatch());
        FileBatch fileBatch = new FileBatch();
        fileBatch.setFiles(fileDatas);
        Identity identity = new Identity();
        identity.setChannelId(dbBatch.getRowBatch().getIdentity().getChannelId());
        identity.setPipelineId(dbBatch.getRowBatch().getIdentity().getPipelineId());
        identity.setProcessId(dbBatch.getRowBatch().getIdentity().getProcessId());
        fileBatch.setIdentity(identity);
        dbBatch.setFileBatch(fileBatch);
    }
View Full Code Here

    /**
     * 将rowBatch中的记录,按找载入的目标数据源进行分类
     */
    private List<RowBatch> split(RowBatch rowBatch) {
        final Identity identity = rowBatch.getIdentity();
        Map<DataMediaSource, RowBatch> result = new MapMaker().makeComputingMap(new Function<DataMediaSource, RowBatch>() {

            public RowBatch apply(DataMediaSource input) {
                RowBatch rowBatch = new RowBatch();
                rowBatch.setIdentity(identity);
                return rowBatch;
            }
        });

        for (EventData eventData : rowBatch.getDatas()) {
            // 获取介质信息
            DataMedia media = ConfigHelper.findDataMedia(configClientService.findPipeline(identity.getPipelineId()),
                                                         eventData.getTableId());
            result.get(media.getSource()).merge(eventData); // 归类
        }

        return new ArrayList<RowBatch>(result.values());
View Full Code Here

     * key : Class对象,代表生成的目标数据对象
     * value : 每种目标数据对象的集合数据
     * </pre>
     */
    public Map<Class, BatchObject> transform(RowBatch rowBatch) {
        final Identity identity = translateIdentity(rowBatch.getIdentity());
        Map<Class, BatchObject> result = new HashMap<Class, BatchObject>();
        // 初始化默认值
        result.put(EventData.class, initBatchObject(identity, EventData.class));

        for (EventData eventData : rowBatch.getDatas()) {
            // 处理eventData
            Long tableId = eventData.getTableId();
            Pipeline pipeline = configClientService.findPipeline(identity.getPipelineId());
            // 针对每个同步数据,可能会存在多路复制的情况
            List<DataMediaPair> dataMediaPairs = ConfigHelper.findDataMediaPairByMediaId(pipeline, tableId);
            for (DataMediaPair pair : dataMediaPairs) {
                if (!pair.getSource().getId().equals(tableId)) { // 过滤tableID不为源的同步
                    continue;
View Full Code Here

    /**
     * 转化FileBatch对象
     */
    public Map<Class, BatchObject> transform(FileBatch fileBatch) {
        final Identity identity = translateIdentity(fileBatch.getIdentity());
        List<FileData> fileDatas = fileBatch.getFiles();
        Map<Class, BatchObject> result = new HashMap<Class, BatchObject>();
        // 初始化默认值
        result.put(FileData.class, initBatchObject(identity, FileData.class));

        for (FileData fileData : fileDatas) {
            // 进行转化
            Long tableId = fileData.getTableId();
            Pipeline pipeline = configClientService.findPipeline(identity.getPipelineId());
            // 针对每个同步数据,可能会存在多路复制的情况
            List<DataMediaPair> dataMediaPairs = ConfigHelper.findDataMediaPairByMediaId(pipeline, tableId);
            for (DataMediaPair pair : dataMediaPairs) {
                if (!pair.getSource().getId().equals(tableId)) { // 过滤tableID不为源的同步
                    continue;
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.etl.model.Identity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.