Search in sources :

Example 16 with ConfigException

use of com.alibaba.cobar.config.util.ConfigException in project cobar by alibaba.

the class ConfigInitializer method initDataNodes.

private Map<String, MySQLDataNode> initDataNodes(ConfigLoader configLoader) {
    Map<String, DataNodeConfig> nodeConfs = configLoader.getDataNodes();
    Map<String, MySQLDataNode> nodes = new HashMap<String, MySQLDataNode>(nodeConfs.size());
    for (DataNodeConfig conf : nodeConfs.values()) {
        MySQLDataNode dataNode = getDataNode(conf, configLoader);
        if (nodes.containsKey(dataNode.getName())) {
            throw new ConfigException("dataNode " + dataNode.getName() + " duplicated!");
        }
        nodes.put(dataNode.getName(), dataNode);
    }
    return nodes;
}
Also used : MySQLDataNode(com.alibaba.cobar.mysql.MySQLDataNode) HashMap(java.util.HashMap) ConfigException(com.alibaba.cobar.config.util.ConfigException) DataNodeConfig(com.alibaba.cobar.config.model.DataNodeConfig)

Aggregations

ConfigException (com.alibaba.cobar.config.util.ConfigException)16 Element (org.w3c.dom.Element)13 NodeList (org.w3c.dom.NodeList)10 Node (org.w3c.dom.Node)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)4 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 DataNodeConfig (com.alibaba.cobar.config.model.DataNodeConfig)2 TableConfig (com.alibaba.cobar.config.model.TableConfig)2 UserConfig (com.alibaba.cobar.config.model.UserConfig)2 RuleAlgorithm (com.alibaba.cobar.config.model.rule.RuleAlgorithm)2 RuleConfig (com.alibaba.cobar.config.model.rule.RuleConfig)2 TableRuleConfig (com.alibaba.cobar.config.model.rule.TableRuleConfig)2 SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)2 ClusterConfig (com.alibaba.cobar.config.model.ClusterConfig)1 DataSourceConfig (com.alibaba.cobar.config.model.DataSourceConfig)1 SchemaConfig (com.alibaba.cobar.config.model.SchemaConfig)1 MySQLDataNode (com.alibaba.cobar.mysql.MySQLDataNode)1