shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.iplatform.gather;
 
import com.iplatform.core.BeanContextAware;
import com.walker.connector.LocalAddress;
import com.walker.db.DatabaseType;
import com.walker.store.AbstractStore;
import com.walker.store.support.DatabaseStore;
import com.walker.store.task.GatherTask;
 
/**
 * 测试单表采集调度器实现。
 * @author 时克英
 * @date 2022-09-14
 */
public class TestFileTableScheduler extends SingleTableGatherScheduler{
 
    public TestFileTableScheduler(int id, String name, DatabaseStore store){
        super(id, name, store);
        this.setPageSize(256);
        this.setTableName("s_file");
        this.setCreateTableSql("create table s_file(id varchar(36) not null,create_time bigint not null,creator varchar(30),content_type varchar(120) not null,file_name varchar(255) not null,path varchar(255),ext varchar(6),content blob,store_type smallint not null,summary varchar(100),group_id varchar(36),file_size bigint not null default 0,primary key (id));");
        this.setLoadSql("select * from s_file ");
    }
 
    @Override
    protected GatherTask providerTask(AbstractStore store) {
        LocalAddress localAddress = BeanContextAware.getBeanByType(LocalAddress.class);
        logger.info("localAddress.service = " + localAddress.getServiceName());
        TestFileGatherTask task = new TestFileGatherTask(store, "测试采集表:s_file", localAddress);
        task.setDatabaseType(DatabaseType.MYSQL);
        task.setSrcPreferenceSize(1000);
        return task;
    }
 
    @Override
    protected void terminateGatherScheduler(int schedulerId) {
        logger.info("采集任务终止:" + schedulerId);
    }
 
    @Override
    protected String getPageSQLInfo(int index, int pageSize) {
        return " limit ?,?";
    }
}