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


Java TddlRule类代码示例

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


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

示例1: ruleInit

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
public void ruleInit() throws TddlException {
    TddlRule rule = new TddlRule();
    rule.setAppName(appName);
    rule.setSubApps(this.subApps);
    rule.setUnitName(this.unitName);
    rule.setAppRuleFile(ruleFilePath);
    rule.setAllowEmptyRule(!sharding);
    if (matrix.getGroups() != null) {
        String singleDbIndex = matrix.getGroups().get(0).getName();
        rule.setDefaultDbIndex(singleDbIndex);
    }

    rule.init();
    optimizerRule = new OptimizerRule(rule);
    optimizerRule.init();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:17,代码来源:MatrixConfigHolder.java

示例2: initTestRuleSchemaManager

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@Test
public void initTestRuleSchemaManager() throws TddlException {
    ExecutorContext executorContext = new ExecutorContext();
    ExecutorContext.setContext(executorContext);
    TopologyHandler topology = new TopologyHandler("andor_show", null, "test_matrix_without_group_config.xml");
    executorContext.setTopologyHandler(topology);

    topology.init();
    TddlRule rule = new TddlRule();
    rule.setAppName("andor_show");
    rule.init();

    OptimizerRule optimizerRule = new OptimizerRule(rule);
    RuleSchemaManager s = new RuleSchemaManager(optimizerRule, topology.getMatrix());
    s.init();
    // Assert.assertTrue(s.getTable("BMW_USERS") != null);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:18,代码来源:SchemaManagerTest.java

示例3: initTestRuleSchemaManager

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@Test
public void initTestRuleSchemaManager() throws TddlException {
    ExecutorContext executorContext = new ExecutorContext();
    ExecutorContext.setContext(executorContext);
    TopologyHandler topology = new TopologyHandler("andor_show", null, "test_matrix_without_group_config.xml");
    executorContext.setTopologyHandler(topology);

    topology.init();
    TddlRule rule = new TddlRule();
    rule.setAppName("andor_show");
    rule.init();

    OptimizerRule optimizerRule = new OptimizerRule(rule);
    RuleSchemaManager s = new RuleSchemaManager(optimizerRule, topology.getMatrix());
    s.init();
    Assert.assertTrue(s.getTable("BMW_USERS") != null);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:18,代码来源:SchemaManagerTest.java

示例4: initial

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void initial() throws TddlException {
    parser.init();

    OptimizerContext context = new OptimizerContext();
    TddlRule tddlRule = new TddlRule();
    tddlRule.setAppRuleFile("classpath:" + rule_file);
    tddlRule.setAppName(APPNAME);
    tddlRule.init();

    rule = new OptimizerRule(tddlRule);

    StaticSchemaManager localSchemaManager = StaticSchemaManager.parseSchema(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(table_file));

    Matrix matrix = MatrixParser.parse(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(matrix_file));

    schemaManager = new RepoSchemaManager();
    schemaManager.setLocal(localSchemaManager);
    schemaManager.setGroup(matrix.getGroup("andor_mysql_group_0"));
    schemaManager.init();

    statManager = new LocalStatManager();
    statManager.init();

    context.setMatrix(matrix);
    context.setRule(rule);
    context.setSchemaManager(schemaManager);
    context.setStatManager(statManager);
    context.setIndexManager(new RuleIndexManager(schemaManager));

    OptimizerContext.setContext(context);

    optimizer = new CostBasedOptimizer(rule);
    optimizer.setSqlParseManager(parser);
    optimizer.init();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:41,代码来源:BaseSqlOptimizerTest.java

示例5: ruleInit

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
public void ruleInit() throws TddlException {
    TddlRule rule = new TddlRule();
    rule.setAppName(appName);
    rule.setAppRuleFile(ruleFilePath);
    rule.init();

    optimizerRule = new OptimizerRule(rule);
    optimizerRule.init();
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:10,代码来源:MatrixConfigHolder.java

示例6: initial

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void initial() throws TddlException {
    parser.init();

    OptimizerContext context = new OptimizerContext();
    TddlRule tddlRule = new TddlRule();
    tddlRule.setAppRuleFile("classpath:" + rule_file);
    tddlRule.setAppName(APPNAME);
    tddlRule.init();

    rule = new OptimizerRule(tddlRule);

    StaticSchemaManager localSchemaManager = StaticSchemaManager.parseSchema(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(table_file));

    Matrix matrix = MatrixParser.parse(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(matrix_file));

    schemaManager = new RepoSchemaManager();
    schemaManager.setLocal(localSchemaManager);
    schemaManager.setGroup(matrix.getGroup("andor_mysql_group_0"));
    schemaManager.init();

    statManager = new LocalStatManager();
    statManager.init();

    context.setMatrix(matrix);
    context.setRule(rule);
    context.setSchemaManager(schemaManager);
    context.setStatManager(statManager);
    context.setIndexManager(new RuleIndexManager(schemaManager));

    OptimizerContext.setContext(context);

    optimizer = new CostBasedOptimizer();
    optimizer.setSqlParseManager(parser);
    optimizer.init();
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:41,代码来源:BaseSqlOptimizerTest.java

示例7: OptimizerRule

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
public OptimizerRule(TddlRule tddlRule){
    this.tddlRule = tddlRule;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:4,代码来源:OptimizerRule.java

示例8: initial

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void initial() throws TddlException {
    parser.init();

    OptimizerContext context = new OptimizerContext();
    TddlRule tddlRule = new TddlRule();
    tddlRule.setAppRuleFile("classpath:" + rule_file);
    tddlRule.setAppName(APPNAME);
    tddlRule.init();

    rule = new OptimizerRule(tddlRule);

    StaticSchemaManager localSchemaManager = StaticSchemaManager.parseSchema(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(table_file));

    Matrix matrix = MatrixParser.parse(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(matrix_file));

    schemaManager = new RepoSchemaManager();
    schemaManager.setLocal(localSchemaManager);
    schemaManager.setGroup(matrix.getGroup("andor_group_0"));
    schemaManager.init();

    statManager = LocalStatManager.parseConfig(GeneralUtil.getInputStream(table_stat_file),
        GeneralUtil.getInputStream(table_index_stat_file));

    // statManager = new RepoStatManager();
    // statManager.setLocal(local);
    // statManager.setUseCache(true);
    // statManager.setGroup(matrix.getGroup("andor_group_0"));
    // statManager.init();

    context.setMatrix(matrix);
    context.setRule(rule);
    context.setSchemaManager(schemaManager);
    context.setStatManager(statManager);
    context.setIndexManager(new RuleIndexManager(schemaManager));

    OptimizerContext.setContext(context);

    optimizer = new CostBasedOptimizer(rule);
    optimizer.setSqlParseManager(parser);
    optimizer.init();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:47,代码来源:BaseOptimizerTest.java

示例9: setUp

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
    ApplicationContext context = new ClassPathXmlApplicationContext("classpath:app/eagleEye/spring-context.xml");
    rule = (TddlRule) context.getBean("rule");
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:6,代码来源:EagleEyeRuleTest.java

示例10: setUp

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
    ApplicationContext context = new ClassPathXmlApplicationContext("classpath:groovy/spring-context.xml");
    rule = (TddlRule) context.getBean("rule");
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:6,代码来源:ExtraPackagesTest.java

示例11: setUp

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
    ApplicationContext context = new ClassPathXmlApplicationContext("classpath:virtualnode/spring-context.xml");
    rule = (TddlRule) context.getBean("rule");
    rule_format = (TddlRule) context.getBean("rule-format");
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:7,代码来源:TddlVirtualRuleTest.java

示例12: initial

import com.taobao.tddl.rule.TddlRule; //导入依赖的package包/类
@BeforeClass
public static void initial() throws TddlException {
    parser.init();

    OptimizerContext context = new OptimizerContext();
    TddlRule tddlRule = new TddlRule();
    tddlRule.setAppRuleFile("classpath:" + rule_file);
    tddlRule.setAppName(APPNAME);
    tddlRule.init();

    rule = new OptimizerRule(tddlRule);

    StaticSchemaManager localSchemaManager = StaticSchemaManager.parseSchema(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(table_file));

    Matrix matrix = MatrixParser.parse(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(matrix_file));

    schemaManager = new RepoSchemaManager();
    schemaManager.setLocal(localSchemaManager);
    schemaManager.setGroup(matrix.getGroup("andor_group_0"));
    schemaManager.init();

    statManager = LocalStatManager.parseConfig(Thread.currentThread()
        .getContextClassLoader()
        .getResourceAsStream(table_stat_file),
        Thread.currentThread().getContextClassLoader().getResourceAsStream(table_index_stat_file));

    // statManager = new RepoStatManager();
    // statManager.setLocal(local);
    // statManager.setUseCache(true);
    // statManager.setGroup(matrix.getGroup("andor_group_0"));
    // statManager.init();

    context.setMatrix(matrix);
    context.setRule(rule);
    context.setSchemaManager(schemaManager);
    context.setStatManager(statManager);
    context.setIndexManager(new RuleIndexManager(schemaManager));

    OptimizerContext.setContext(context);

    optimizer = new CostBasedOptimizer();
    optimizer.setSqlParseManager(parser);
    optimizer.init();
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:49,代码来源:BaseOptimizerTest.java


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