Search in sources :

Example 1 with XmlProcessBase

use of com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase in project dble by actiontech.

the class ZktoXmlMain method initLocalConfFromZK.

private static void initLocalConfFromZK(ZookeeperProcessListen zkListen, CuratorFramework zkConn) throws Exception {
    ConfigStatusListener confListener = new ConfigStatusListener(zkListen, zkConn);
    XmlProcessBase xmlProcess = new XmlProcessBase();
    // load schema
    new SchemaszkToxmlLoader(zkListen, zkConn, xmlProcess, confListener);
    // load server
    new ServerzkToxmlLoader(zkListen, zkConn, xmlProcess, confListener);
    // load rule
    new RuleszkToxmlLoader(zkListen, zkConn, xmlProcess, confListener);
    // load sequence
    new SequenceTopropertiesLoader(zkListen, zkConn);
    // load ehcache
    new EcacheszkToxmlLoader(zkListen, zkConn, xmlProcess);
    ZKUtils.addChildPathCache(KVPathUtil.getOnlinePath(), new OfflineStatusListener());
    // transform bindata data to local file
    ZKUtils.addChildPathCache(KVPathUtil.getBinDataPath(), new BinDataPathChildrenCacheListener());
    new BinlogPauseStatusListener(zkListen, zkConn);
    // init xml
    xmlProcess.initJaxbClass();
    // notify all
    zkListen.initAllNode();
    zkListen.clearInited();
}
Also used : XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) OfflineStatusListener(com.actiontech.dble.server.OfflineStatusListener)

Example 2 with XmlProcessBase

use of com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase in project dble by actiontech.

the class XmltoZkMain method writeConfFileToZK.

public static void writeConfFileToZK(boolean isAll, final int allMode) throws Exception {
    ZookeeperProcessListen zkListen = new ZookeeperProcessListen();
    CuratorFramework zkConn = ZKUtils.getConnection();
    XmlProcessBase xmlProcess = new XmlProcessBase();
    // xmltozk for schema
    new SchemasxmlTozkLoader(zkListen, zkConn, xmlProcess);
    // xmltozk for server
    new ServerxmlTozkLoader(zkListen, zkConn, xmlProcess);
    // xmltozk for rule
    new RulesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    xmlProcess.initJaxbClass();
    zkListen.initAllNode();
    zkListen.clearInited();
    // write flag
    ConfStatus status = new ConfStatus(ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), isAll ? ConfStatus.Status.RELOAD_ALL : ConfStatus.Status.RELOAD, isAll ? String.valueOf(allMode) : null);
    zkConn.setData().forPath(KVPathUtil.getConfStatusPath(), status.toString().getBytes(StandardCharsets.UTF_8));
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ConfStatus(com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus) XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) ZookeeperProcessListen(com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)

Example 3 with XmlProcessBase

use of com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase in project dble by actiontech.

the class XmltoUcore method initFileToUcore.

public static void initFileToUcore() throws Exception {
    UcoreClearKeyListener ucoreListen = new UcoreClearKeyListener();
    XmlProcessBase xmlProcess = new XmlProcessBase();
    new UXmlRuleLoader(xmlProcess, ucoreListen);
    new UXmlServerLoader(xmlProcess, ucoreListen);
    new UXmlSchemaLoader(xmlProcess, ucoreListen);
    new UXmlEhcachesLoader(xmlProcess, ucoreListen);
    new UPropertySequenceLoader(ucoreListen);
    xmlProcess.initJaxbClass();
    ucoreListen.initAllNode();
}
Also used : XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) UcoreClearKeyListener(com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener)

Example 4 with XmlProcessBase

use of com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase in project dble by actiontech.

the class UcoreToXml method loadKVtoFile.

public static void loadKVtoFile() {
    try {
        // create a new listener to the ucore config change
        listener = new UcoreClearKeyListener();
        XmlProcessBase xmlProcess = new XmlProcessBase();
        listener.init();
        // add all loader into listener map list
        new UXmlRuleLoader(xmlProcess, listener);
        new UXmlSchemaLoader(xmlProcess, listener);
        new UXmlServerLoader(xmlProcess, listener);
        new UXmlEhcachesLoader(xmlProcess, listener);
        new UPropertySequenceLoader(listener);
        xmlProcess.initJaxbClass();
        // add listener to watch the Prefix of the keys
        new UConfigStatusResponse(listener);
        new UBinlogPauseStatusResponse(listener);
        ddlListener = new UcoreSingleKeyListener(UcorePathUtil.getDDLPath() + SEPARATOR, new UDdlChildResponse());
        viewListener = new UcoreSingleKeyListener(UcorePathUtil.getViewChangePath() + SEPARATOR, new UViewChildResponse());
        onlineListener = new UOffLineListener();
        listener.initForXml();
        Thread thread = new Thread(listener);
        thread.start();
        ddlListener.init();
        Thread thread2 = new Thread(ddlListener);
        thread2.start();
        viewListener.init();
        Thread thread3 = new Thread(viewListener);
        thread3.start();
        onlineListener.init();
        Thread thread4 = new Thread(onlineListener);
        thread4.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) UOffLineListener(com.actiontech.dble.config.loader.ucoreprocess.listen.UOffLineListener) UcoreSingleKeyListener(com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreSingleKeyListener) UcoreClearKeyListener(com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener)

Example 5 with XmlProcessBase

use of com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase in project dble by actiontech.

the class XmltoZkMain method initFileToZK.

public static void initFileToZK() throws Exception {
    ZookeeperProcessListen zkListen = new ZookeeperProcessListen();
    CuratorFramework zkConn = ZKUtils.getConnection();
    XmlProcessBase xmlProcess = new XmlProcessBase();
    new SchemasxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new ServerxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new RulesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new SequenceTozkLoader(zkListen, zkConn);
    new EcachesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new OthermsgTozkLoader(zkListen, zkConn);
    xmlProcess.initJaxbClass();
    zkListen.initAllNode();
    zkListen.clearInited();
    String confInited = KVPathUtil.getConfInitedPath();
    if (zkConn.checkExists().forPath(confInited) == null) {
        zkConn.create().creatingParentContainersIfNeeded().forPath(confInited);
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) ZookeeperProcessListen(com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)

Aggregations

XmlProcessBase (com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase)5 UcoreClearKeyListener (com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreClearKeyListener)2 ZookeeperProcessListen (com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)2 CuratorFramework (org.apache.curator.framework.CuratorFramework)2 UOffLineListener (com.actiontech.dble.config.loader.ucoreprocess.listen.UOffLineListener)1 UcoreSingleKeyListener (com.actiontech.dble.config.loader.ucoreprocess.listen.UcoreSingleKeyListener)1 ConfStatus (com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus)1 OfflineStatusListener (com.actiontech.dble.server.OfflineStatusListener)1