Search in sources :

Example 1 with ClusterConfig

use of io.mycat.config.model.ClusterConfig in project Mycat-Server by MyCATApache.

the class XMLServerLoader method load.

private void load() {
    //读取server.xml配置
    InputStream dtd = null;
    InputStream xml = null;
    try {
        dtd = XMLServerLoader.class.getResourceAsStream("/server.dtd");
        xml = XMLServerLoader.class.getResourceAsStream("/server.xml");
        Element root = ConfigUtil.getDocument(dtd, xml).getDocumentElement();
        //加载System标签
        loadSystem(root);
        //加载User标签
        loadUsers(root);
        //加载集群配置
        this.cluster = new ClusterConfig(root, system.getServerPort());
        //加载全局SQL防火墙
        loadFirewall(root);
    } catch (ConfigException e) {
        throw e;
    } catch (Exception e) {
        throw new ConfigException(e);
    } finally {
        if (dtd != null) {
            try {
                dtd.close();
            } catch (IOException e) {
            }
        }
        if (xml != null) {
            try {
                xml.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : InputStream(java.io.InputStream) Element(org.w3c.dom.Element) ConfigException(io.mycat.config.util.ConfigException) IOException(java.io.IOException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConfigException(io.mycat.config.util.ConfigException) ClusterConfig(io.mycat.config.model.ClusterConfig)

Aggregations

ClusterConfig (io.mycat.config.model.ClusterConfig)1 ConfigException (io.mycat.config.util.ConfigException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Element (org.w3c.dom.Element)1