├── README.md ├── server ├── src │ ├── main │ │ ├── webapp │ │ │ ├── WEB-INF │ │ │ │ ├── messages │ │ │ │ │ └── messages.properties │ │ │ │ ├── views │ │ │ │ │ ├── common │ │ │ │ │ │ ├── menu.jsp │ │ │ │ │ │ ├── top.jsp │ │ │ │ │ │ └── head.jsp │ │ │ │ │ ├── welcome.jsp │ │ │ │ │ ├── loggedout.jsp │ │ │ │ │ ├── login.jsp │ │ │ │ │ ├── i18n │ │ │ │ │ │ ├── projectList.jsp │ │ │ │ │ │ ├── propertyList.jsp │ │ │ │ │ │ ├── propertyEdit.jsp │ │ │ │ │ │ ├── propertyNew.jsp │ │ │ │ │ │ ├── projectEdit.jsp │ │ │ │ │ │ ├── pageEdit.jsp │ │ │ │ │ │ ├── pageList.jsp │ │ │ │ │ │ └── propertyUpdate.jsp │ │ │ │ │ └── config │ │ │ │ │ │ ├── dbConfig.jsp │ │ │ │ │ │ ├── configAdminAjax.jsp │ │ │ │ │ │ └── dbConfigEdit.jsp │ │ │ │ └── web.xml │ │ │ ├── favicon.ico │ │ │ ├── images │ │ │ │ ├── logo.gif │ │ │ │ ├── u189.png │ │ │ │ ├── banner.jpg │ │ │ │ ├── bg_repe.gif │ │ │ │ ├── favicon.ico │ │ │ │ ├── gicon.png │ │ │ │ ├── new │ │ │ │ │ ├── x.gif │ │ │ │ │ ├── num_five.gif │ │ │ │ │ ├── num_four.gif │ │ │ │ │ ├── num_one.gif │ │ │ │ │ ├── num_six.gif │ │ │ │ │ ├── num_two.gif │ │ │ │ │ ├── ico_close.gif │ │ │ │ │ ├── num_result.gif │ │ │ │ │ ├── num_three.gif │ │ │ │ │ └── botton_down.gif │ │ │ │ ├── bg_layer.png │ │ │ │ ├── bg_passW.png │ │ │ │ ├── favicon32.ico │ │ │ │ ├── flowstepbg.gif │ │ │ │ ├── norecordico.gif │ │ │ │ └── tiptexticon.gif │ │ │ ├── resources │ │ │ │ ├── blueprint │ │ │ │ │ ├── src │ │ │ │ │ │ ├── grid.png │ │ │ │ │ │ ├── reset.css │ │ │ │ │ │ ├── forms.css │ │ │ │ │ │ ├── print.css │ │ │ │ │ │ ├── ie.css │ │ │ │ │ │ └── typography.css │ │ │ │ │ ├── plugins │ │ │ │ │ │ ├── buttons │ │ │ │ │ │ │ ├── icons │ │ │ │ │ │ │ │ ├── key.png │ │ │ │ │ │ │ │ ├── tick.png │ │ │ │ │ │ │ │ └── cross.png │ │ │ │ │ │ │ ├── readme.txt │ │ │ │ │ │ │ └── screen.css │ │ │ │ │ │ ├── link-icons │ │ │ │ │ │ │ ├── icons │ │ │ │ │ │ │ │ ├── doc.png │ │ │ │ │ │ │ │ ├── feed.png │ │ │ │ │ │ │ │ ├── im.png │ │ │ │ │ │ │ │ ├── pdf.png │ │ │ │ │ │ │ │ ├── xls.png │ │ │ │ │ │ │ │ ├── email.png │ │ │ │ │ │ │ │ ├── external.png │ │ │ │ │ │ │ │ └── visited.png │ │ │ │ │ │ │ ├── readme.txt │ │ │ │ │ │ │ └── screen.css │ │ │ │ │ │ ├── rtl │ │ │ │ │ │ │ ├── readme.txt │ │ │ │ │ │ │ └── screen.css │ │ │ │ │ │ └── fancy-type │ │ │ │ │ │ │ ├── readme.txt │ │ │ │ │ │ │ └── screen.css │ │ │ │ │ ├── print.css │ │ │ │ │ └── ie.css │ │ │ │ ├── jquery.treeview │ │ │ │ │ ├── images │ │ │ │ │ │ ├── Thumbs.db │ │ │ │ │ │ ├── file.gif │ │ │ │ │ │ ├── folder.gif │ │ │ │ │ │ ├── minus.gif │ │ │ │ │ │ ├── plus.gif │ │ │ │ │ │ ├── ajax-loader.gif │ │ │ │ │ │ ├── folder-closed.gif │ │ │ │ │ │ ├── treeview-gray.gif │ │ │ │ │ │ ├── treeview-red.gif │ │ │ │ │ │ ├── treeview-black.gif │ │ │ │ │ │ ├── treeview-default.gif │ │ │ │ │ │ ├── treeview-famfamfam.gif │ │ │ │ │ │ ├── treeview-gray-line.gif │ │ │ │ │ │ ├── treeview-red-line.gif │ │ │ │ │ │ ├── treeview-black-line.gif │ │ │ │ │ │ ├── treeview-default-line.gif │ │ │ │ │ │ └── treeview-famfamfam-line.gif │ │ │ │ │ ├── jquery.treeview.edit.js │ │ │ │ │ ├── jquery.treeview.css │ │ │ │ │ ├── jquery.treeview.async.js │ │ │ │ │ └── jquery.treeview.js │ │ │ │ ├── popup.css │ │ │ │ ├── jquery.pagination │ │ │ │ │ ├── pagination.css │ │ │ │ │ └── jquery.pagination.js │ │ │ │ ├── jquery.autocomplete │ │ │ │ │ └── jquery.autocomplete.css │ │ │ │ ├── html5shiv.js │ │ │ │ ├── json.min.js │ │ │ │ └── base.css │ │ │ ├── configAdminAjax.jsp │ │ │ └── ok.jsp │ │ ├── resources │ │ │ ├── zookeeper.properties │ │ │ ├── logback.xml │ │ │ └── applicationContext-common.xml │ │ └── java │ │ │ └── org │ │ │ └── opencloudb │ │ │ └── mycat │ │ │ └── config │ │ │ └── server │ │ │ ├── controllers │ │ │ ├── LoggedOutController.java │ │ │ ├── LoginController.java │ │ │ └── ConfigAjaxController.java │ │ │ ├── util │ │ │ ├── NodeDataSerialize.java │ │ │ └── Constant.java │ │ │ ├── model │ │ │ ├── DbConfigServerModel.java │ │ │ ├── ZkNode.java │ │ │ └── DbConfigModel.java │ │ │ └── services │ │ │ ├── ZkClientBaseService.java │ │ │ └── ZkBaseService.java │ └── test │ │ └── java │ │ └── org │ │ └── opencloudb │ │ └── mycat │ │ └── config │ │ └── server │ │ ├── util │ │ ├── TestStringReplace.java │ │ └── TestNodeDataSerialize.java │ │ └── TestZooKeeper.java └── pom.xml ├── .gitignore ├── client ├── src │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── opencloudb │ │ │ │ └── mycat │ │ │ │ └── config │ │ │ │ └── client │ │ │ │ ├── util │ │ │ │ ├── StringUtils.java │ │ │ │ ├── PathUtil.java │ │ │ │ └── CollectionsUtil.java │ │ │ │ ├── IConfig.java │ │ │ │ ├── listener │ │ │ │ └── DataMonitor.java │ │ │ │ ├── store │ │ │ │ └── ConfigMap.java │ │ │ │ └── ZooKeeperClient.java │ │ └── resources │ │ │ └── logback.xml │ └── test │ │ └── java │ │ └── org │ │ └── opencloudb │ │ └── mycat │ │ └── config │ │ └── client │ │ ├── store │ │ └── TestConfigMap.java │ │ ├── util │ │ └── TestCollectionsUtil.java │ │ ├── TestZooKeeperClient.java │ │ └── spring │ │ └── TestCachPropertyConfigurer.java ├── doc │ └── help ├── bin │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── logback.xml │ └── pom.xml └── pom.xml └── pom.xml /README.md: -------------------------------------------------------------------------------- 1 | # Mycat-ConfigCenter 2 | Mycat-ConfigCenter 3 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/messages/messages.properties: -------------------------------------------------------------------------------- 1 | succ_update = \ufffd\u06b5\ufffd '{0}' \ufffd\u07b8\u0133\u0279\ufffd! 2 | -------------------------------------------------------------------------------- /server/src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /server/src/main/resources/zookeeper.properties: -------------------------------------------------------------------------------- 1 | connectString=192.168.44.136:2181 2 | sessionTimeout=30000 3 | 4 | zookeeper.rootPath=/config -------------------------------------------------------------------------------- /server/src/main/webapp/images/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/logo.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/u189.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/u189.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/banner.jpg -------------------------------------------------------------------------------- /server/src/main/webapp/images/bg_repe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/bg_repe.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/favicon.ico -------------------------------------------------------------------------------- /server/src/main/webapp/images/gicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/gicon.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/x.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/bg_layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/bg_layer.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/bg_passW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/bg_passW.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/favicon32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/favicon32.ico -------------------------------------------------------------------------------- /server/src/main/webapp/images/flowstepbg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/flowstepbg.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_five.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_five.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_four.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_four.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_one.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_one.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_six.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_six.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_two.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_two.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/norecordico.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/norecordico.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/tiptexticon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/tiptexticon.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/ico_close.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/ico_close.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_result.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_result.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/num_three.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/num_three.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/new/botton_down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/images/new/botton_down.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/src/grid.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/Thumbs.db -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/file.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/file.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/folder.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/minus.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/plus.gif -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/common/menu.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/ajax-loader.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/buttons/icons/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/buttons/icons/key.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/buttons/icons/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/buttons/icons/tick.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/folder-closed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/folder-closed.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-gray.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-gray.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-red.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/buttons/icons/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/buttons/icons/cross.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/doc.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/feed.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/im.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/im.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/pdf.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/xls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/xls.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-black.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-black.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-default.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/email.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-famfamfam.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-famfamfam.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-gray-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-gray-line.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-red-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-red-line.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/external.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/external.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/visited.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/blueprint/plugins/link-icons/icons/visited.png -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-black-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-black-line.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-default-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-default-line.gif -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/images/treeview-famfamfam-line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyCATApache/Mycat-ConfigCenter/HEAD/server/src/main/webapp/resources/jquery.treeview/images/treeview-famfamfam-line.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/util/StringUtils.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.util; 2 | 3 | public class StringUtils { 4 | 5 | public static boolean isNotEmpty(String s) { 6 | return !isEmpty(s); 7 | } 8 | 9 | public static boolean isEmpty(String s) { 10 | return s == null || "".equals(s.trim()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/rtl/readme.txt: -------------------------------------------------------------------------------- 1 | RTL 2 | * Mirrors Blueprint, so it can be used with Right-to-Left languages. 3 | 4 | By Ran Yaniv Hartstein, ranh.co.il 5 | 6 | Usage 7 | ---------------------------------------------------------------- 8 | 9 | 1) Add this line to your HTML: 10 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/popup.css: -------------------------------------------------------------------------------- 1 | #mask { 2 | height: 100%; 3 | width: 100%; 4 | background: #000000; 5 | position: absolute; 6 | top: 0; 7 | -moz-opacity:0.75; 8 | -khtml-opacity: 0.75; 9 | opacity: 0.75; 10 | filter: alpha(opacity=75); 11 | } 12 | 13 | #popup { 14 | margin: 0 auto; 15 | border: 1px solid #000000; 16 | background: #ffffff; 17 | position: absolute; 18 | top: 200px; 19 | left: 25%; 20 | } -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/fancy-type/readme.txt: -------------------------------------------------------------------------------- 1 | Fancy Type 2 | 3 | * Gives you classes to use if you'd like some 4 | extra fancy typography. 5 | 6 | Credits and instructions are specified above each class 7 | in the fancy-type.css file in this directory. 8 | 9 | 10 | Usage 11 | ---------------------------------------------------------------- 12 | 13 | 1) Add this plugin to lib/settings.yml. 14 | See compress.rb for instructions. 15 | -------------------------------------------------------------------------------- /client/doc/help: -------------------------------------------------------------------------------- 1 | 客户端对外暴露一个接口:org.opencloudb.mycat.config.client.IConfig, 2 | org.opencloudb.mycat.config.client.ZooKeeperClient作为其一个实现基于zk的实现,使用方法如下: 3 | 初始化: 4 | IConfig client = new ZooKeeperClient(hosts, timeout, "/"); 5 | 获取配置值: 6 | String value1 = client.getProp("/config/test");//return the value of the zknode /config/test;if not exists,return null 7 | String value2 = client.getProp("/config/test","def");//return the value of the zknode /config/test;if not exists,return def -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/IConfig.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client; 2 | 3 | /** 4 | * 用户查询接口,可以查询具体配置信息 5 | * 6 | */ 7 | public interface IConfig { 8 | 9 | /** 10 | * 根据给定的key获取属性值,并返回 11 | * @param key 12 | * @return 13 | */ 14 | public String getProp(String key); 15 | 16 | /** 17 | * 根据给定的key获取属性值,若属性值为null,返回defaultValue 18 | * @param key 19 | * @param defaultValue 20 | * @return 21 | */ 22 | public String getProp(String key,String defaultValue); 23 | } 24 | -------------------------------------------------------------------------------- /server/src/main/webapp/configAdminAjax.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | 10 | 11 | 12 | ${aaaaa.username} 13 | 14 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/welcome.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | 7 | 8 | <%@include file="common/head.jsp" %> 9 | 10 | 11 |
12 |

Welcome to ZK Admin

13 |
14 | <%@include file="common/menu.jsp" %> 15 |
16 | 17 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/loggedout.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | 7 | 8 | <%@include file="common/head.jsp" %> 9 | 10 | 11 |
12 |

13 | You have been logged out. Start again. 14 |

15 |
16 | 17 | -------------------------------------------------------------------------------- /server/src/main/webapp/ok.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html"%> 2 | <%@page pageEncoding="GB2312"%> 3 | <%@page info="author:XiaoNing"%> 4 | <%@ page import="java.util.Calendar" %> 5 | <%@ page import="java.text.SimpleDateFormat" %> 6 | <% 7 | 8 | Calendar cal= Calendar.getInstance(); 9 | 10 | 11 | int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH); 12 | out.print("
Day of Month: " + dayOfMonth + "
"); 13 | 14 | SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd"); 15 | String b=formatter1.format(cal.getTime()); 16 | out.print(b); 17 | %> -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/readme.txt: -------------------------------------------------------------------------------- 1 | Link Icons 2 | * Icons for links based on protocol or file type. 3 | 4 | This is not supported in IE versions < 7. 5 | 6 | 7 | Credits 8 | ---------------------------------------------------------------- 9 | 10 | * Marc Morgan 11 | * Olav Bjorkoy [bjorkoy.com] 12 | 13 | 14 | Usage 15 | ---------------------------------------------------------------- 16 | 17 | 1) Add this line to your HTML: 18 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/util/PathUtil.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.util; 2 | 3 | public class PathUtil { 4 | 5 | public static final String NODE_SEPERATOR = "/"; 6 | 7 | public static String concatPath(String root,String node) { 8 | if(root == null) { 9 | root = NODE_SEPERATOR; 10 | } 11 | if(!root.startsWith(NODE_SEPERATOR)) { 12 | throw new RuntimeException("path should be start with a /"); 13 | } 14 | 15 | if(!root.endsWith(NODE_SEPERATOR)) { 16 | root = root + NODE_SEPERATOR; 17 | } 18 | 19 | return root + node; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/common/top.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | 4 |
5 | 6 |
欢迎您,${sessionScope.SSO_USER_SESSION_KEY.username}|退出|帮助中心
7 |
8 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/controllers/LoggedOutController.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.controllers; 2 | 3 | import org.opencloudb.mycat.config.server.util.Constant; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.Model; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestMethod; 8 | 9 | 10 | @Controller 11 | @RequestMapping(value = "/loggedout") 12 | public class LoggedOutController { 13 | 14 | @RequestMapping(method = RequestMethod.GET) 15 | public String show(Model model) { 16 | return Constant.PAGE_LOGOUT; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.pagination/pagination.css: -------------------------------------------------------------------------------- 1 | .pagination { 2 | font-size: 80%; 3 | } 4 | 5 | .pagination a { 6 | text-decoration: none; 7 | border: solid 1px #AAE; 8 | color: #15B; 9 | } 10 | 11 | .pagination a, .pagination span { 12 | display: block; 13 | float: left; 14 | padding: 0.3em 0.5em; 15 | margin-right: 5px; 16 | margin-bottom: 5px; 17 | min-width:1em; 18 | text-align:center; 19 | } 20 | 21 | .pagination .current { 22 | background: #26B; 23 | color: #fff; 24 | border: solid 1px #AAE; 25 | } 26 | 27 | .pagination .current.prev, .pagination .current.next{ 28 | color:#999; 29 | border-color:#999; 30 | background:#fff; 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/util/CollectionsUtil.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.util; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | 7 | public class CollectionsUtil { 8 | 9 | public static List unionList(List la,List lb) { 10 | if(la == null) { 11 | la = new ArrayList(); 12 | } 13 | if(lb == null) { 14 | lb = new ArrayList(); 15 | } 16 | List cpLa = new ArrayList(); 17 | List cpLb = new ArrayList(); 18 | cpLa.addAll(la); 19 | cpLb.addAll(lb); 20 | 21 | List dumpList = new ArrayList(); 22 | for(T t : cpLa) { 23 | if(cpLb.contains(t)) { 24 | dumpList.add(t); 25 | } 26 | } 27 | cpLa.removeAll(dumpList); 28 | cpLb.removeAll(dumpList); 29 | cpLa.addAll(cpLb); 30 | return cpLa; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.opencloudb.mycat 6 | Mycat-config 7 | 0.0.1-SNAPSHOT 8 | pom 9 | 10 | Mycat-config 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | junit 20 | junit 21 | 4.10 22 | test 23 | 24 | 25 | 26 | server 27 | client 28 | 29 | 30 | -------------------------------------------------------------------------------- /server/src/test/java/org/opencloudb/mycat/config/server/util/TestStringReplace.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.util; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.net.URLEncoder; 5 | 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.junit.Test; 8 | 9 | public class TestStringReplace { 10 | 11 | String path = "/config/delete/t.1.2.3"; 12 | @Test 13 | public void testReplace() { 14 | String nodeId = StringUtils.replace(path, "/", "△"); 15 | nodeId = StringUtils.replace(nodeId, ".", "☆"); 16 | System.out.println(nodeId); 17 | } 18 | 19 | @Test 20 | public void testUrlEncode() { 21 | try { 22 | String s = URLEncoder.encode(path,"utf-8"); 23 | System.out.println(s); 24 | } catch (UnsupportedEncodingException e) { 25 | e.printStackTrace(); 26 | } 27 | } 28 | 29 | protected TestStringReplace(){} 30 | } 31 | class t extends TestStringReplace { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.autocomplete/jquery.autocomplete.css: -------------------------------------------------------------------------------- 1 | .ac_results { 2 | padding: 0px; 3 | border: 1px solid black; 4 | background-color: white; 5 | overflow: hidden; 6 | z-index: 99999; 7 | } 8 | 9 | .ac_results ul { 10 | width: 100%; 11 | list-style-position: outside; 12 | list-style: none; 13 | padding: 0; 14 | margin: 0; 15 | } 16 | 17 | .ac_results li { 18 | margin: 0px; 19 | padding: 2px 5px; 20 | cursor: default; 21 | display: block; 22 | /* 23 | if width will be 100% horizontal scrollbar will apear 24 | when scroll mode will be used 25 | */ 26 | /*width: 100%;*/ 27 | font: menu; 28 | font-size: 12px; 29 | /* 30 | it is very important, if line-height not setted or setted 31 | in relative units scroll will be broken in firefox 32 | */ 33 | line-height: 16px; 34 | overflow: hidden; 35 | } 36 | 37 | .ac_loading { 38 | background: white url('indicator.gif') right center no-repeat; 39 | } 40 | 41 | .ac_odd { 42 | background-color: #eee; 43 | } 44 | 45 | .ac_over { 46 | background-color: #0A246A; 47 | color: white; 48 | } 49 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/buttons/readme.txt: -------------------------------------------------------------------------------- 1 | Buttons 2 | 3 | * Gives you great looking CSS buttons, for both and 25 | 26 | 27 | Change Password 28 | 29 | 30 | 31 | Cancel 32 | 33 | -------------------------------------------------------------------------------- /client/src/test/java/org/opencloudb/mycat/config/client/store/TestConfigMap.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.store; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class TestConfigMap { 7 | 8 | @Test 9 | public void testAdd() { 10 | ConfigMap cm = ConfigMap.getInstance(); 11 | cm.put("/home/ext", "a=1\nb=2"); 12 | Assert.assertTrue("1".equals(cm.getProp("a"))); 13 | } 14 | 15 | @Test 16 | public void testUpdate() { 17 | ConfigMap cm = ConfigMap.getInstance(); 18 | String v1 = "a=1\nb=2\nc=3"; 19 | String v2 = "a=1\nb=2\nc=31"; 20 | String path = "/home/ext/sbin"; 21 | cm.put(path, v1); 22 | Assert.assertTrue("3".equals(cm.getProp("c"))); 23 | cm.put(path, v2); 24 | Assert.assertTrue("31".equals(cm.getProp("c"))); 25 | } 26 | @Test 27 | public void testMorePath() { 28 | ConfigMap cm = ConfigMap.getInstance(); 29 | String v1 = "a=1\nb=2\nc=3"; 30 | String v2 = "a1=1\nb1=2\nc1=31"; 31 | String path1 = "/home/ext/sbin"; 32 | String path2 = "/home/sbin"; 33 | cm.put(path1, v1); 34 | cm.put(path2, v2); 35 | Assert.assertTrue("3".equals(cm.getProp("c"))); 36 | Assert.assertTrue("31".equals(cm.getProp("c1"))); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %> 2 | 3 | 4 | Login 5 | 6 | 7 | 8 |

Login

9 | 10 | 11 | 12 | Your login attempt was not successful, try again.

13 | Reason: . 14 |
15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
User:
Password:
Don't ask for my password for two weeks
26 |
27 | 28 | -------------------------------------------------------------------------------- /client/bin/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 9 | 10 | 11 | 12 | ${log_path}/${app_name}_detail.log 13 | 14 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 15 | 16 | 17 | ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /client/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 9 | 10 | 11 | 12 | ${log_path}/${app_name}_detail.log 13 | 14 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 15 | 16 | 17 | ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /server/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 9 | 10 | 11 | 12 | ${log_path}/${app_name}_detail.log 13 | 14 | %d{yy-MM-dd.HH:mm:ss.SSS} [%-16t] %-5p %-22c{0} - %m%n 15 | 16 | 17 | ${LOG_HOME}/${APP}_detail.log.%d{yyyyMMdd} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/reset.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | reset.css 4 | * Resets default browser CSS. 5 | 6 | -------------------------------------------------------------- */ 7 | 8 | html, body, div, span, object, iframe, 9 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 10 | a, abbr, acronym, address, code, 11 | del, dfn, em, img, q, dl, dt, dd, ol, ul, li, 12 | fieldset, form, label, legend, 13 | table, caption, tbody, tfoot, thead, tr, th, td { 14 | margin: 0; 15 | padding: 0; 16 | border: 0; 17 | font-weight: inherit; 18 | font-style: inherit; 19 | font-size: 100%; 20 | font-family: inherit; 21 | vertical-align: baseline; 22 | } 23 | 24 | body { 25 | line-height: 1.5; 26 | } 27 | 28 | /* Tables still need 'cellspacing="0"' in the markup. */ 29 | table { border-collapse: separate; border-spacing: 0; } 30 | caption, th, td { text-align: left; font-weight: normal; } 31 | table, td, th { vertical-align: middle; } 32 | 33 | /* Remove possible quote marks (") from ,
. */ 34 | blockquote:before, blockquote:after, q:before, q:after { content: ""; } 35 | blockquote, q { quotes: "" ""; } 36 | 37 | /* Remove annoying border on linked images. */ 38 | a img { border: none; } 39 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/print.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | 3 | 4 | Blueprint CSS Framework 0.9 5 | http://blueprintcss.org 6 | 7 | * Copyright (c) 2007-Present. See LICENSE for more info. 8 | * See README for instructions on how to use Blueprint. 9 | * For credits and origins, see AUTHORS. 10 | * This is a compressed file. See the sources in the 'src' directory. 11 | 12 | ----------------------------------------------------------------------- */ 13 | 14 | /* print.css */ 15 | body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;} 16 | .container {background:none;} 17 | hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;} 18 | hr.space {background:#fff;color:#fff;visibility:hidden;} 19 | h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;} 20 | code {font:.9em "Courier New", Monaco, Courier, monospace;} 21 | a img {border:none;} 22 | p img.top {margin-top:0;} 23 | blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;} 24 | .small {font-size:.9em;} 25 | .large {font-size:1.1em;} 26 | .quiet {color:#999;} 27 | .hide {display:none;} 28 | a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;} 29 | a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;} -------------------------------------------------------------------------------- /client/src/test/java/org/opencloudb/mycat/config/client/util/TestCollectionsUtil.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.util; 2 | 3 | import java.io.IOException; 4 | import java.io.StringReader; 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | import java.util.Properties; 9 | 10 | import junit.framework.Assert; 11 | 12 | import org.junit.Test; 13 | 14 | public class TestCollectionsUtil { 15 | 16 | @Test 17 | public void testUnion() { 18 | List list1 = new ArrayList(); 19 | list1.add("1"); 20 | list1.add("2"); 21 | list1.add("3"); 22 | list1.add("4"); 23 | list1.add("5"); 24 | 25 | List list2 = new ArrayList(); 26 | list2.add("2"); 27 | list2.add("3"); 28 | list2.add("4"); 29 | list2.add("5"); 30 | list2.add("6"); 31 | List l1 = CollectionsUtil.unionList(list1, list2); 32 | System.out.println(l1); 33 | 34 | List result = new ArrayList(); 35 | result.add("1"); 36 | result.add("6"); 37 | Assert.assertTrue(Arrays.equals(l1.toArray(), result.toArray())); 38 | } 39 | @Test 40 | public void testProps() { 41 | try { 42 | String s = "a2\nba"; 43 | Properties pro = new Properties(); 44 | pro.load(new StringReader(s)); 45 | System.out.println(pro); 46 | System.out.println(pro.keySet()); 47 | System.out.println(pro.get("a")); 48 | } catch (IOException e) { 49 | e.printStackTrace(); 50 | Assert.fail(e.getMessage()); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/util/NodeDataSerialize.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.util; 2 | 3 | public class NodeDataSerialize { 4 | private static byte[] preContent = new byte[]{-84,-19,0,5,116,0,4}; 5 | 6 | public static byte[] getSrcContent(byte[] content) { 7 | if(content == null) { 8 | return null; 9 | } 10 | byte[] srcContent = null; 11 | 12 | if(startWith(content)) { 13 | srcContent = new byte[content.length - preContent.length]; 14 | System.arraycopy(content, preContent.length, srcContent, 0, srcContent.length); 15 | return srcContent; 16 | } 17 | return content; 18 | } 19 | 20 | 21 | public static byte[] getDestContent(byte[] content) { 22 | if(content == null || content.length == 0) { 23 | return preContent; 24 | } 25 | byte[] destContent = null; 26 | if(!startWith(content)) { 27 | destContent = new byte[content.length + preContent.length]; 28 | System.arraycopy(preContent, 0, destContent, 0, preContent.length); 29 | System.arraycopy(content, 0, destContent, preContent.length, content.length); 30 | return destContent; 31 | } else { 32 | return content; 33 | } 34 | } 35 | 36 | private static boolean startWith(byte[] content) { 37 | if(content != null && content.length >= preContent.length) { 38 | for(int i = 0;i < preContent.length;i++) { 39 | if(preContent[i] != content[i]) { 40 | return false; 41 | } 42 | } 43 | return true; 44 | } 45 | 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/link-icons/screen.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | link-icons.css 4 | * Icons for links based on protocol or file type. 5 | 6 | See the Readme file in this folder for additional instructions. 7 | 8 | -------------------------------------------------------------- */ 9 | 10 | /* Use this class if a link gets an icon when it shouldn't. */ 11 | body a.noicon { 12 | background:transparent none !important; 13 | padding:0 !important; 14 | margin:0 !important; 15 | } 16 | 17 | /* Make sure the icons are not cut */ 18 | a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, 19 | a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], 20 | a[href$=".rdf"], a[href^="aim:"] { 21 | padding:2px 22px 2px 0; 22 | margin:-2px 0; 23 | background-repeat: no-repeat; 24 | background-position: right center; 25 | } 26 | 27 | /* External links */ 28 | a[href^="http:"] { background-image: url(icons/external.png); } 29 | a[href^="mailto:"] { background-image: url(icons/email.png); } 30 | a[href^="http:"]:visited { background-image: url(icons/visited.png); } 31 | 32 | /* Files */ 33 | a[href$=".pdf"] { background-image: url(icons/pdf.png); } 34 | a[href$=".doc"] { background-image: url(icons/doc.png); } 35 | a[href$=".xls"] { background-image: url(icons/xls.png); } 36 | 37 | /* Misc */ 38 | a[href$=".rss"], 39 | a[href$=".rdf"] { background-image: url(icons/feed.png); } 40 | a[href^="aim:"] { background-image: url(icons/im.png); } -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/projectList.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

I18N

14 | <%@include file="../common/menu.jsp" %> 15 |
16 |

模块管理

17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 |
新建模块
模块名语言操作
${project.name} 32 | 33 | | ${lang } 34 | 35 | edit | delete
41 |
42 |
43 | 44 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/controllers/LoginController.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.controllers; 2 | 3 | import java.util.List; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | import org.apache.zookeeper.KeeperException; 8 | import org.opencloudb.mycat.config.server.model.ZkNode; 9 | import org.opencloudb.mycat.config.server.services.ZkBaseService; 10 | import org.opencloudb.mycat.config.server.util.Constant; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Controller; 15 | import org.springframework.ui.Model; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestMethod; 18 | 19 | 20 | @Controller 21 | @RequestMapping(value = "/") 22 | public class LoginController { 23 | 24 | private final static Logger LOGGER = LoggerFactory.getLogger(LoginController.class); 25 | @Autowired 26 | private ZkBaseService zkAjaxService; 27 | 28 | @RequestMapping(value="/login",method = RequestMethod.GET) 29 | public String login(HttpServletRequest request,Model model) { 30 | LOGGER.info("{web-method:index}","{进入系统首页面方法}"); 31 | try { 32 | List znodeList = zkAjaxService.getChildZNodes("/"); 33 | model.addAttribute("znodeList", znodeList); 34 | } catch (KeeperException e) { 35 | e.printStackTrace(); 36 | } catch (InterruptedException e) { 37 | e.printStackTrace(); 38 | } 39 | return Constant.PAGE_COMMON; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/common/head.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | ZK配置管理 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/jquery.treeview.edit.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | var CLASSES = $.treeview.classes; 3 | var proxied = $.fn.treeview; 4 | $.fn.treeview = function(settings) { 5 | settings = $.extend({}, settings); 6 | if (settings.add) { 7 | return this.trigger("add", [settings.add]); 8 | } 9 | if (settings.remove) { 10 | return this.trigger("remove", [settings.remove]); 11 | } 12 | return proxied.apply(this, arguments).bind("add", function(event, branches) { 13 | $(branches).prev() 14 | .removeClass(CLASSES.last) 15 | .removeClass(CLASSES.lastCollapsable) 16 | .removeClass(CLASSES.lastExpandable) 17 | .find(">.hitarea") 18 | .removeClass(CLASSES.lastCollapsableHitarea) 19 | .removeClass(CLASSES.lastExpandableHitarea); 20 | $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, $(this).data("toggler")); 21 | }).bind("remove", function(event, branches) { 22 | var prev = $(branches).prev(); 23 | var parent = $(branches).parent(); 24 | $(branches).remove(); 25 | prev.filter(":last-child").addClass(CLASSES.last) 26 | .filter("." + CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable).end() 27 | .find(">.hitarea").replaceClass(CLASSES.expandableHitarea, CLASSES.lastExpandableHitarea).end() 28 | .filter("." + CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable).end() 29 | .find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.lastCollapsableHitarea); 30 | if (parent.is(":not(:has(>))") && parent[0] != this) { 31 | parent.parent().removeClass(CLASSES.collapsable).removeClass(CLASSES.expandable) 32 | parent.siblings(".hitarea").andSelf().remove(); 33 | } 34 | }); 35 | }; 36 | 37 | })(jQuery); -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | contextConfigLocation 9 | classpath:applicationContext* 10 | 11 | 12 | 13 | 14 | 15 | characterEncodingFilter 16 | org.springframework.web.filter.CharacterEncodingFilter 17 | 18 | 19 | encoding 20 | UTF-8 21 | 22 | 23 | forceEncoding 24 | true 25 | 26 | 27 | 28 | 29 | characterEncodingFilter 30 | /* 31 | 32 | 33 | 34 | org.springframework.web.context.ContextLoaderListener 35 | 36 | 37 | 38 | 39 | 40 | spring-dispatcher 41 | org.springframework.web.servlet.DispatcherServlet 42 | 43 | 44 | contextConfigLocation 45 | 46 | classpath:applicationContext-common.xml 47 | 48 | 49 | 1 50 | 51 | 52 | 53 | spring-dispatcher 54 | / 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/ie.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | 3 | 4 | Blueprint CSS Framework 0.9 5 | http://blueprintcss.org 6 | 7 | * Copyright (c) 2007-Present. See LICENSE for more info. 8 | * See README for instructions on how to use Blueprint. 9 | * For credits and origins, see AUTHORS. 10 | * This is a compressed file. See the sources in the 'src' directory. 11 | 12 | ----------------------------------------------------------------------- */ 13 | 14 | /* ie.css */ 15 | body {text-align:center;} 16 | .container {text-align:left;} 17 | * html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {display:inline;overflow-x:hidden;} 18 | * html legend {margin:0px -8px 16px 0;padding:0;} 19 | sup {vertical-align:text-top;} 20 | sub {vertical-align:text-bottom;} 21 | html>body p code {*white-space:normal;} 22 | hr {margin:-8px auto 11px;} 23 | img {-ms-interpolation-mode:bicubic;} 24 | .clearfix, .container {display:inline-block;} 25 | * html .clearfix, * html .container {height:1%;} 26 | fieldset {padding-top:0;} 27 | textarea {overflow:auto;} 28 | input.text, input.title, textarea {background-color:#fff;border:1px solid #bbb;} 29 | input.text:focus, input.title:focus {border-color:#666;} 30 | input.text, input.title, textarea, select {margin:0.5em 0;} 31 | input.checkbox, input.radio {position:relative;top:.25em;} 32 | form.inline div, form.inline p {vertical-align:middle;} 33 | form.inline label {position:relative;top:-0.25em;} 34 | form.inline input.checkbox, form.inline input.radio, form.inline input.button, form.inline button {margin:0.5em 0;} 35 | button, input.button {position:relative;top:0.25em;} -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/forms.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | forms.css 4 | * Sets up some default styling for forms 5 | * Gives you classes to enhance your forms 6 | 7 | Usage: 8 | * For text fields, use class .title or .text 9 | * For inline forms, use .inline (even when using columns) 10 | 11 | -------------------------------------------------------------- */ 12 | 13 | label { font-weight: bold; } 14 | fieldset { padding:1.4em; margin: 0 0 1.5em 0; border: 1px solid #ccc; } 15 | legend { font-weight: bold; font-size:1.2em; } 16 | 17 | 18 | /* Form fields 19 | -------------------------------------------------------------- */ 20 | 21 | input[type=text], input[type=password], 22 | input.text, input.title, 23 | textarea, select { 24 | background-color:#fff; 25 | border:1px solid #bbb; 26 | } 27 | input[type=text]:focus, input[type=password]:focus, 28 | input.text:focus, input.title:focus, 29 | textarea:focus, select:focus { 30 | border-color:#666; 31 | } 32 | 33 | input[type=text], input[type=password], 34 | input.text, input.title, 35 | textarea, select { 36 | margin:0.5em 0; 37 | } 38 | 39 | input.text, 40 | input.title { width: 300px; padding:5px; } 41 | input.title { font-size:1.5em; } 42 | textarea { width: 390px; height: 250px; padding:5px; } 43 | 44 | input[type=checkbox], input[type=radio], 45 | input.checkbox, input.radio { 46 | position:relative; top:.25em; 47 | } 48 | 49 | form.inline { line-height:3; } 50 | form.inline p { margin-bottom:0; } 51 | 52 | 53 | /* Success, notice and error boxes 54 | -------------------------------------------------------------- */ 55 | 56 | .error, 57 | .notice, 58 | .success { padding: .8em; margin-bottom: 1em; border: 2px solid #ddd; } 59 | 60 | .error { background: #FBE3E4; color: #8a1f11; border-color: #FBC2C4; } 61 | .notice { background: #FFF6BF; color: #514721; border-color: #FFD324; } 62 | .success { background: #E6EFC2; color: #264409; border-color: #C6D880; } 63 | .error a { color: #8a1f11; } 64 | .notice a { color: #514721; } 65 | .success a { color: #264409; } 66 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/propertyList.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

I18N

14 | <%@include file="../common/menu.jsp" %> 15 |
16 |

属性管理

17 |

${projName }

18 |
19 | 20 | 21 | checked="checked" value="0" />key 22 | checked="checked" value="1" />value 23 |
24 |
25 |
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Refresh
Key${lang }Create TimeUpdate TimeDescriptionAction
44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 |
52 |
53 |
54 |
55 | 56 | -------------------------------------------------------------------------------- /client/src/test/java/org/opencloudb/mycat/config/client/TestZooKeeperClient.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client; 2 | 3 | import junit.framework.Assert; 4 | 5 | import org.I0Itec.zkclient.ZkClient; 6 | import org.apache.zookeeper.CreateMode; 7 | import org.junit.Before; 8 | import org.junit.Test; 9 | 10 | public class TestZooKeeperClient { 11 | 12 | private String hosts = "192.168.44.136:2181"; 13 | 14 | private int timeout = 30 * 1000; 15 | 16 | private IConfig client; 17 | 18 | private ZkClient zkClient; 19 | 20 | @Before 21 | public void setUp() { 22 | client = new ZooKeeperClient(hosts, timeout, "/config"); 23 | zkClient = new ZkClient(hosts, timeout); 24 | } 25 | 26 | @Test 27 | public void testInit() { 28 | Assert.assertNotNull(client); 29 | Assert.assertNotNull(zkClient); 30 | } 31 | @Test 32 | public void testMonitor() { 33 | this.waitSecond(10000); 34 | } 35 | 36 | @Test 37 | public void testInitData() { 38 | String path = "/config/abc"; 39 | if(zkClient.exists(path)) { 40 | zkClient.deleteRecursive(path); 41 | } 42 | zkClient.create(path, "hello", CreateMode.PERSISTENT); 43 | 44 | } 45 | 46 | @Test 47 | public void testCreate() { 48 | String path = "/config/testprop/delete1"; 49 | if(zkClient.exists(path)) { 50 | zkClient.delete(path); 51 | waitSecond(1); 52 | Assert.assertNull(client.getProp("delete")); 53 | } 54 | 55 | zkClient.create(path, "delete=haha", CreateMode.PERSISTENT); 56 | waitSecond(1); 57 | Assert.assertTrue("haha".equals(client.getProp("delete"))); 58 | zkClient.writeData(path, "delete=hehe"); 59 | waitSecond(1); 60 | Assert.assertTrue("hehe".equals(client.getProp("delete"))); 61 | 62 | zkClient.writeData(path, "delete=hehe\nhello=world"); 63 | waitSecond(1); 64 | Assert.assertTrue("world".equals(client.getProp("hello"))); 65 | 66 | waitSecond(1); 67 | Assert.assertTrue("delete=hehe\nhello=world".equals(client.getProp("/config/testprop/delete1"))); 68 | 69 | waitSecond(100); 70 | } 71 | 72 | private void waitSecond(int sec) { 73 | try { 74 | Thread.sleep(sec * 1000); 75 | } catch (InterruptedException e) { 76 | e.printStackTrace(); 77 | Assert.fail(e.getMessage()); 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/propertyEdit.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

I18N

14 | <%@include file="../common/menu.jsp" %> 15 |
16 |

属性编辑

17 |

${projName }

18 |
19 |
style="display: none">${errMsg }
20 | 21 |
22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 37 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 |
27 | 28 | 29 |
34 | 35 | 36 | 38 | 39 |
45 | 46 |
50 |
51 | 52 | 53 | 54 |
55 |
56 |
57 |
58 | 59 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/print.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | print.css 4 | * Gives you some sensible styles for printing pages. 5 | * See Readme file in this directory for further instructions. 6 | 7 | Some additions you'll want to make, customized to your markup: 8 | #header, #footer, #navigation { display:none; } 9 | 10 | -------------------------------------------------------------- */ 11 | 12 | body { 13 | line-height: 1.5; 14 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 15 | color:#000; 16 | background: none; 17 | font-size: 10pt; 18 | } 19 | 20 | 21 | /* Layout 22 | -------------------------------------------------------------- */ 23 | 24 | .container { 25 | background: none; 26 | } 27 | 28 | hr { 29 | background:#ccc; 30 | color:#ccc; 31 | width:100%; 32 | height:2px; 33 | margin:2em 0; 34 | padding:0; 35 | border:none; 36 | } 37 | hr.space { 38 | background: #fff; 39 | color: #fff; 40 | visibility: hidden; 41 | } 42 | 43 | 44 | /* Text 45 | -------------------------------------------------------------- */ 46 | 47 | h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; } 48 | code { font:.9em "Courier New", Monaco, Courier, monospace; } 49 | 50 | a img { border:none; } 51 | p img.top { margin-top: 0; } 52 | 53 | blockquote { 54 | margin:1.5em; 55 | padding:1em; 56 | font-style:italic; 57 | font-size:.9em; 58 | } 59 | 60 | .small { font-size: .9em; } 61 | .large { font-size: 1.1em; } 62 | .quiet { color: #999; } 63 | .hide { display:none; } 64 | 65 | 66 | /* Links 67 | -------------------------------------------------------------- */ 68 | 69 | a:link, a:visited { 70 | background: transparent; 71 | font-weight:700; 72 | text-decoration: underline; 73 | } 74 | 75 | a:link:after, a:visited:after { 76 | content: " (" attr(href) ")"; 77 | font-size: 90%; 78 | } 79 | 80 | /* If you're having trouble printing relative links, uncomment and customize this: 81 | (note: This is valid CSS3, but it still won't go through the W3C CSS Validator) */ 82 | 83 | /* a[href^="/"]:after { 84 | content: " (http://www.yourdomain.com" attr(href) ") "; 85 | } */ 86 | -------------------------------------------------------------------------------- /server/src/test/java/org/opencloudb/mycat/config/server/util/TestNodeDataSerialize.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.util; 2 | 3 | import java.io.Serializable; 4 | import java.util.Arrays; 5 | 6 | import org.I0Itec.zkclient.serialize.SerializableSerializer; 7 | import org.junit.Assert; 8 | import org.junit.Test; 9 | 10 | public class TestNodeDataSerialize { 11 | private static byte[] preContent = new byte[]{-84,-19,0,5,116,0,4}; 12 | 13 | @Test 14 | public void testNull() { 15 | byte[] content = null; 16 | Assert.assertNull(NodeDataSerialize.getSrcContent(content)); 17 | } 18 | @Test 19 | public void testSrcTrue() { 20 | byte[] content = new byte[]{-84,-19,0,5,116,0,4,31,21}; 21 | Assert.assertTrue(NodeDataSerialize.getSrcContent(content).length == 2); 22 | byte[] c2 = new byte[]{31,21}; 23 | Assert.assertTrue(Arrays.equals(NodeDataSerialize.getSrcContent(content), c2)); 24 | } 25 | @Test 26 | public void testSrcNull() { 27 | byte[] content = new byte[]{-84,-19,0,5,116,0,13,49,48,46,52,53,46,50,53,51,46,49,54,51}; 28 | System.out.println(NodeDataSerialize.getSrcContent(content)); 29 | } 30 | 31 | @Test 32 | public void testSeriaNull() { 33 | byte[] content = null; 34 | Assert.assertTrue(Arrays.equals(preContent, NodeDataSerialize.getDestContent(content))); 35 | } 36 | 37 | @Test 38 | public void testSeriaContent() { 39 | byte[] content = "hehe".getBytes(); 40 | System.out.println(new String(NodeDataSerialize.getDestContent(content))); 41 | } 42 | @Test 43 | public void testSerialized() { 44 | String s = "hello"; 45 | SerializableSerializer seria = new SerializableSerializer(); 46 | 47 | TestSeria ts = new TestSeria(); 48 | ts.s = "hello"; 49 | 50 | byte[] content = seria.serialize(s); 51 | print(content); 52 | print(s.getBytes()); 53 | print(seria.serialize(ts)); 54 | } 55 | 56 | private void print(byte[] arrs) { 57 | for(byte t : arrs) { 58 | System.out.print(t + "\t"); 59 | } 60 | System.out.println(""); 61 | } 62 | 63 | } 64 | class TestSeria implements Serializable { 65 | /** 66 | * 67 | */ 68 | private static final long serialVersionUID = 468376151463091875L; 69 | /** 70 | * 71 | */ 72 | { 73 | System.out.println("out"); 74 | } 75 | TestSeria(){ 76 | System.out.println("in"); 77 | } 78 | String s; 79 | } -------------------------------------------------------------------------------- /client/bin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.opencloudb.mycat 8 | Mycat-config 9 | 0.0.1-SNAPSHOT 10 | 11 | client 12 | client 13 | http://maven.apache.org 14 | 15 | UTF-8 16 | 17 | 18 | 19 | org.apache.zookeeper 20 | zookeeper 21 | 22 | 23 | log4j 24 | log4j 25 | 26 | 27 | slf4j-log4j12 28 | org.slf4j 29 | 30 | 31 | 3.4.6 32 | 33 | 34 | com.101tec 35 | zkclient 36 | 0.2 37 | 38 | 39 | 40 | 41 | 42 | ch.qos.logback 43 | logback-classic 44 | 1.1.2 45 | 46 | 47 | ch.qos.logback 48 | logback-core 49 | 1.1.2 50 | 51 | 52 | org.slf4j 53 | slf4j-api 54 | 1.7.5 55 | 56 | 57 | org.slf4j 58 | jcl-over-slf4j 59 | 1.7.5 60 | 61 | 62 | org.slf4j 63 | log4j-over-slf4j 64 | 1.7.5 65 | 66 | 67 | 68 | 69 | junit 70 | junit 71 | 4.10 72 | test 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.opencloudb.mycat 8 | Mycat-config 9 | 0.0.1-SNAPSHOT 10 | 11 | client 12 | client 13 | http://maven.apache.org 14 | 15 | UTF-8 16 | 17 | 18 | 19 | org.apache.zookeeper 20 | zookeeper 21 | 22 | 23 | log4j 24 | log4j 25 | 26 | 27 | slf4j-log4j12 28 | org.slf4j 29 | 30 | 31 | 3.4.6 32 | 33 | 34 | com.101tec 35 | zkclient 36 | 0.2 37 | 38 | 39 | 40 | 41 | 42 | ch.qos.logback 43 | logback-classic 44 | 1.1.2 45 | 46 | 47 | ch.qos.logback 48 | logback-core 49 | 1.1.2 50 | 51 | 52 | org.slf4j 53 | slf4j-api 54 | 1.7.5 55 | 56 | 57 | org.slf4j 58 | jcl-over-slf4j 59 | 1.7.5 60 | 61 | 62 | org.slf4j 63 | log4j-over-slf4j 64 | 1.7.5 65 | 66 | 67 | 68 | 69 | junit 70 | junit 71 | 4.10 72 | test 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/html5shiv.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); 8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

14 | ZK Configration Admin 15 |

16 | <%@include file="../common/menu.jsp" %> 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 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 63 | 64 | 65 | 66 | 67 | 68 |
${path }
dbnamemodeserver1server2bizNamesdbstatusop
host:portstatuswrflagtokenhost:portstatuswrflagtoken
create
${dbConfig.dbname}${dbConfig.mode}${server.host }:${server.port }${server.status }${server.wrflag }${server.token } 59 | 60 | ${bizName }
61 |
62 |
${dbConfig.dbstatus }edit
69 |
70 |
71 | 72 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/fancy-type/screen.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | fancy-type.css 4 | * Lots of pretty advanced classes for manipulating text. 5 | 6 | See the Readme file in this folder for additional instructions. 7 | 8 | -------------------------------------------------------------- */ 9 | 10 | /* Indentation instead of line shifts for sibling paragraphs. */ 11 | p + p { text-indent:2em; margin-top:-1.5em; } 12 | form p + p { text-indent: 0; } /* Don't want this in forms. */ 13 | 14 | 15 | /* For great looking type, use this code instead of asdf: 16 | asdf 17 | Best used on prepositions and ampersands. */ 18 | 19 | .alt { 20 | color: #666; 21 | font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif; 22 | font-style: italic; 23 | font-weight: normal; 24 | } 25 | 26 | 27 | /* For great looking quote marks in titles, replace "asdf" with: 28 | asdf” 29 | (That is, when the title starts with a quote mark). 30 | (You may have to change this value depending on your font size). */ 31 | 32 | .dquo { margin-left: -.5em; } 33 | 34 | 35 | /* Reduced size type with incremental leading 36 | (http://www.markboulton.co.uk/journal/comments/incremental_leading/) 37 | 38 | This could be used for side notes. For smaller type, you don't necessarily want to 39 | follow the 1.5x vertical rhythm -- the line-height is too much. 40 | 41 | Using this class, it reduces your font size and line-height so that for 42 | every four lines of normal sized type, there is five lines of the sidenote. eg: 43 | 44 | New type size in em's: 45 | 10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems) 46 | 47 | New line-height value: 48 | 12px x 1.5 = 18px (old line-height) 49 | 18px x 4 = 72px 50 | 72px / 5 = 14.4px (new line height) 51 | 14.4px / 10px = 1.44 (new line height in em's) */ 52 | 53 | p.incr, .incr p { 54 | font-size: 10px; 55 | line-height: 1.44em; 56 | margin-bottom: 1.5em; 57 | } 58 | 59 | 60 | /* Surround uppercase words and abbreviations with this class. 61 | Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] */ 62 | 63 | .caps { 64 | font-variant: small-caps; 65 | letter-spacing: 1px; 66 | text-transform: lowercase; 67 | font-size:1.2em; 68 | line-height:1%; 69 | font-weight:bold; 70 | padding:0 2px; 71 | } 72 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/propertyNew.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

I18N

14 | <%@include file="../common/menu.jsp" %> 15 |
16 |

属性添加

17 |

${projName }

18 |
19 |
style="display: none">${errMsg }
20 | 21 |
22 | 23 | 24 | 25 | 26 | 29 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 50 | 53 | 54 | 55 | 56 | 57 | 60 | 61 | 62 |
27 | 28 | 30 | 31 |
${key } 37 | 38 |
47 | 48 | 49 | 51 | 52 |
58 | 59 |
63 |
64 | 65 | 66 | 67 |
68 |
69 |
70 |
71 | 72 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/projectEdit.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
13 |

I18N

14 | <%@include file="../common/menu.jsp" %> 15 |
16 |

模块编辑

17 |
18 |
style="display: none">${errMsg }
19 | 20 |
21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
26 | 27 |
33 | 34 |
46 | default 47 | 48 |
55 | ${language } 56 | 57 |
65 |
66 | 67 | 68 |
69 |
70 |
71 |
72 | 73 | -------------------------------------------------------------------------------- /server/src/main/resources/applicationContext-common.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 60 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/ie.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | ie.css 4 | 5 | Contains every hack for Internet Explorer, 6 | so that our core files stay sweet and nimble. 7 | 8 | -------------------------------------------------------------- */ 9 | 10 | /* Make sure the layout is centered in IE5 */ 11 | body { text-align: center; } 12 | .container { text-align: left; } 13 | 14 | /* Fixes IE margin bugs */ 15 | * html .column, * html div.span-1, * html div.span-2, 16 | * html div.span-3, * html div.span-4, * html div.span-5, 17 | * html div.span-6, * html div.span-7, * html div.span-8, 18 | * html div.span-9, * html div.span-10, * html div.span-11, 19 | * html div.span-12, * html div.span-13, * html div.span-14, 20 | * html div.span-15, * html div.span-16, * html div.span-17, 21 | * html div.span-18, * html div.span-19, * html div.span-20, 22 | * html div.span-21, * html div.span-22, * html div.span-23, 23 | * html div.span-24 { display:inline; overflow-x: hidden; } 24 | 25 | 26 | /* Elements 27 | -------------------------------------------------------------- */ 28 | 29 | /* Fixes incorrect styling of legend in IE6. */ 30 | * html legend { margin:0px -8px 16px 0; padding:0; } 31 | 32 | /* Fixes wrong line-height on sup/sub in IE. */ 33 | sup { vertical-align:text-top; } 34 | sub { vertical-align:text-bottom; } 35 | 36 | /* Fixes IE7 missing wrapping of code elements. */ 37 | html>body p code { *white-space: normal; } 38 | 39 | /* IE 6&7 has problems with setting proper
margins. */ 40 | hr { margin:-8px auto 11px; } 41 | 42 | /* Explicitly set interpolation, allowing dynamically resized images to not look horrible */ 43 | img { -ms-interpolation-mode:bicubic; } 44 | 45 | /* Clearing 46 | -------------------------------------------------------------- */ 47 | 48 | /* Makes clearfix actually work in IE */ 49 | .clearfix, .container { display:inline-block; } 50 | * html .clearfix, 51 | * html .container { height:1%; } 52 | 53 | 54 | /* Forms 55 | -------------------------------------------------------------- */ 56 | 57 | /* Fixes padding on fieldset */ 58 | fieldset { padding-top:0; } 59 | 60 | /* Makes classic textareas in IE 6 resemble other browsers */ 61 | textarea { overflow:auto; } 62 | 63 | /* Fixes rule that IE 6 ignores */ 64 | input.text, input.title, textarea { background-color:#fff; border:1px solid #bbb; } 65 | input.text:focus, input.title:focus { border-color:#666; } 66 | input.text, input.title, textarea, select { margin:0.5em 0; } 67 | input.checkbox, input.radio { position:relative; top:.25em; } 68 | 69 | /* Fixes alignment of inline form elements */ 70 | form.inline div, form.inline p { vertical-align:middle; } 71 | form.inline label { position:relative;top:-0.25em; } 72 | form.inline input.checkbox, form.inline input.radio, 73 | form.inline input.button, form.inline button { 74 | margin:0.5em 0; 75 | } 76 | button, input.button { position:relative;top:0.25em; } -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/model/ZkNode.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.model; 2 | 3 | import org.apache.commons.lang3.builder.ToStringBuilder; 4 | import org.apache.zookeeper.data.Stat; 5 | 6 | public class ZkNode { 7 | 8 | // 节点ID 9 | private String id; 10 | 11 | // 节点名称 12 | private String name; 13 | 14 | // 节点路径 15 | private String path; 16 | 17 | // 节点内容 18 | private String data; 19 | 20 | // 节点状态 21 | private Stat stat; 22 | 23 | // 节点创建时间 24 | private String ctime; 25 | 26 | // 节点修改时间 27 | private String mtime; 28 | 29 | /** 30 | * @return the id 31 | */ 32 | public String getId() { 33 | return id; 34 | } 35 | 36 | /** 37 | * @param id 38 | * the id to set 39 | */ 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | /** 45 | * @return the name 46 | */ 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | /** 52 | * @param name 53 | * the name to set 54 | */ 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | /** 60 | * @return the path 61 | */ 62 | public String getPath() { 63 | return path; 64 | } 65 | 66 | /** 67 | * @param path 68 | * the path to set 69 | */ 70 | public void setPath(String path) { 71 | this.path = path; 72 | } 73 | 74 | /** 75 | * @return the stat 76 | */ 77 | public Stat getStat() { 78 | return stat; 79 | } 80 | 81 | /** 82 | * @param stat 83 | * the stat to set 84 | */ 85 | public void setStat(Stat stat) { 86 | this.stat = stat; 87 | } 88 | 89 | /** 90 | * @return the data 91 | */ 92 | public String getData() { 93 | return data; 94 | } 95 | 96 | /** 97 | * @param data 98 | * the data to set 99 | */ 100 | public void setData(String data) { 101 | this.data = data; 102 | } 103 | 104 | /** 105 | * @return the ctime 106 | */ 107 | public String getCtime() { 108 | return ctime; 109 | } 110 | 111 | /** 112 | * @param ctime 113 | * the ctime to set 114 | */ 115 | public void setCtime(String ctime) { 116 | this.ctime = ctime; 117 | } 118 | 119 | /** 120 | * @return the mtime 121 | */ 122 | public String getMtime() { 123 | return mtime; 124 | } 125 | 126 | /** 127 | * @param mtime 128 | * the mtime to set 129 | */ 130 | public void setMtime(String mtime) { 131 | this.mtime = mtime; 132 | } 133 | 134 | @Override 135 | public String toString() { 136 | return ToStringBuilder.reflectionToString(this); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/listener/DataMonitor.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.listener; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | import java.util.concurrent.CopyOnWriteArrayList; 6 | 7 | import org.I0Itec.zkclient.IZkChildListener; 8 | import org.I0Itec.zkclient.IZkDataListener; 9 | import org.opencloudb.mycat.config.client.ZooKeeperClient; 10 | import org.opencloudb.mycat.config.client.store.ConfigMap; 11 | import org.opencloudb.mycat.config.client.util.CollectionsUtil; 12 | import org.opencloudb.mycat.config.client.util.PathUtil; 13 | import org.opencloudb.mycat.config.client.util.StringUtils; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | 17 | 18 | /** 19 | * Zookeeper监听器 20 | * 21 | */ 22 | public class DataMonitor implements IZkChildListener, IZkDataListener { 23 | 24 | private static Logger logger = LoggerFactory.getLogger(DataMonitor.class); 25 | 26 | private static ZooKeeperClient zookeeperClient; 27 | 28 | private static DataMonitor instance; 29 | 30 | private DataMonitor(){} 31 | 32 | public static DataMonitor getInstance(ZooKeeperClient zk) { 33 | zookeeperClient = zk; 34 | if(instance == null) { 35 | instance = new DataMonitor(); 36 | } 37 | return instance; 38 | } 39 | 40 | @Override 41 | public void handleDataChange(String dataPath, Object data) throws Exception { 42 | logger.info("数据发生变化:" + dataPath); 43 | ConfigMap map = ConfigMap.getInstance(); 44 | map.put(dataPath, data == null ? "" : data.toString()); 45 | logger.info("变化后数据:" + map.getPathMap()); 46 | } 47 | 48 | @Override 49 | public void handleDataDeleted(String dataPath) throws Exception { 50 | logger.info("删除节点:" + dataPath); 51 | ConfigMap map = ConfigMap.getInstance(); 52 | map.remove(dataPath); 53 | zookeeperClient.unregister(dataPath); 54 | logger.info("变化后数据:" + map.getPathMap()); 55 | } 56 | 57 | @Override 58 | public void handleChildChange(String parentPath, List currentChilds) throws Exception { 59 | logger.info("子节点发生变动:" + parentPath + "::::::" + zookeeperClient.exists(parentPath)); 60 | logger.debug("currentChilds:" + currentChilds); 61 | ConfigMap allMap = ConfigMap.getInstance(); 62 | List oldChild = new CopyOnWriteArrayList(); 63 | Set keys = allMap.getPathMap().keySet(); 64 | for(String key : keys) { 65 | if(key.startsWith(parentPath) && !key.equals(parentPath)) { 66 | oldChild.add(key.substring((parentPath + PathUtil.NODE_SEPERATOR).length())); 67 | } 68 | } 69 | 70 | List changeList = CollectionsUtil.unionList(oldChild, currentChilds); 71 | logger.debug(oldChild + "changeList:" + changeList); 72 | for(String path : changeList) { 73 | String dataPath = PathUtil.concatPath(parentPath, path); 74 | if(zookeeperClient.exists(dataPath)) { 75 | zookeeperClient.register(dataPath); 76 | String value = zookeeperClient.read(dataPath); 77 | if(StringUtils.isNotEmpty(value)) { 78 | allMap.put(dataPath, value); 79 | } 80 | 81 | } else { 82 | allMap.remove(dataPath); 83 | } 84 | } 85 | logger.info("变化后的数据:" + allMap); 86 | 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/jquery.treeview.css: -------------------------------------------------------------------------------- 1 | .treeview, .treeview ul { 2 | padding: 0; 3 | margin: 0; 4 | list-style: none; 5 | } 6 | 7 | .treeview ul { 8 | background-color: white; 9 | margin-top: 4px; 10 | } 11 | 12 | .treeview .hitarea { 13 | background: url(images/treeview-default.gif) -64px -25px no-repeat; 14 | height: 16px; 15 | width: 16px; 16 | margin-left: -16px; 17 | float: left; 18 | cursor: pointer; 19 | } 20 | /* fix for IE6 */ 21 | * html .hitarea { 22 | display: inline; 23 | float:none; 24 | } 25 | 26 | .treeview li { 27 | margin: 0; 28 | padding: 3px 0pt 3px 16px; 29 | } 30 | 31 | .treeview a.selected { 32 | background-color: #eee; 33 | } 34 | 35 | #treecontrol { margin: 1em 0; display: none; } 36 | 37 | .treeview .hover { color: red; cursor: pointer; } 38 | 39 | .treeview li { background: url(images/treeview-default-line.gif) 0 0 no-repeat; } 40 | .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; } 41 | 42 | .treeview .expandable-hitarea { background-position: -80px -3px; } 43 | 44 | .treeview li.last { background-position: 0 -1766px } 45 | .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(images/treeview-default.gif); } 46 | .treeview li.lastCollapsable { background-position: 0 -111px } 47 | .treeview li.lastExpandable { background-position: -32px -67px } 48 | 49 | .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; } 50 | 51 | .treeview-red li { background-image: url(images/treeview-red-line.gif); } 52 | .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(images/treeview-red.gif); } 53 | 54 | .treeview-black li { background-image: url(images/treeview-black-line.gif); } 55 | .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(images/treeview-black.gif); } 56 | 57 | .treeview-gray li { background-image: url(images/treeview-gray-line.gif); } 58 | .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(images/treeview-gray.gif); } 59 | 60 | .treeview-famfamfam li { background-image: url(images/treeview-famfamfam-line.gif); } 61 | .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(images/treeview-famfamfam.gif); } 62 | 63 | .treeview .placeholder { 64 | background: url(images/ajax-loader.gif) 0 0 no-repeat; 65 | height: 16px; 66 | width: 16px; 67 | display: block; 68 | } 69 | 70 | .filetree li { padding: 3px 0 2px 16px; } 71 | .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; } 72 | .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; } 73 | .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; } 74 | .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; } 75 | 76 | .filetree .selfile{ 77 | padding: 1px 0 1px 16px; display: block; 78 | background: #eeeeee url(images/file.gif) 0 0 no-repeat; 79 | } 80 | 81 | .filetree .selfolder{ 82 | padding: 1px 0 1px 16px; display: block; 83 | background: #eeeeee url(images/folder.gif) 0 0 no-repeat; 84 | } 85 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/json.min.js: -------------------------------------------------------------------------------- 1 | if(!this.JSON)this.JSON={}; 2 | (function(){function k(a){return a<10?"0"+a:a}function n(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(c){var d=q[c];return typeof d==="string"?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,c){var d,f,i=g,e,b=c[a];if(b&&typeof b==="object"&&typeof b.toJSON==="function")b=b.toJSON(a);if(typeof j==="function")b=j.call(c,a,b);switch(typeof b){case "string":return n(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b); 3 | case "object":if(!b)return"null";g+=m;e=[];if(Object.prototype.toString.apply(b)==="[object Array]"){f=b.length;for(a=0;a").attr("id", this.id || "").html("" + this.text + "").appendTo(parent); 21 | if (this.classes) { 22 | current.children("span").addClass(this.classes); 23 | } 24 | if (this.expanded) { 25 | current.addClass("open"); 26 | } 27 | if (this.hasChildren || this.children && this.children.length) { 28 | var branch = $("
    ").appendTo(current); 29 | if (this.hasChildren) { 30 | current.addClass("hasChildren"); 31 | createNode.call({ 32 | classes: "placeholder", 33 | text: " ", 34 | children:[] 35 | }, branch); 36 | } 37 | if (this.children && this.children.length) { 38 | $.each(this.children, createNode, [branch]) 39 | } 40 | } 41 | } 42 | $.ajax($.extend(true, { 43 | url: settings.url, 44 | dataType: "json", 45 | data: { 46 | root: root 47 | }, 48 | success: function(response) { 49 | child.empty(); 50 | $.each(response, createNode, [child]); 51 | $(container).treeview({add: child}); 52 | } 53 | }, settings.ajax)); 54 | /* 55 | $.getJSON(settings.url, {root: root}, function(response) { 56 | function createNode(parent) { 57 | var current = $("
  • ").attr("id", this.id || "").html("" + this.text + "").appendTo(parent); 58 | if (this.classes) { 59 | current.children("span").addClass(this.classes); 60 | } 61 | if (this.expanded) { 62 | current.addClass("open"); 63 | } 64 | if (this.hasChildren || this.children && this.children.length) { 65 | var branch = $("
      ").appendTo(current); 66 | if (this.hasChildren) { 67 | current.addClass("hasChildren"); 68 | createNode.call({ 69 | classes: "placeholder", 70 | text: " ", 71 | children:[] 72 | }, branch); 73 | } 74 | if (this.children && this.children.length) { 75 | $.each(this.children, createNode, [branch]) 76 | } 77 | } 78 | } 79 | child.empty(); 80 | $.each(response, createNode, [child]); 81 | $(container).treeview({add: child}); 82 | }); 83 | */ 84 | } 85 | 86 | var proxied = $.fn.treeview; 87 | $.fn.treeview = function(settings) { 88 | if (!settings.url) { 89 | return proxied.apply(this, arguments); 90 | } 91 | var container = this; 92 | if (!container.children().size()) 93 | load(settings, "source", this, container); 94 | var userToggle = settings.toggle; 95 | return proxied.call(this, $.extend({}, settings, { 96 | collapsed: true, 97 | toggle: function() { 98 | var $this = $(this); 99 | if ($this.hasClass("hasChildren")) { 100 | var childList = $this.removeClass("hasChildren").find("ul"); 101 | load(settings, this.id, childList, container); 102 | } 103 | if (userToggle) { 104 | userToggle.apply(this, arguments); 105 | } 106 | } 107 | })); 108 | }; 109 | 110 | })(jQuery); -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/pageEdit.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
      13 |

      I18N

      14 | <%@include file="../common/menu.jsp" %> 15 |
      16 |

      PrivewPage编辑页

      17 |
      18 |
      style="display: none">${errMsg }
      19 | 20 |
      21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 |
      27 | 28 |
      34 | 35 | 36 | 37 | 38 | 39 | 40 |
      45 | 46 |
      51 | 52 |
      58 | 59 |
      65 | 66 |
      70 |
      71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
      79 |
      80 |
      81 |
      82 | 83 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/store/ConfigMap.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client.store; 2 | 3 | import java.io.IOException; 4 | import java.io.StringReader; 5 | import java.util.Map; 6 | import java.util.Map.Entry; 7 | import java.util.HashMap; 8 | import java.util.Properties; 9 | import java.util.Set; 10 | import java.util.concurrent.ConcurrentHashMap; 11 | 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | /** 16 | * 存储所有配置属性 17 | * 18 | */ 19 | public class ConfigMap { 20 | 21 | private static Logger logger = LoggerFactory.getLogger(ConfigMap.class); 22 | 23 | private static final Map> propsMap = new ConcurrentHashMap>(); 24 | 25 | private static final Map pathMap = new ConcurrentHashMap(); 26 | 27 | public Map getPathMap() { 28 | return pathMap; 29 | } 30 | 31 | public Map> getPropsmap() { 32 | return propsMap; 33 | } 34 | 35 | /** 36 | * 遍历各节点的map,查找该key对应的值 37 | * @param key 38 | * @return 39 | */ 40 | public String getProp(String key) { 41 | logger.debug("获取值:",key); 42 | String value = null; 43 | Set>> entryProps = propsMap.entrySet(); 44 | for(Entry> e : entryProps) { 45 | value = e.getValue().get(key); 46 | if(value != null) { 47 | logger.debug("返回值:",value); 48 | return value; 49 | } 50 | } 51 | 52 | Set> entryPath = pathMap.entrySet(); 53 | for(Entry e : entryPath) { 54 | if(key.equals(e.getKey())) { 55 | value = e.getValue(); 56 | } 57 | if(value != null) { 58 | logger.debug("返回值:",value); 59 | return value; 60 | } 61 | } 62 | return value; 63 | } 64 | 65 | public void put(String path,String value) { 66 | logger.debug("更新数据,节点路径:" + path); 67 | logger.debug("节点值:" + value); 68 | pathMap.put(path, value); 69 | updateProps(path,value); 70 | } 71 | 72 | public void remove(String path) { 73 | logger.debug("删除节点:" + path); 74 | pathMap.remove(path); 75 | propsMap.remove(path); 76 | } 77 | 78 | 79 | private void updateProps(String path,String value) { 80 | 81 | StringReader reader = new StringReader(value); 82 | Map nodeMap = new HashMap(); 83 | try { 84 | Properties ps = new Properties(); 85 | ps.load(reader); 86 | nodeMap.clear(); 87 | Set keys = ps.keySet(); 88 | for(Object key : keys) { 89 | String k = (String) key; 90 | String v = ps.getProperty(k); 91 | nodeMap.put(k, v); 92 | } 93 | propsMap.put(path, nodeMap); 94 | } catch(ClassCastException e) { 95 | e.printStackTrace(); 96 | logger.error(e.getClass().getName(),e.getMessage()); 97 | } catch(IOException e) { 98 | e.printStackTrace(); 99 | logger.error(e.getClass().getName(),e.getMessage()); 100 | } catch(Exception e) { 101 | e.printStackTrace(); 102 | logger.error(e.getClass().getName(),e.getMessage()); 103 | } 104 | logger.debug("更新后的数据:" + propsMap); 105 | } 106 | 107 | 108 | 109 | private static ConfigMap instance; 110 | 111 | public static ConfigMap getInstance() { 112 | if(instance == null) { 113 | synchronized (ConfigMap.class){ 114 | if(instance == null) { 115 | instance = new ConfigMap(); 116 | } 117 | } 118 | instance = new ConfigMap(); 119 | } 120 | return instance; 121 | } 122 | 123 | private ConfigMap(){} 124 | } 125 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/src/typography.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | typography.css 4 | * Sets up some sensible default typography. 5 | 6 | -------------------------------------------------------------- */ 7 | 8 | /* Default font settings. 9 | The font-size percentage is of 16px. (0.75 * 16px = 12px) */ 10 | html { font-size:100.01%; } 11 | body { 12 | font-size: 75%; 13 | color: #222; 14 | background: #fff; 15 | font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; 16 | } 17 | 18 | 19 | /* Headings 20 | -------------------------------------------------------------- */ 21 | 22 | h1,h2,h3,h4,h5,h6 { font-weight: normal; color: #111; } 23 | 24 | h1 { font-size: 3em; line-height: 1; margin-bottom: 0.5em; } 25 | h2 { font-size: 2em; margin-bottom: 0.75em; } 26 | h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1em; } 27 | h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; } 28 | h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.5em; } 29 | h6 { font-size: 1em; font-weight: bold; } 30 | 31 | h1 img, h2 img, h3 img, 32 | h4 img, h5 img, h6 img { 33 | margin: 0; 34 | } 35 | 36 | 37 | /* Text elements 38 | -------------------------------------------------------------- */ 39 | 40 | p { margin: 0 0 1.5em; } 41 | p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } 42 | p img.right { float: right; margin: 1.5em 0 1.5em 1.5em; } 43 | 44 | a:focus, 45 | a:hover { color: #000; } 46 | a { color: #009; text-decoration: underline; } 47 | 48 | blockquote { margin: 1.5em; color: #666; font-style: italic; } 49 | strong { font-weight: bold; } 50 | em,dfn { font-style: italic; } 51 | dfn { font-weight: bold; } 52 | sup, sub { line-height: 0; } 53 | 54 | abbr, 55 | acronym { border-bottom: 1px dotted #666; } 56 | address { margin: 0 0 1.5em; font-style: italic; } 57 | del { color:#666; } 58 | 59 | pre { margin: 1.5em 0; white-space: pre; } 60 | pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } 61 | 62 | 63 | /* Lists 64 | -------------------------------------------------------------- */ 65 | 66 | li ul, 67 | li ol { margin: 0; } 68 | ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 3.333em; } 69 | 70 | ul { list-style-type: disc; } 71 | ol { list-style-type: decimal; } 72 | 73 | dl { margin: 0 0 1.5em 0; } 74 | dl dt { font-weight: bold; } 75 | dd { margin-left: 1.5em;} 76 | 77 | 78 | /* Tables 79 | -------------------------------------------------------------- */ 80 | 81 | table { margin-bottom: 1.4em; width:100%; } 82 | th { font-weight: bold; } 83 | thead th { background: #c3d9ff; } 84 | th,td,caption { padding: 4px 10px 4px 5px; } 85 | tr.even td { background: #e5ecf9; } 86 | tfoot { font-style: italic; } 87 | caption { background: #eee; } 88 | 89 | 90 | /* Misc classes 91 | -------------------------------------------------------------- */ 92 | 93 | .small { font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; } 94 | .large { font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; } 95 | .hide { display: none; } 96 | 97 | .quiet { color: #666; } 98 | .loud { color: #000; } 99 | .highlight { background:#ff0; } 100 | .added { background:#060; color: #fff; } 101 | .removed { background:#900; color: #fff; } 102 | 103 | .first { margin-left:0; padding-left:0; } 104 | .last { margin-right:0; padding-right:0; } 105 | .top { margin-top:0; padding-top:0; } 106 | .bottom { margin-bottom:0; padding-bottom:0; } 107 | -------------------------------------------------------------------------------- /client/src/main/java/org/opencloudb/mycat/config/client/ZooKeeperClient.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.client; 2 | 3 | import java.util.List; 4 | 5 | import org.I0Itec.zkclient.ZkClient; 6 | import org.apache.zookeeper.CreateMode; 7 | import org.opencloudb.mycat.config.client.listener.DataMonitor; 8 | import org.opencloudb.mycat.config.client.store.ConfigMap; 9 | import org.opencloudb.mycat.config.client.util.PathUtil; 10 | import org.opencloudb.mycat.config.client.util.StringUtils; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | 15 | /** 16 | * 查询接口的zookeeper实现,主要功能: 17 | * 1.监控zookeeper节点变化,并将变化同步至缓存; 18 | * 2.提供属性查询服务; 19 | * example: 20 | * IConfig client = new ZooKeeperClient(hosts, timeout, "/"); 21 | * String value1 = client.getProp("/config/test");//return the value of the zknode /config/test;if not exists,return null 22 | * String value2 = client.getProp("/config/test","def");//return the value of the zknode /config/test;if not exists,return def 23 | * 24 | */ 25 | public class ZooKeeperClient implements IConfig { 26 | 27 | private static Logger logger = LoggerFactory.getLogger(ZooKeeperClient.class); 28 | 29 | private ZkClient zkClient; 30 | 31 | private String path; 32 | 33 | private String hosts; 34 | 35 | private int timeout; 36 | 37 | private DataMonitor monitor = DataMonitor.getInstance(this); 38 | 39 | public ZooKeeperClient(String hosts,int timeout,String path) { 40 | this.hosts = hosts; 41 | this.timeout = timeout; 42 | this.path = path; 43 | if(StringUtils.isEmpty(path) || !path.startsWith(PathUtil.NODE_SEPERATOR)) { 44 | throw new RuntimeException("路径配置有误"); 45 | } 46 | 47 | init(); 48 | } 49 | 50 | 51 | private void init() { 52 | // 初始化zk客户端 53 | initZk(); 54 | // 初始化节点信息 55 | initData(this.path); 56 | // 初始化监听器 57 | register(this.path); 58 | } 59 | 60 | private void initZk() { 61 | zkClient = new ZkClient(this.hosts, this.timeout); 62 | } 63 | 64 | private void initData(String dataPath) { 65 | logger.info("初始加载数据:" + dataPath); 66 | ConfigMap map = ConfigMap.getInstance(); 67 | 68 | if(!exists(dataPath)) { 69 | zkClient.create(dataPath, "", CreateMode.PERSISTENT); 70 | } 71 | 72 | List childList = zkClient.getChildren(dataPath); 73 | 74 | // 若存在子节点,遍历子节点注册监听 75 | for(String child : childList) { 76 | String node = PathUtil.concatPath(dataPath, child); 77 | String value = read(node); 78 | map.put(node, value == null ? "":value); 79 | } 80 | logger.info("加载后的数据:" + ConfigMap.getInstance().getPropsmap()); 81 | } 82 | 83 | // 将路径dataPath注册到监听器中 84 | public void register(String dataPath) { 85 | logger.info("注册监听:" + dataPath); 86 | 87 | if(zkClient == null) { 88 | initZk(); 89 | } 90 | 91 | zkClient.subscribeDataChanges(dataPath, monitor); 92 | 93 | zkClient.subscribeChildChanges(dataPath, monitor); 94 | 95 | List childList = zkClient.getChildren(dataPath); 96 | 97 | // 若存在子节点,遍历子节点注册监听 98 | for(String child : childList) { 99 | register(PathUtil.concatPath(dataPath, child)); 100 | } 101 | 102 | } 103 | // 取消节点dataPath的监听 104 | public void unregister(String dataPath) { 105 | zkClient.unsubscribeChildChanges(dataPath, monitor); 106 | zkClient.unsubscribeDataChanges(dataPath, monitor); 107 | } 108 | // 判断节点是否存在 109 | public boolean exists(String dataPath) { 110 | return zkClient.exists(dataPath); 111 | } 112 | // 读取节点内容 113 | public String read(String dataPath) { 114 | Object obj = zkClient.readData(dataPath); 115 | return obj == null ? "" : obj.toString(); 116 | } 117 | 118 | @Override 119 | public String getProp(String key) { 120 | return getProp(key,null); 121 | } 122 | 123 | @Override 124 | public String getProp(String key, String defaultValue) { 125 | String value = ConfigMap.getInstance().getProp(key); 126 | return value == null ? defaultValue:value; 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/model/DbConfigModel.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.model; 2 | 3 | import java.util.List; 4 | 5 | import javax.validation.constraints.Max; 6 | import javax.validation.constraints.Min; 7 | import javax.validation.constraints.NotNull; 8 | 9 | public class DbConfigModel { 10 | 11 | // 数据库名 12 | @NotNull 13 | private String dbname; 14 | 15 | // 读写模式 16 | @NotNull 17 | private int mode; 18 | 19 | // 连接池初始化大小 20 | @NotNull 21 | @Min(0) 22 | @Max(30) 23 | private int initialSize = 1; 24 | 25 | // 连接池最大连接数 26 | @NotNull 27 | @Min(0) 28 | @Max(2000) 29 | private int maxActive = 100; 30 | 31 | // 连接池最大等待时间 32 | @NotNull 33 | @Min(1000) 34 | @Max(60000) 35 | private int maxWait = 10000; 36 | 37 | // db状态 38 | @NotNull 39 | private String dbstatus = "avalibled"; 40 | 41 | // 业务列表 42 | @NotNull 43 | private List bizNameList; 44 | 45 | // server 46 | @NotNull 47 | private List serverList; 48 | 49 | /** 50 | * @return the dbname 51 | */ 52 | public String getDbname() { 53 | return dbname; 54 | } 55 | 56 | /** 57 | * @param dbname 58 | * the dbname to set 59 | */ 60 | public void setDbname(String dbname) { 61 | this.dbname = dbname; 62 | } 63 | 64 | /** 65 | * @return the mode 66 | */ 67 | public int getMode() { 68 | return mode; 69 | } 70 | 71 | /** 72 | * @param mode 73 | * the mode to set 74 | */ 75 | public void setMode(int mode) { 76 | this.mode = mode; 77 | } 78 | 79 | /** 80 | * @return the initialSize 81 | */ 82 | public int getInitialSize() { 83 | return initialSize; 84 | } 85 | 86 | /** 87 | * @param initialSize 88 | * the initialSize to set 89 | */ 90 | public void setInitialSize(int initialSize) { 91 | this.initialSize = initialSize; 92 | } 93 | 94 | /** 95 | * @return the maxActive 96 | */ 97 | public int getMaxActive() { 98 | return maxActive; 99 | } 100 | 101 | /** 102 | * @param maxActive 103 | * the maxActive to set 104 | */ 105 | public void setMaxActive(int maxActive) { 106 | this.maxActive = maxActive; 107 | } 108 | 109 | /** 110 | * @return the maxWait 111 | */ 112 | public int getMaxWait() { 113 | return maxWait; 114 | } 115 | 116 | /** 117 | * @param maxWait 118 | * the maxWait to set 119 | */ 120 | public void setMaxWait(int maxWait) { 121 | this.maxWait = maxWait; 122 | } 123 | 124 | /** 125 | * @return the bizNameList 126 | */ 127 | public List getBizNameList() { 128 | return bizNameList; 129 | } 130 | 131 | /** 132 | * @param bizNameList 133 | * the bizNameList to set 134 | */ 135 | public void setBizNameList(List bizNameList) { 136 | this.bizNameList = bizNameList; 137 | } 138 | 139 | /** 140 | * @return the serverList 141 | */ 142 | public List getServerList() { 143 | return serverList; 144 | } 145 | 146 | /** 147 | * @param serverList 148 | * the serverList to set 149 | */ 150 | public void setServerList(List serverList) { 151 | this.serverList = serverList; 152 | } 153 | 154 | /** 155 | * @return the dbstatus 156 | */ 157 | public String getDbstatus() { 158 | return dbstatus; 159 | } 160 | 161 | /** 162 | * @param dbstatus 163 | * the dbstatus to set 164 | */ 165 | public void setDbstatus(String dbstatus) { 166 | this.dbstatus = dbstatus; 167 | } 168 | 169 | } 170 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/pageList.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
      13 |

      I18N

      14 | <%@include file="../common/menu.jsp" %> 15 |
      16 |
      17 |

      PrivewPage Search

      18 |
      Modules: 19 | 30 |
      31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | <%-- --%> 53 | 54 | 55 | 56 | 57 | 58 |
      新建模块
      pageIDpageNameURLmodulesAction
      ${page.pageID}${page.pageName}${page.url} 49 | 50 | | ${lang } 51 | 52 | ${page.modulesName}edit | delete
      59 |
      60 | 61 |
      62 | 92 |
      93 | 94 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/config/configAdminAjax.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 6 | 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 | <%@ include file="../common/top.jsp"%> 13 | 14 | 15 |
      16 |
      17 |
      18 | <%-- 19 |
      20 | --%> 21 | 22 |
        23 | 24 | 25 |
      • 26 | ${znode.name} 27 |
      • 28 |
        29 | 30 |
      • 31 | ${znode.name} 32 |
          33 |
        • 34 |
          35 |
          36 |
        37 |
        38 |
        39 | 40 | 41 |

        42 |
        43 | 44 |

        45 |

        46 |
        47 | 48 |

        49 |

        50 |
        51 | 52 |

        53 | 54 |    55 | 56 |    57 | 58 |    59 |
        60 |
          61 |
        • 62 |
        • 63 |
        • 64 |
        • 65 |
        66 |
        67 | 68 | 69 |
        70 |
        71 | 72 |
        73 |
        74 | 75 |
        76 |
        77 | 78 |
        79 |
        80 | 81 |
        82 |
        83 | 84 |
        85 |
        86 | 87 |
        88 |
        89 | 90 |
        91 |
        92 | 93 |
        94 |
        95 | 96 |
        97 |
        98 | 99 |
        100 |
        101 | 102 |
        103 |
        104 |
        105 |
        106 | 107 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/i18n/propertyUpdate.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
        13 |

        I18N

        14 | <%@include file="../common/menu.jsp" %> 15 |
        16 |

        属性编辑页面

        17 |

        ${projName }

        18 |
        19 |
        style="display: none">${errMsg }
        20 | 21 |
        22 | 23 | 24 | 25 | 26 | 34 | 35 | <%-- 36 | 37 | 41 | 44 | 45 | --%> 46 | 47 | 48 | 52 | 55 | 56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 77 | 78 | 79 | 80 | 83 | 84 | 85 |
        27 | 28 | 29 | 30 | 31 | 32 | 33 |
        38 | 39 | 40 | 42 | 43 |
        49 | 50 | 51 | 53 | 54 |
        60 | 61 |
        66 | 76 |
        81 | 82 |
        86 |
        87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 |
        98 |
        99 |
        100 |
        101 | 102 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/blueprint/plugins/rtl/screen.css: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------- 2 | 3 | rtl.css 4 | * Mirrors Blueprint for left-to-right languages 5 | 6 | By Ran Yaniv Hartstein [ranh.co.il] 7 | 8 | -------------------------------------------------------------- */ 9 | 10 | body .container { direction: rtl; } 11 | body .column, body div.span-1, body div.span-2, body div.span-3, body div.span-4, body div.span-5, body div.span-6, body div.span-7, body div.span-8, body div.span-9, body div.span-10, body div.span-11, body div.span-12, body div.span-13, body div.span-14, body div.span-15, body div.span-16, body div.span-17, body div.span-18, body div.span-19, body div.span-20, body div.span-21, body div.span-22, body div.span-23, body div.span-24 { 12 | float: right; 13 | margin-right: 0; 14 | margin-left: 10px; 15 | text-align:right; 16 | } 17 | 18 | body div.last { margin-left: 0; } 19 | body table .last { padding-left: 0; } 20 | 21 | body .append-1 { padding-right: 0; padding-left: 40px; } 22 | body .append-2 { padding-right: 0; padding-left: 80px; } 23 | body .append-3 { padding-right: 0; padding-left: 120px; } 24 | body .append-4 { padding-right: 0; padding-left: 160px; } 25 | body .append-5 { padding-right: 0; padding-left: 200px; } 26 | body .append-6 { padding-right: 0; padding-left: 240px; } 27 | body .append-7 { padding-right: 0; padding-left: 280px; } 28 | body .append-8 { padding-right: 0; padding-left: 320px; } 29 | body .append-9 { padding-right: 0; padding-left: 360px; } 30 | body .append-10 { padding-right: 0; padding-left: 400px; } 31 | body .append-11 { padding-right: 0; padding-left: 440px; } 32 | body .append-12 { padding-right: 0; padding-left: 480px; } 33 | body .append-13 { padding-right: 0; padding-left: 520px; } 34 | body .append-14 { padding-right: 0; padding-left: 560px; } 35 | body .append-15 { padding-right: 0; padding-left: 600px; } 36 | body .append-16 { padding-right: 0; padding-left: 640px; } 37 | body .append-17 { padding-right: 0; padding-left: 680px; } 38 | body .append-18 { padding-right: 0; padding-left: 720px; } 39 | body .append-19 { padding-right: 0; padding-left: 760px; } 40 | body .append-20 { padding-right: 0; padding-left: 800px; } 41 | body .append-21 { padding-right: 0; padding-left: 840px; } 42 | body .append-22 { padding-right: 0; padding-left: 880px; } 43 | body .append-23 { padding-right: 0; padding-left: 920px; } 44 | 45 | body .prepend-1 { padding-left: 0; padding-right: 40px; } 46 | body .prepend-2 { padding-left: 0; padding-right: 80px; } 47 | body .prepend-3 { padding-left: 0; padding-right: 120px; } 48 | body .prepend-4 { padding-left: 0; padding-right: 160px; } 49 | body .prepend-5 { padding-left: 0; padding-right: 200px; } 50 | body .prepend-6 { padding-left: 0; padding-right: 240px; } 51 | body .prepend-7 { padding-left: 0; padding-right: 280px; } 52 | body .prepend-8 { padding-left: 0; padding-right: 320px; } 53 | body .prepend-9 { padding-left: 0; padding-right: 360px; } 54 | body .prepend-10 { padding-left: 0; padding-right: 400px; } 55 | body .prepend-11 { padding-left: 0; padding-right: 440px; } 56 | body .prepend-12 { padding-left: 0; padding-right: 480px; } 57 | body .prepend-13 { padding-left: 0; padding-right: 520px; } 58 | body .prepend-14 { padding-left: 0; padding-right: 560px; } 59 | body .prepend-15 { padding-left: 0; padding-right: 600px; } 60 | body .prepend-16 { padding-left: 0; padding-right: 640px; } 61 | body .prepend-17 { padding-left: 0; padding-right: 680px; } 62 | body .prepend-18 { padding-left: 0; padding-right: 720px; } 63 | body .prepend-19 { padding-left: 0; padding-right: 760px; } 64 | body .prepend-20 { padding-left: 0; padding-right: 800px; } 65 | body .prepend-21 { padding-left: 0; padding-right: 840px; } 66 | body .prepend-22 { padding-left: 0; padding-right: 880px; } 67 | body .prepend-23 { padding-left: 0; padding-right: 920px; } 68 | 69 | body .border { 70 | padding-right: 0; 71 | padding-left: 4px; 72 | margin-right: 0; 73 | margin-left: 5px; 74 | border-right: none; 75 | border-left: 1px solid #eee; 76 | } 77 | 78 | body .colborder { 79 | padding-right: 0; 80 | padding-left: 24px; 81 | margin-right: 0; 82 | margin-left: 25px; 83 | border-right: none; 84 | border-left: 1px solid #eee; 85 | } 86 | 87 | body .pull-1 { margin-left: 0; margin-right: -40px; } 88 | body .pull-2 { margin-left: 0; margin-right: -80px; } 89 | body .pull-3 { margin-left: 0; margin-right: -120px; } 90 | body .pull-4 { margin-left: 0; margin-right: -160px; } 91 | 92 | body .push-0 { margin: 0 18px 0 0; } 93 | body .push-1 { margin: 0 18px 0 -40px; } 94 | body .push-2 { margin: 0 18px 0 -80px; } 95 | body .push-3 { margin: 0 18px 0 -120px; } 96 | body .push-4 { margin: 0 18px 0 -160px; } 97 | body .push-0, body .push-1, body .push-2, 98 | body .push-3, body .push-4 { float: left; } 99 | 100 | 101 | /* Typography with RTL support */ 102 | body h1,body h2,body h3, 103 | body h4,body h5,body h6 { font-family: Arial, sans-serif; } 104 | html body { font-family: Arial, sans-serif; } 105 | body pre,body code,body tt { font-family: monospace; } 106 | 107 | /* Mirror floats and margins on typographic elements */ 108 | body p img { float: right; margin: 1.5em 0 1.5em 1.5em; } 109 | body dd, body ul, body ol { margin-left: 0; margin-right: 1.5em;} 110 | body td, body th { text-align:right; } -------------------------------------------------------------------------------- /server/src/test/java/org/opencloudb/mycat/config/server/TestZooKeeper.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import org.apache.zookeeper.CreateMode; 7 | import org.apache.zookeeper.KeeperException; 8 | import org.apache.zookeeper.WatchedEvent; 9 | import org.apache.zookeeper.Watcher; 10 | import org.apache.zookeeper.Watcher.Event.EventType; 11 | import org.apache.zookeeper.ZooDefs.Ids; 12 | import org.apache.zookeeper.ZooKeeper; 13 | import org.apache.zookeeper.data.Stat; 14 | import org.junit.Before; 15 | import org.junit.Test; 16 | import org.springframework.util.Assert; 17 | 18 | public class TestZooKeeper { 19 | 20 | private String hosts = "192.168.44.136:2181"; 21 | 22 | private int timeout = 30 * 1000; 23 | 24 | private ZooKeeper zk; 25 | @Before 26 | public void init() { 27 | try { 28 | Watcher watcher = new MyWatcher(); 29 | zk = new ZooKeeper(hosts, timeout, watcher); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | } 33 | } 34 | 35 | @Test 36 | public void testClient() { 37 | try { 38 | Thread t = new Thread(new ZkWatcher()); 39 | t.start(); 40 | Thread.sleep(100 * 1000); 41 | } catch (InterruptedException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | class ZkWatcher implements Runnable { 47 | 48 | @Override 49 | public void run() { 50 | try { 51 | List list = zk.getChildren("/", true); 52 | for(String s : list) { 53 | System.out.println(s); 54 | } 55 | while(true) { 56 | watch("/config"); 57 | Thread.sleep(5 * 1000); 58 | } 59 | } catch (KeeperException e) { 60 | e.printStackTrace(); 61 | } catch (InterruptedException e) { 62 | e.printStackTrace(); 63 | } 64 | 65 | } 66 | 67 | private void watch(String path) throws KeeperException, InterruptedException { 68 | 69 | System.out.println("path:" + path); 70 | Stat stat = zk.exists(path, true); 71 | 72 | if(stat == null) { 73 | return ; 74 | } 75 | List list = zk.getChildren(path, true); 76 | for(String p : list) { 77 | if(!path.endsWith("/")) { 78 | watch(path + "/" + p); 79 | } else { 80 | watch(path + p); 81 | } 82 | } 83 | } 84 | 85 | } 86 | @Test 87 | public void testInitData() { 88 | String path = "/config"; 89 | try { 90 | if(zk.exists(path, true) == null) { 91 | zk.create(path, "hello".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 92 | } 93 | } catch(Exception e) { 94 | e.printStackTrace(); 95 | org.junit.Assert.fail(); 96 | } 97 | } 98 | 99 | @Test 100 | public void testCreateNode() { 101 | String path = "/config/ttt"; 102 | 103 | 104 | try { 105 | if(zk.exists(path, true) == null) { 106 | zk.create(path, "hello".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 107 | } 108 | for(int i = 0;i < 100;i++) { 109 | zk.create(path + "/" + System.currentTimeMillis(), ("hello" + i).getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 110 | } 111 | Thread.sleep(10 * 1000); 112 | List list = zk.getChildren(path, true); 113 | for(String p : list) { 114 | if(zk.exists(path + "/" + p, true) != null) { 115 | zk.delete(path + "/" + p, -1); 116 | } 117 | } 118 | } catch (KeeperException e) { 119 | e.printStackTrace(); 120 | } catch (InterruptedException e) { 121 | e.printStackTrace(); 122 | } 123 | 124 | 125 | } 126 | 127 | 128 | 129 | 130 | @Test 131 | public void testCreate() { 132 | try { 133 | Assert.notNull(zk); 134 | zk.exists("/config", true); 135 | zk.setData("/config", ("hello" + System.currentTimeMillis()).getBytes(), -1); 136 | String path = "/config/test"; 137 | for(int i = 0;i < 5;i++) { 138 | System.out.println("the " + i + " times"); 139 | if(zk.exists(path, true) != null) { 140 | 141 | zk.setData(path, "hello".getBytes(), -1); 142 | 143 | zk.exists(path, true); 144 | zk.delete(path, -1); 145 | } 146 | zk.exists(path, true); 147 | String res = zk.create(path, "test".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 148 | 149 | zk.exists("/config/test1", true); 150 | zk.create("/config/test1", "hello".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 151 | zk.exists("/config/test1", true); 152 | zk.delete("/config/test1", -1); 153 | 154 | System.out.println("res:" + res); 155 | Thread.sleep(10 * 1000); 156 | } 157 | 158 | zk.setData(path, "change".getBytes(), -1); 159 | 160 | } catch (KeeperException e) { 161 | e.printStackTrace(); 162 | } catch (InterruptedException e) { 163 | e.printStackTrace(); 164 | } 165 | } 166 | } 167 | 168 | class MyWatcher implements Watcher { 169 | @Override 170 | public void process(WatchedEvent event) { 171 | EventType type = event.getType(); 172 | switch(type) { 173 | case NodeCreated: 174 | System.out.println("created.." + event.getPath()); 175 | break; 176 | case NodeDeleted: 177 | System.out.println("deleted.." + event.getPath()); 178 | break; 179 | case NodeDataChanged: 180 | System.out.println("changing.." + event.getPath()); 181 | break; 182 | case NodeChildrenChanged: 183 | System.out.println("nodeChildrenChanged" + event.getPath()); 184 | break; 185 | default: 186 | System.out.println("default..."); 187 | break; 188 | } 189 | System.out.println("节点发生变化:" + event.getType() + ":" + event.getPath()); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.opencloudb.mycat 8 | Mycat-config 9 | 0.0.1-SNAPSHOT 10 | 11 | server 12 | server 13 | http://maven.apache.org 14 | 15 | UTF-8 16 | 17 | 18 | 19 | 20 | org.springframework 21 | spring-webmvc 22 | 3.2.4.RELEASE 23 | 24 | 25 | org.springframework 26 | spring-web 27 | 3.2.4.RELEASE 28 | 29 | 30 | org.springframework.security 31 | spring-security-core 32 | 3.2.4.RELEASE 33 | 34 | 35 | org.springframework.security 36 | spring-security-config 37 | 3.2.4.RELEASE 38 | 39 | 40 | org.springframework.security 41 | spring-security-taglibs 42 | 3.2.4.RELEASE 43 | 44 | 45 | org.springframework.security 46 | spring-security-web 47 | 3.2.4.RELEASE 48 | 49 | 50 | org.aspectj 51 | aspectjrt 52 | 1.6.8 53 | 54 | 55 | 56 | org.aspectj 57 | aspectjweaver 58 | 1.6.8 59 | 60 | 61 | org.hibernate 62 | hibernate-validator 63 | 5.1.1.Final 64 | 65 | 66 | javax.validation 67 | validation-api 68 | 1.1.0.Final 69 | 70 | 71 | 72 | javax.servlet 73 | jstl 74 | 1.1.2 75 | 76 | 77 | javax.servlet 78 | servlet-api 79 | 2.5 80 | 81 | 82 | 83 | commons-fileupload 84 | commons-fileupload 85 | 1.2.1 86 | 87 | 88 | 89 | org.apache.zookeeper 90 | zookeeper 91 | 92 | 93 | log4j 94 | log4j 95 | 96 | 97 | slf4j-log4j12 98 | org.slf4j 99 | 100 | 101 | 3.4.6 102 | 103 | 104 | com.101tec 105 | zkclient 106 | 0.2 107 | 108 | 109 | org.apache.commons 110 | commons-lang3 111 | 3.1 112 | 113 | 114 | 115 | 116 | ch.qos.logback 117 | logback-classic 118 | 1.1.2 119 | 120 | 121 | ch.qos.logback 122 | logback-core 123 | 1.1.2 124 | 125 | 126 | org.slf4j 127 | slf4j-api 128 | 1.7.5 129 | 130 | 131 | org.slf4j 132 | jcl-over-slf4j 133 | 1.7.5 134 | 135 | 136 | org.slf4j 137 | log4j-over-slf4j 138 | 1.7.5 139 | 140 | 141 | 142 | 143 | org.codehaus.jackson 144 | jackson-mapper-asl 145 | 1.9.13 146 | 147 | 148 | org.codehaus.jackson 149 | jackson-core-asl 150 | 1.9.13 151 | 152 | 153 | 154 | junit 155 | junit 156 | 4.10 157 | test 158 | 159 | 160 | 161 | deploy 162 | mycatconfig-server 163 | 164 | 165 | maven-compiler-plugin 166 | 167 | 1.6 168 | 1.6 169 | 170 | 171 | 172 | org.mortbay.jetty 173 | maven-jetty-plugin 174 | 6.1.10 175 | 176 | -Xmx2048 177 | mycatconfig-server 178 | 179 | 180 | 8090 181 | 60000 182 | 183 | 184 | 1 185 | 186 | 187 | 188 | 189 | 190 | src/main/resources 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/services/ZkClientBaseService.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.services; 2 | 3 | import java.io.InputStream; 4 | import java.io.UnsupportedEncodingException; 5 | import java.nio.charset.Charset; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Properties; 9 | import java.util.Stack; 10 | 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.apache.commons.lang3.time.DateFormatUtils; 13 | import org.apache.zookeeper.CreateMode; 14 | import org.apache.zookeeper.KeeperException; 15 | import org.apache.zookeeper.WatchedEvent; 16 | import org.apache.zookeeper.Watcher; 17 | import org.apache.zookeeper.Watcher.Event.KeeperState; 18 | import org.apache.zookeeper.ZooDefs.Ids; 19 | import org.apache.zookeeper.ZooKeeper; 20 | import org.apache.zookeeper.data.Stat; 21 | import org.opencloudb.mycat.config.server.model.ZkNode; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | import org.springframework.stereotype.Service; 25 | 26 | 27 | @Service 28 | public class ZkClientBaseService { 29 | 30 | private static Logger logger = LoggerFactory.getLogger(ZkClientBaseService.class); 31 | 32 | private static ZooKeeper zk; 33 | /** 34 | * 初始化:创建连接 35 | */ 36 | public ZkClientBaseService() { 37 | 38 | try { 39 | Properties zkConfig = new Properties(); 40 | InputStream is = this.getClass().getClassLoader() 41 | .getResourceAsStream("/zookeeper.properties"); 42 | if (is == null) { 43 | throw new RuntimeException( 44 | "XCache config file not found. Please make sure 'zookeeper.properties' is in in your classpath"); 45 | } 46 | zkConfig.load(is); 47 | String connectString = zkConfig.getProperty("connectString"); 48 | int sessionTimeout = Integer.parseInt(zkConfig 49 | .getProperty("sessionTimeout")); 50 | 51 | zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() { 52 | // 监控所有被触发的事件 53 | public void process(WatchedEvent event) { 54 | System.out.println("已经触发了" + event.getType() + "事件!"); 55 | if (event.getState() == KeeperState.Expired) { 56 | new ZkClientBaseService(); 57 | } 58 | } 59 | }); 60 | 61 | } catch (Exception e) { 62 | logger.error("zk初始化异常:",e.getMessage()); 63 | } 64 | } 65 | 66 | /** 67 | * 取得节点信息 68 | * 69 | * @param path 70 | * @return 71 | * @throws KeeperException 72 | * @throws InterruptedException 73 | */ 74 | public ZkNode getZNode(String path) throws KeeperException, 75 | InterruptedException { 76 | Stat stat = zk.exists(path,true); 77 | if (stat == null) { 78 | return null; 79 | } else { 80 | ZkNode znode = new ZkNode(); 81 | 82 | znode.setStat(stat); 83 | try { 84 | System.out.println(">>>>>>>>>> zk:" + zk); 85 | System.out.println(">>>>>>>>>> zkpath:" + path); 86 | System.out.println(">>>>>>>>>> zkNode:" 87 | + zk.getData(path, false, null)); 88 | byte[] data = zk.getData(path, false, null); 89 | 90 | znode.setData(data == null || data.length <= 0 ? "" 91 | : new String(zk.getData(path, false, null), "utf-8")); 92 | } catch (UnsupportedEncodingException e) { 93 | e.printStackTrace(); 94 | } 95 | znode.setPath(path); 96 | znode.setName("/".equals(path) ? "/" : path.substring(path 97 | .lastIndexOf("/") + 1)); 98 | znode.setId(StringUtils.replace(path, "/", "△")); 99 | znode.setCtime(DateFormatUtils.format(stat.getCtime(), 100 | "yyyy-MM-dd HH:mm:ss")); 101 | znode.setMtime(DateFormatUtils.format(stat.getMtime(), 102 | "yyyy-MM-dd HH:mm:ss")); 103 | 104 | return znode; 105 | } 106 | } 107 | 108 | /** 109 | * 取得子节点信息 110 | * 111 | * @param path 112 | * @return 113 | * @throws InterruptedException 114 | * @throws KeeperException 115 | */ 116 | public List getChildZNodes(String path) throws KeeperException, 117 | InterruptedException { 118 | List nameList = zk.getChildren(path, false); 119 | if (nameList == null || nameList.size() == 0) { 120 | return null; 121 | } else { 122 | List znodeList = new ArrayList(); 123 | for (String name : nameList) { 124 | znodeList 125 | .add(this.getZNode(StringUtils.endsWith(path, "/") ? path 126 | + name 127 | : path + "/" + name)); 128 | } 129 | return znodeList; 130 | } 131 | } 132 | 133 | /** 134 | * 取得某一节点及递归子节点的路径栈 135 | * 136 | * @param pathStack 137 | * @param path 138 | * @return 139 | * @throws KeeperException 140 | * @throws InterruptedException 141 | */ 142 | public Stack getZnodePathStack(Stack pathStack, String path) 143 | throws KeeperException, InterruptedException { 144 | List children = this.getChildZNodes(path); 145 | if (children == null) { 146 | pathStack.push(path); 147 | } else { 148 | pathStack.push(path); 149 | for (ZkNode child : children) { 150 | this.getZnodePathStack(pathStack, child.getPath()); 151 | } 152 | } 153 | 154 | return pathStack; 155 | } 156 | 157 | /** 158 | * 更新节点信息 159 | * 160 | * @param path 161 | * @param data 162 | * @return 163 | * @throws KeeperException 164 | * @throws InterruptedException 165 | */ 166 | public void updateZNode(String path, String data) throws KeeperException, 167 | InterruptedException { 168 | // ZookeeperManager.getInstance().setData(path, data); 169 | zk.setData(path, data.getBytes(Charset.forName("utf-8")), -1); 170 | } 171 | 172 | /** 173 | * 删除节点 174 | * 175 | * @param path 176 | * @throws InterruptedException 177 | * @throws KeeperException 178 | */ 179 | public void deleteZNode(String path) throws InterruptedException, 180 | KeeperException { 181 | zk.delete(path, -1); 182 | } 183 | 184 | /** 185 | * 删除节点及所有递归子节点 186 | * 187 | * @param path 188 | * @throws KeeperException 189 | * @throws InterruptedException 190 | */ 191 | public void deleteZnodeByIte(String path) throws KeeperException, 192 | InterruptedException { 193 | Stack pathStack = new Stack(); 194 | 195 | pathStack = this.getZnodePathStack(pathStack, path); 196 | 197 | while (!pathStack.empty()) { 198 | this.deleteZNode(pathStack.pop()); 199 | } 200 | } 201 | 202 | /** 203 | * 增加节点 204 | * 205 | * @param path 206 | * @param data 207 | * @throws InterruptedException 208 | * @throws KeeperException 209 | */ 210 | public void addZNode(String path, String data) throws KeeperException, 211 | InterruptedException { 212 | zk.create(path, data.getBytes(Charset.forName("utf-8")), 213 | Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 214 | } 215 | 216 | } 217 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/views/config/dbConfigEdit.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=UTF-8"%> 2 | <%@page pageEncoding="UTF-8"%> 3 | <%@ page session="false" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 6 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 7 | 8 | 9 | <%@include file="../common/head.jsp" %> 10 | 11 | 12 |
        13 |

        14 | ZK Configration Admin 15 |

        16 | <%@include file="../common/menu.jsp" %> 17 |
        18 |
        19 |
        style="display: none">${errMsg }
        20 | 21 |
        22 | 23 | 24 | 25 | 26 | 27 | 30 | 31 | 32 | 33 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 90 | 91 | 92 | 93 | 102 | 103 | 104 | 105 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 129 | 130 | 131 | 132 | 133 |
        ${path } db config edit
        28 | 29 |
        34 | 39 |
        0<N<30 ,default:1
        0<N<2000,default:100
        1000<N<60000,default:10000
        default:3306
        83 | 89 |
        94 | 101 |
        106 | 111 | default:N
        126 | ${bizName } 127 | 128 |
        134 | 135 | 136 |

        137 |
        138 |
        139 |
        140 | 141 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/controllers/ConfigAjaxController.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.controllers; 2 | 3 | import java.io.FileNotFoundException; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import javax.annotation.Resource; 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.apache.commons.lang3.builder.ToStringBuilder; 13 | import org.apache.zookeeper.KeeperException; 14 | import org.opencloudb.mycat.config.server.model.ZkNode; 15 | import org.opencloudb.mycat.config.server.services.ZkBaseService; 16 | import org.opencloudb.mycat.config.server.util.Constant; 17 | import org.slf4j.Logger; 18 | import org.slf4j.LoggerFactory; 19 | import org.springframework.stereotype.Controller; 20 | import org.springframework.ui.Model; 21 | import org.springframework.web.bind.annotation.RequestMapping; 22 | import org.springframework.web.bind.annotation.RequestMethod; 23 | import org.springframework.web.bind.annotation.RequestParam; 24 | import org.springframework.web.bind.annotation.ResponseBody; 25 | import org.springframework.web.multipart.MultipartFile; 26 | import org.springframework.web.multipart.commons.CommonsMultipartFile; 27 | 28 | 29 | @Controller 30 | @RequestMapping(value = "/configAjax") 31 | public class ConfigAjaxController { 32 | 33 | private Logger log = LoggerFactory.getLogger(ConfigAjaxController.class); 34 | 35 | @Resource 36 | private ZkBaseService zkAjaxService; 37 | 38 | /** 39 | * 页面初始化 40 | * 41 | * @param model 42 | * @return 43 | */ 44 | @RequestMapping(method = RequestMethod.GET) 45 | public String show(HttpServletRequest request,Model model) { 46 | 47 | try { 48 | List znodeList = zkAjaxService.getChildZNodes("/"); 49 | model.addAttribute("znodeList", znodeList); 50 | } catch (KeeperException e) { 51 | e.printStackTrace(); 52 | } catch (InterruptedException e) { 53 | e.printStackTrace(); 54 | } 55 | return Constant.PAGE_COMMON; 56 | } 57 | 58 | /** 59 | * 取得节点信息 60 | * 61 | * @param path 62 | * @return 63 | */ 64 | @RequestMapping(value = "/getZNode", method = RequestMethod.GET) 65 | public @ResponseBody 66 | Map getZNode(HttpServletRequest request,@RequestParam String path) { 67 | Map resultMap = new HashMap(); 68 | ZkNode znode = null; 69 | String msg = null; 70 | 71 | try { 72 | znode = zkAjaxService.getZNode(path); 73 | } catch (KeeperException e) { 74 | msg = e.getMessage(); 75 | } catch (InterruptedException e) { 76 | msg = e.getMessage(); 77 | } catch (Exception e) { 78 | msg = e.getMessage(); 79 | } 80 | 81 | if (msg == null) { 82 | msg = "succ"; 83 | } 84 | 85 | resultMap.put("msg", msg); 86 | resultMap.put("znode", znode); 87 | 88 | return resultMap; 89 | } 90 | 91 | /** 92 | * 取得子节点信息 93 | * 94 | * @param path 95 | * @return 96 | */ 97 | @RequestMapping(value = "/getChildren", method = RequestMethod.GET) 98 | public @ResponseBody 99 | Map getChildren(@RequestParam String path) { 100 | Map resultMap = new HashMap(); 101 | String msg = null; 102 | List znodeList = null; 103 | try { 104 | znodeList = zkAjaxService.getChildZNodes(path); 105 | } catch (KeeperException e) { 106 | msg = e.getMessage(); 107 | } catch (InterruptedException e) { 108 | msg = e.getMessage(); 109 | } catch (Exception e) { 110 | msg = e.getMessage(); 111 | } 112 | 113 | if (msg == null) { 114 | msg = "succ"; 115 | } 116 | 117 | resultMap.put("msg", msg); 118 | resultMap.put("znodeList", znodeList); 119 | return resultMap; 120 | } 121 | 122 | /** 123 | * 更新节点信息 124 | * 125 | * @param path 126 | * @param data 127 | * @return 128 | */ 129 | @RequestMapping(value = "/updateZNode", method = { RequestMethod.POST }) 130 | public @ResponseBody 131 | String updateZNode(@RequestParam("path") String path, @RequestParam("data") String data) { 132 | try { 133 | log.info("path >>" + path + "; data >>" + data); 134 | zkAjaxService.updateZNode(path, data); 135 | } catch (KeeperException e) { 136 | return e.getMessage(); 137 | } catch (InterruptedException e) { 138 | return e.getMessage(); 139 | } catch (Exception e) { 140 | return e.getMessage(); 141 | } 142 | 143 | // Map resultMap = new HashMap(); 144 | // resultMap.put("msg", "succ"); 145 | return "succ"; 146 | } 147 | 148 | /** 149 | * 删除节点信息 150 | * 151 | * @param path 152 | * @return 153 | */ 154 | @RequestMapping(value = "/deleteZNode", method = RequestMethod.GET) 155 | public @ResponseBody 156 | String deleteZNode(@RequestParam String path) { 157 | try { 158 | zkAjaxService.deleteZNode(path); 159 | } catch (KeeperException e) { 160 | return e.getMessage(); 161 | } catch (InterruptedException e) { 162 | return e.getMessage(); 163 | } catch (Exception e) { 164 | return e.getMessage(); 165 | } 166 | 167 | return "succ"; 168 | } 169 | 170 | /** 171 | * 新增节点信息 172 | * 173 | * @param path 174 | * @param data 175 | * @return 176 | */ 177 | @RequestMapping(value = "/addZNode", method = { RequestMethod.POST }) 178 | public @ResponseBody 179 | String addZNode(@RequestParam String path, @RequestParam String data) { 180 | try { 181 | log.info("path >>" + path + "; data >>" + data); 182 | zkAjaxService.addZNode(path, data); 183 | } catch (KeeperException e) { 184 | e.getMessage(); 185 | return e.getMessage(); 186 | } catch (InterruptedException e) { 187 | return e.getMessage(); 188 | } catch (Exception e) { 189 | return e.getMessage(); 190 | } 191 | 192 | return "succ"; 193 | } 194 | @RequestMapping(value = "/addChildren",method = {RequestMethod.POST}) 195 | public @ResponseBody String addProperties(@RequestParam(required=false) String path,@RequestParam(required=false) MultipartFile propertiesFile,HttpServletRequest req) { 196 | 197 | log.info(path + ":" + propertiesFile + ":" + ToStringBuilder.reflectionToString(propertiesFile)); 198 | CommonsMultipartFile cmf = (CommonsMultipartFile) propertiesFile; 199 | try { 200 | if(propertiesFile == null) { 201 | log.warn("file uploaded is null"); 202 | throw new FileNotFoundException("file not found"); 203 | } 204 | if(StringUtils.isEmpty(path)) { 205 | log.warn("path is empty"); 206 | throw new IllegalAccessException("path cannot be empty"); 207 | } 208 | String fileName = cmf.getFileItem().getName(); 209 | if(!fileName.endsWith("properties")) { 210 | log.warn("file should be properties file"); 211 | throw new IllegalAccessException("file should be properties file"); 212 | } 213 | 214 | log.info("path:" + path + ";file:" + fileName + "," + propertiesFile.getInputStream().available()); 215 | boolean isSucc = zkAjaxService.addProperties(path, propertiesFile.getInputStream()); 216 | if(isSucc) { 217 | return "succ"; 218 | } 219 | } catch (NullPointerException e) { 220 | log.error(e.getMessage()); 221 | return "error"; 222 | } catch (KeeperException e) { 223 | log.error(e.getMessage()); 224 | return e.getMessage(); 225 | } catch (InterruptedException e) { 226 | log.error(e.getMessage()); 227 | return e.getMessage(); 228 | } catch (FileNotFoundException e) { 229 | log.error(e.getMessage()); 230 | return e.getMessage(); 231 | } catch(Exception e) { 232 | log.error(e.getMessage()); 233 | return e.getMessage(); 234 | } 235 | return "fail"; 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /server/src/main/java/org/opencloudb/mycat/config/server/services/ZkBaseService.java: -------------------------------------------------------------------------------- 1 | package org.opencloudb.mycat.config.server.services; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | import java.util.Properties; 8 | import java.util.Stack; 9 | 10 | import org.I0Itec.zkclient.ZkClient; 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.apache.commons.lang3.time.DateFormatUtils; 13 | import org.apache.zookeeper.CreateMode; 14 | import org.apache.zookeeper.KeeperException; 15 | import org.apache.zookeeper.WatchedEvent; 16 | import org.apache.zookeeper.Watcher; 17 | import org.apache.zookeeper.Watcher.Event.KeeperState; 18 | import org.apache.zookeeper.ZooKeeper; 19 | import org.apache.zookeeper.data.Stat; 20 | import org.opencloudb.mycat.config.server.model.ZkNode; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | import org.springframework.stereotype.Service; 24 | 25 | 26 | @Service 27 | public class ZkBaseService { 28 | 29 | private static ZooKeeper zk; 30 | private static ZkClient client; 31 | 32 | private static Logger logger = LoggerFactory.getLogger(ZkBaseService.class); 33 | 34 | private String rootPath; 35 | 36 | /** 37 | * 初始化:创建连接 38 | */ 39 | public ZkBaseService() { 40 | 41 | 42 | try { 43 | Properties zkConfig = new Properties(); 44 | InputStream is = this.getClass().getClassLoader() 45 | .getResourceAsStream("/zookeeper.properties"); 46 | if (is == null) { 47 | logger.error("file not found:zookeeper.properties"); 48 | throw new RuntimeException( 49 | "XCache config file not found. Please make sure 'zookeeper.properties' is in in your classpath"); 50 | } 51 | zkConfig.load(is); 52 | rootPath = zkConfig.getProperty("zookeeper.rootPath"); 53 | String connectString = zkConfig.getProperty("connectString"); 54 | int sessionTimeout = Integer.parseInt(zkConfig 55 | .getProperty("sessionTimeout")); 56 | zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() { 57 | // 监控所有被触发的事件 58 | public void process(WatchedEvent event) { 59 | logger.debug("已经触发了" + event.getType() + "事件!"); 60 | 61 | if (event.getState() == KeeperState.Expired) { 62 | new ZkBaseService(); 63 | } 64 | } 65 | }); 66 | client = new ZkClient(connectString, sessionTimeout); 67 | } catch (IOException e) { 68 | logger.error("IOException:" + e.getMessage()); 69 | } 70 | } 71 | 72 | /** 73 | * 取得节点信息 74 | * 75 | * @param path 76 | * @return 77 | * @throws KeeperException 78 | * @throws InterruptedException 79 | */ 80 | public ZkNode getZNode(String path) throws KeeperException, 81 | InterruptedException { 82 | Stat stat = zk.exists(path, false); 83 | if (stat == null) { 84 | return null; 85 | } else { 86 | // TODO:是否有必要获取stat属性 87 | ZkNode znode = new ZkNode(); 88 | znode.setStat(stat); 89 | try { 90 | // byte[] data = NodeDataSerialize.getSrcContent(zk.getData(path, false, null)); 91 | // byte[] data = ((String)client.readData(path)).getBytes(); 92 | // Zookeeper客户端与ZkClient客户端在写入和读取时,序列化方式不一样,应用中统一使用zkClient存取数据 93 | String data = client.readData(path); 94 | 95 | logger.debug(">>>>>>>>>> zkpath:" + path); 96 | logger.debug(">>>>>>>>>> zkpathData:" + data); 97 | 98 | znode.setData(data == null ? "": data); 99 | } catch (Exception e) { 100 | e.printStackTrace(); 101 | logger.error("path:" + path + "," + e.getMessage()); 102 | } 103 | znode.setPath(path); 104 | znode.setName("/".equals(path) ? "/" : path.substring(path.lastIndexOf("/") + 1)); 105 | 106 | String nodeId = StringUtils.replace(path, "/", "△"); 107 | nodeId = StringUtils.replace(nodeId, ".", "☆"); 108 | 109 | 110 | znode.setId(nodeId); 111 | znode.setCtime(DateFormatUtils.format(stat.getCtime(),"yyyy-MM-dd HH:mm:ss")); 112 | znode.setMtime(DateFormatUtils.format(stat.getMtime(), 113 | "yyyy-MM-dd HH:mm:ss")); 114 | 115 | return znode; 116 | } 117 | } 118 | 119 | /** 120 | * 取得子节点信息 121 | * 122 | * @param path 123 | * @return 124 | * @throws InterruptedException 125 | * @throws KeeperException 126 | */ 127 | public List getChildZNodes(String path) throws KeeperException, 128 | InterruptedException { 129 | List nameList = zk.getChildren(path, false); 130 | if (nameList == null || nameList.size() == 0) { 131 | return null; 132 | } else { 133 | List znodeList = new ArrayList(); 134 | path = StringUtils.endsWith(path, "/") ? path : (path + "/"); 135 | for (String name : nameList) { 136 | if(path.startsWith(this.rootPath) || this.rootPath.endsWith(name)) { 137 | znodeList.add(this.getZNode(path + name)); 138 | } 139 | } 140 | return znodeList; 141 | } 142 | } 143 | 144 | /** 145 | * 取得某一节点及递归子节点的路径栈 146 | * 147 | * @param pathStack 148 | * @param path 149 | * @return 150 | * @throws KeeperException 151 | * @throws InterruptedException 152 | */ 153 | public Stack getZnodePathStack(Stack pathStack, String path) 154 | throws KeeperException, InterruptedException { 155 | List children = this.getChildZNodes(path); 156 | if (children == null) { 157 | pathStack.push(path); 158 | } else { 159 | pathStack.push(path); 160 | for (ZkNode child : children) { 161 | this.getZnodePathStack(pathStack, child.getPath()); 162 | } 163 | } 164 | 165 | return pathStack; 166 | } 167 | 168 | /** 169 | * 更新节点信息 170 | * 171 | * @param path 172 | * @param data 173 | * @return 174 | * @throws KeeperException 175 | * @throws InterruptedException 176 | */ 177 | public void updateZNode(String path, String data) throws KeeperException, 178 | InterruptedException { 179 | // zk.setData(path, NodeDataSerialize.getDestContent(data.getBytes(Charset.forName("utf-8"))), -1); 180 | client.writeData(path, data); 181 | } 182 | 183 | /** 184 | * 删除节点 185 | * 186 | * @param path 187 | * @throws InterruptedException 188 | * @throws KeeperException 189 | */ 190 | public void deleteZNode(String path) throws InterruptedException, 191 | KeeperException { 192 | // zk.delete(path, -1); 193 | client.delete(path); 194 | } 195 | 196 | /** 197 | * 判断节点是否存在 198 | * @param path 199 | * @return 200 | * @throws KeeperException 201 | */ 202 | public boolean existsNode(String path) throws KeeperException { 203 | return client.exists(path); 204 | } 205 | 206 | /** 207 | * 删除节点及所有递归子节点 208 | * 209 | * @param path 210 | * @throws KeeperException 211 | * @throws InterruptedException 212 | */ 213 | public void deleteZnodeByIte(String path) throws KeeperException, 214 | InterruptedException { 215 | Stack pathStack = new Stack(); 216 | 217 | pathStack = this.getZnodePathStack(pathStack, path); 218 | 219 | while (!pathStack.empty()) { 220 | this.deleteZNode(pathStack.pop()); 221 | } 222 | } 223 | 224 | /** 225 | * 增加节点 226 | * 227 | * @param path 228 | * @param data 229 | * @throws InterruptedException 230 | * @throws KeeperException 231 | */ 232 | public void addZNode(String path, String data) throws KeeperException, 233 | InterruptedException { 234 | // zk.create(path, data.getBytes(Charset.forName("utf-8")), 235 | // Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 236 | 237 | client.create(path, data, CreateMode.PERSISTENT); 238 | } 239 | 240 | /** 241 | * 将property文件中属性,以节点形式添加到当前path下 242 | * @param path 243 | * @param file 244 | * @return 245 | * @throws KeeperException 246 | * @throws InterruptedException 247 | */ 248 | public boolean addProperties(String path,InputStream is) throws KeeperException, InterruptedException { 249 | try { 250 | // path = StringUtils.endsWith(path, "/") ? path : (path + "/"); 251 | 252 | byte[] content = new byte[is.available()]; 253 | is.read(content); 254 | 255 | if(client.exists(path)) { 256 | this.updateZNode(path, new String(content)); 257 | } else { 258 | this.addZNode(path, new String(content)); 259 | } 260 | 261 | // Properties prop = new Properties(); 262 | // prop.load(is); 263 | // 264 | // Set> entrySet = prop.entrySet(); 265 | // 266 | // for(Entry entry : entrySet) { 267 | // String key = (String) entry.getKey(); 268 | // String value = (String) entry.getValue(); 269 | // if(!existsNode(path + key)) { 270 | // this.addZNode(path + key, value); 271 | // } else { 272 | // this.updateZNode(path + key, value); 273 | // } 274 | // } 275 | 276 | } catch (IOException e) { 277 | e.printStackTrace(); 278 | logger.error(e.getMessage()); 279 | return false; 280 | } catch (KeeperException e) { 281 | throw e; 282 | } catch (InterruptedException e) { 283 | throw e; 284 | } 285 | return true; 286 | } 287 | 288 | } 289 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.pagination/jquery.pagination.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This jQuery plugin displays pagination links inside the selected elements. 3 | * 4 | * This plugin needs at least jQuery 1.4.2 5 | * 6 | * @author Gabriel Birke (birke *at* d-scribe *dot* de) 7 | * @version 2.2 8 | * @param {int} maxentries Number of entries to paginate 9 | * @param {Object} opts Several options (see README for documentation) 10 | * @return {Object} jQuery Object 11 | */ 12 | (function($){ 13 | /** 14 | * @class Class for calculating pagination values 15 | */ 16 | $.PaginationCalculator = function(maxentries, opts) { 17 | this.maxentries = maxentries; 18 | this.opts = opts; 19 | } 20 | 21 | $.extend($.PaginationCalculator.prototype, { 22 | /** 23 | * Calculate the maximum number of pages 24 | * @method 25 | * @returns {Number} 26 | */ 27 | numPages:function() { 28 | return Math.ceil(this.maxentries/this.opts.items_per_page); 29 | }, 30 | /** 31 | * Calculate start and end point of pagination links depending on 32 | * current_page and num_display_entries. 33 | * @returns {Array} 34 | */ 35 | getInterval:function(current_page) { 36 | var ne_half = Math.floor(this.opts.num_display_entries/2); 37 | var np = this.numPages(); 38 | var upper_limit = np - this.opts.num_display_entries; 39 | var start = current_page > ne_half ? Math.max( Math.min(current_page - ne_half, upper_limit), 0 ) : 0; 40 | var end = current_page > ne_half?Math.min(current_page+ne_half + (this.opts.num_display_entries % 2), np):Math.min(this.opts.num_display_entries, np); 41 | return {start:start, end:end}; 42 | } 43 | }); 44 | 45 | // Initialize jQuery object container for pagination renderers 46 | $.PaginationRenderers = {} 47 | 48 | /** 49 | * @class Default renderer for rendering pagination links 50 | */ 51 | $.PaginationRenderers.defaultRenderer = function(maxentries, opts) { 52 | this.maxentries = maxentries; 53 | this.opts = opts; 54 | this.pc = new $.PaginationCalculator(maxentries, opts); 55 | } 56 | $.extend($.PaginationRenderers.defaultRenderer.prototype, { 57 | /** 58 | * Helper function for generating a single link (or a span tag if it's the current page) 59 | * @param {Number} page_id The page id for the new item 60 | * @param {Number} current_page 61 | * @param {Object} appendopts Options for the new item: text and classes 62 | * @returns {jQuery} jQuery object containing the link 63 | */ 64 | createLink:function(page_id, current_page, appendopts){ 65 | var lnk, np = this.pc.numPages(); 66 | page_id = page_id<0?0:(page_id" + appendopts.text + ""); 70 | } 71 | else 72 | { 73 | lnk = $("" + appendopts.text + "") 74 | .attr('href', this.opts.link_to.replace(/__id__/,page_id)); 75 | } 76 | if(appendopts.classes){ lnk.addClass(appendopts.classes); } 77 | lnk.data('page_id', page_id); 78 | return lnk; 79 | }, 80 | // Generate a range of numeric links 81 | appendRange:function(container, current_page, start, end, opts) { 82 | var i; 83 | for(i=start; i"); 92 | 93 | // Generate "Previous"-Link 94 | if(this.opts.prev_text && (current_page > 0 || this.opts.prev_show_always)){ 95 | fragment.append(this.createLink(current_page-1, current_page, {text:this.opts.prev_text, classes:"prev"})); 96 | } 97 | // Generate starting points 98 | if (interval.start > 0 && this.opts.num_edge_entries > 0) 99 | { 100 | end = Math.min(this.opts.num_edge_entries, interval.start); 101 | this.appendRange(fragment, current_page, 0, end, {classes:'sp'}); 102 | if(this.opts.num_edge_entries < interval.start && this.opts.ellipse_text) 103 | { 104 | jQuery(""+this.opts.ellipse_text+"").appendTo(fragment); 105 | } 106 | } 107 | // Generate interval links 108 | this.appendRange(fragment, current_page, interval.start, interval.end); 109 | // Generate ending points 110 | if (interval.end < np && this.opts.num_edge_entries > 0) 111 | { 112 | if(np-this.opts.num_edge_entries > interval.end && this.opts.ellipse_text) 113 | { 114 | jQuery(""+this.opts.ellipse_text+"").appendTo(fragment); 115 | } 116 | begin = Math.max(np-this.opts.num_edge_entries, interval.end); 117 | this.appendRange(fragment, current_page, begin, np, {classes:'ep'}); 118 | 119 | } 120 | // Generate "Next"-Link 121 | if(this.opts.next_text && (current_page < np-1 || this.opts.next_show_always)){ 122 | fragment.append(this.createLink(current_page+1, current_page, {text:this.opts.next_text, classes:"next"})); 123 | } 124 | $('a', fragment).click(eventHandler); 125 | return fragment; 126 | } 127 | }); 128 | 129 | // Extend jQuery 130 | $.fn.pagination = function(maxentries, opts){ 131 | 132 | // Initialize options with default values 133 | opts = jQuery.extend({ 134 | items_per_page:10, 135 | num_display_entries:11, 136 | current_page:0, 137 | num_edge_entries:0, 138 | link_to:"#", 139 | prev_text:"Prev", 140 | next_text:"Next", 141 | ellipse_text:"...", 142 | prev_show_always:true, 143 | next_show_always:true, 144 | renderer:"defaultRenderer", 145 | load_first_page:false, 146 | callback:function(){return false;} 147 | },opts||{}); 148 | 149 | var containers = this, 150 | renderer, links, current_page; 151 | 152 | /** 153 | * This is the event handling function for the pagination links. 154 | * @param {int} page_id The new page number 155 | */ 156 | function paginationClickHandler(evt){ 157 | var links, 158 | new_current_page = $(evt.target).data('page_id'), 159 | continuePropagation = selectPage(new_current_page); 160 | if (!continuePropagation) { 161 | evt.stopPropagation(); 162 | } 163 | return continuePropagation; 164 | } 165 | 166 | /** 167 | * This is a utility function for the internal event handlers. 168 | * It sets the new current page on the pagination container objects, 169 | * generates a new HTMl fragment for the pagination links and calls 170 | * the callback function. 171 | */ 172 | function selectPage(new_current_page) { 173 | // update the link display of a all containers 174 | containers.data('current_page', new_current_page); 175 | links = renderer.getLinks(new_current_page, paginationClickHandler); 176 | containers.empty(); 177 | links.appendTo(containers); 178 | // call the callback and propagate the event if it does not return false 179 | var continuePropagation = opts.callback(new_current_page, containers); 180 | return continuePropagation; 181 | } 182 | 183 | // ----------------------------------- 184 | // Initialize containers 185 | // ----------------------------------- 186 | current_page = opts.current_page; 187 | containers.data('current_page', current_page); 188 | // Create a sane value for maxentries and items_per_page 189 | maxentries = (!maxentries || maxentries < 0)?1:maxentries; 190 | opts.items_per_page = (!opts.items_per_page || opts.items_per_page < 0)?1:opts.items_per_page; 191 | 192 | if(!$.PaginationRenderers[opts.renderer]) 193 | { 194 | throw new ReferenceError("Pagination renderer '" + opts.renderer + "' was not found in jQuery.PaginationRenderers object."); 195 | } 196 | renderer = new $.PaginationRenderers[opts.renderer](maxentries, opts); 197 | 198 | // Attach control events to the DOM elements 199 | var pc = new $.PaginationCalculator(maxentries, opts); 200 | var np = pc.numPages(); 201 | containers.bind('setPage', {numPages:np}, function(evt, page_id) { 202 | if(page_id >= 0 && page_id < evt.data.numPages) { 203 | selectPage(page_id); return false; 204 | } 205 | }); 206 | containers.bind('prevPage', function(evt){ 207 | var current_page = $(this).data('current_page'); 208 | if (current_page > 0) { 209 | selectPage(current_page - 1); 210 | } 211 | return false; 212 | }); 213 | containers.bind('nextPage', {numPages:np}, function(evt){ 214 | var current_page = $(this).data('current_page'); 215 | if(current_page < evt.data.numPages - 1) { 216 | selectPage(current_page + 1); 217 | } 218 | return false; 219 | }); 220 | 221 | // When all initialisation is done, draw the links 222 | links = renderer.getLinks(current_page, paginationClickHandler); 223 | containers.empty(); 224 | links.appendTo(containers); 225 | // call callback function 226 | if(opts.load_first_page) { 227 | opts.callback(current_page, containers); 228 | } 229 | } // End of $.fn.pagination block 230 | 231 | })(jQuery); 232 | -------------------------------------------------------------------------------- /server/src/main/webapp/resources/jquery.treeview/jquery.treeview.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Treeview 1.5pre - jQuery plugin to hide and show branches of a tree 3 | * 4 | * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ 5 | * http://docs.jquery.com/Plugins/Treeview 6 | * 7 | * Copyright (c) 2007 Jörn Zaefferer 8 | * 9 | * Dual licensed under the MIT and GPL licenses: 10 | * http://www.opensource.org/licenses/mit-license.php 11 | * http://www.gnu.org/licenses/gpl.html 12 | * 13 | * Revision: $Id: jquery.treeview.js 5759 2008-07-01 07:50:28Z joern.zaefferer $ 14 | * 15 | */ 16 | 17 | ;(function($) { 18 | 19 | // TODO rewrite as a widget, removing all the extra plugins 20 | $.extend($.fn, { 21 | swapClass: function(c1, c2) { 22 | var c1Elements = this.filter('.' + c1); 23 | this.filter('.' + c2).removeClass(c2).addClass(c1); 24 | c1Elements.removeClass(c1).addClass(c2); 25 | return this; 26 | }, 27 | replaceClass: function(c1, c2) { 28 | return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); 29 | }, 30 | hoverClass: function(className) { 31 | className = className || "hover"; 32 | return this.hover(function() { 33 | $(this).addClass(className); 34 | }, function() { 35 | $(this).removeClass(className); 36 | }); 37 | }, 38 | heightToggle: function(animated, callback) { 39 | animated ? 40 | this.animate({ height: "toggle" }, animated, callback) : 41 | this.each(function(){ 42 | jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); 43 | if(callback) 44 | callback.apply(this, arguments); 45 | }); 46 | }, 47 | heightHide: function(animated, callback) { 48 | if (animated) { 49 | this.animate({ height: "hide" }, animated, callback); 50 | } else { 51 | this.hide(); 52 | if (callback) 53 | this.each(callback); 54 | } 55 | }, 56 | prepareBranches: function(settings) { 57 | if (!settings.prerendered) { 58 | // mark last tree items 59 | this.filter(":last-child:not(ul)").addClass(CLASSES.last); 60 | // collapse whole tree, or only those marked as closed, anyway except those marked as open 61 | this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); 62 | } 63 | // return all items with sublists 64 | return this.filter(":has(>ul)"); 65 | }, 66 | applyClasses: function(settings, toggler) { 67 | // TODO use event delegation 68 | this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) { 69 | // don't handle click events on children, eg. checkboxes 70 | if ( this == event.target ) 71 | toggler.apply($(this).next()); 72 | }).add( $("a", this) ).hoverClass(); 73 | 74 | if (!settings.prerendered) { 75 | // handle closed ones first 76 | this.filter(":has(>ul:hidden)") 77 | .addClass(CLASSES.expandable) 78 | .replaceClass(CLASSES.last, CLASSES.lastExpandable); 79 | 80 | // handle open ones 81 | this.not(":has(>ul:hidden)") 82 | .addClass(CLASSES.collapsable) 83 | .replaceClass(CLASSES.last, CLASSES.lastCollapsable); 84 | 85 | // create hitarea if not present 86 | var hitarea = this.find("div." + CLASSES.hitarea); 87 | if (!hitarea.length) 88 | hitarea = this.prepend("
        ").find("div." + CLASSES.hitarea); 89 | hitarea.removeClass().addClass(CLASSES.hitarea).each(function() { 90 | var classes = ""; 91 | $.each($(this).parent().attr("class").split(" "), function() { 92 | classes += this + "-hitarea "; 93 | }); 94 | $(this).addClass( classes ); 95 | }) 96 | } 97 | 98 | // apply event to hitarea 99 | this.find("div." + CLASSES.hitarea).click( toggler ); 100 | }, 101 | treeview: function(settings) { 102 | 103 | settings = $.extend({ 104 | cookieId: "treeview" 105 | }, settings); 106 | 107 | if ( settings.toggle ) { 108 | var callback = settings.toggle; 109 | settings.toggle = function() { 110 | return callback.apply($(this).parent()[0], arguments); 111 | }; 112 | } 113 | 114 | // factory for treecontroller 115 | function treeController(tree, control) { 116 | // factory for click handlers 117 | function handler(filter) { 118 | return function() { 119 | // reuse toggle event handler, applying the elements to toggle 120 | // start searching for all hitareas 121 | toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { 122 | // for plain toggle, no filter is provided, otherwise we need to check the parent element 123 | return filter ? $(this).parent("." + filter).length : true; 124 | }) ); 125 | return false; 126 | }; 127 | } 128 | // click on first element to collapse tree 129 | $("a:eq(0)", control).click( handler(CLASSES.collapsable) ); 130 | // click on second to expand tree 131 | $("a:eq(1)", control).click( handler(CLASSES.expandable) ); 132 | // click on third to toggle tree 133 | $("a:eq(2)", control).click( handler() ); 134 | } 135 | 136 | // handle toggle event 137 | function toggler() { 138 | $(this) 139 | .parent() 140 | // swap classes for hitarea 141 | .find(">.hitarea") 142 | .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 143 | .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 144 | .end() 145 | // swap classes for parent li 146 | .swapClass( CLASSES.collapsable, CLASSES.expandable ) 147 | .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 148 | // find child lists 149 | .find( ">ul" ) 150 | // toggle them 151 | .heightToggle( settings.animated, settings.toggle ); 152 | if ( settings.unique ) { 153 | $(this).parent() 154 | .siblings() 155 | // swap classes for hitarea 156 | .find(">.hitarea") 157 | .replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 158 | .replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) 159 | .end() 160 | .replaceClass( CLASSES.collapsable, CLASSES.expandable ) 161 | .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 162 | .find( ">ul" ) 163 | .heightHide( settings.animated, settings.toggle ); 164 | } 165 | } 166 | this.data("toggler", toggler); 167 | 168 | function serialize() { 169 | function binary(arg) { 170 | return arg ? 1 : 0; 171 | } 172 | var data = []; 173 | branches.each(function(i, e) { 174 | data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; 175 | }); 176 | $.cookie(settings.cookieId, data.join(""), settings.cookieOptions ); 177 | } 178 | 179 | function deserialize() { 180 | var stored = $.cookie(settings.cookieId); 181 | if ( stored ) { 182 | var data = stored.split(""); 183 | branches.each(function(i, e) { 184 | $(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); 185 | }); 186 | } 187 | } 188 | 189 | // add treeview class to activate styles 190 | this.addClass("treeview"); 191 | 192 | // prepare branches and find all tree items with child lists 193 | var branches = this.find("li").prepareBranches(settings); 194 | 195 | switch(settings.persist) { 196 | case "cookie": 197 | var toggleCallback = settings.toggle; 198 | settings.toggle = function() { 199 | serialize(); 200 | if (toggleCallback) { 201 | toggleCallback.apply(this, arguments); 202 | } 203 | }; 204 | deserialize(); 205 | break; 206 | case "location": 207 | var current = this.find("a").filter(function() { 208 | return this.href.toLowerCase() == location.href.toLowerCase(); 209 | }); 210 | if ( current.length ) { 211 | // TODO update the open/closed classes 212 | var items = current.addClass("selected").parents("ul, li").add( current.next() ).show(); 213 | if (settings.prerendered) { 214 | // if prerendered is on, replicate the basic class swapping 215 | items.filter("li") 216 | .swapClass( CLASSES.collapsable, CLASSES.expandable ) 217 | .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) 218 | .find(">.hitarea") 219 | .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) 220 | .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ); 221 | } 222 | } 223 | break; 224 | } 225 | 226 | branches.applyClasses(settings, toggler); 227 | 228 | // if control option is set, create the treecontroller and show it 229 | if ( settings.control ) { 230 | treeController(this, settings.control); 231 | $(settings.control).show(); 232 | } 233 | 234 | return this; 235 | } 236 | }); 237 | 238 | // classes used by the plugin 239 | // need to be styled via external stylesheet, see first example 240 | $.treeview = {}; 241 | var CLASSES = ($.treeview.classes = { 242 | open: "open", 243 | closed: "closed", 244 | expandable: "expandable", 245 | expandableHitarea: "expandable-hitarea", 246 | lastExpandableHitarea: "lastExpandable-hitarea", 247 | collapsable: "collapsable", 248 | collapsableHitarea: "collapsable-hitarea", 249 | lastCollapsableHitarea: "lastCollapsable-hitarea", 250 | lastCollapsable: "lastCollapsable", 251 | lastExpandable: "lastExpandable", 252 | last: "last", 253 | hitarea: "hitarea" 254 | }); 255 | 256 | })(jQuery); -------------------------------------------------------------------------------- /server/src/main/webapp/resources/base.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | /* 4 | @name: cashier.base.css 5 | @function: page reset for Chinabank project 6 | @author: lianglingjiang 7 | @build: 2013-5-14 16:57 8 | */ 9 | 10 | /* @start reset */ 11 | 12 | body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, form, fieldset, legend, input, textarea, p, blockquote, th, td, button, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section{margin:0;padding:0;} 13 | 14 | fieldset,img {border:0;} 15 | address,caption, cite,code,dfn,em,th,var{font-style:normal;font-weight:normal;} 16 | ol,ul {list-style:none;}/* Remove the list of symbols */ 17 | capation,th{text-align:left;} 18 | h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;} 19 | q:before, q:after{content:' '} 20 | abbr,acronym{border:0;} 21 | article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;}/* Reset HTML5 tags */ 22 | body, button, input, select, textarea {font-family:\5FAE\8F6F\96C5\9ED1,\9ED1\4F53,Verdana,Arial,sans-serif/*{ffDefault}*/;outline: none;color: #666;}/* for form */ 23 | 24 | /* Form elements do not inherit the parent-defined fonts */ 25 | input, select, textarea {font-size: 100%;background: #fff;color: #333;outline: none;} 26 | input, select, textarea { 27 | -moz-border-radius: 0; 28 | -khtml-border-radius: 0; 29 | -webkit-border-radius: 0; 30 | border-radius: 0; 31 | } 32 | 33 | /* for ios */ 34 | input, button {*overflow: visible;} 35 | 36 | /* ie7 following browser button double margins plus padding */ 37 | input {_overflow: hidden;} 38 | 39 | 40 | /* for firefox */ 41 | button {cursor: pointer;} 42 | 43 | textarea {resize: none;} 44 | 45 | /* Disable the drag of the input field in firefox, chrome, safari */ 46 | textarea {_overflow-y: auto;} 47 | 48 | /* ie6 input field is no scroll bar */ 49 | /* Merge table margins */ 50 | 51 | 52 | /* Remove the default borders and underline */ 53 | fieldset, img { 54 | border: 0; 55 | text-decoration: none; 56 | } 57 | 58 | /* @end reset*/ 59 | 60 | /* @util */ 61 | /* Hidden, usually in conjunction with JS */ 62 | .fn-hide{display:none;} 63 | /* Set inline to reduce the floating bug */ 64 | 65 | 66 | .fn-left { 67 | float: left; 68 | } 69 | 70 | 71 | 72 | .fn-right { 73 | float: right; 74 | } 75 | 76 | /* clear float */ 77 | .fn-clear:after { 78 | visibility: hidden; 79 | display: block; 80 | font-size: 0; 81 | content: " "; 82 | clear: both; 83 | height: 0; 84 | } 85 | 86 | .fn-clear { 87 | zoom: 1; /* for IE6 IE7 */ 88 | } 89 | 90 | 91 | 92 | /* 文字排版 */ 93 | .f10{font-size:10px;} 94 | .f12{font-size:12px;} 95 | .f13{font-size:13px;} 96 | .f14{font-size:14px;} 97 | .f16{font-size:16px;} 98 | .f18{font-size:18px;} 99 | .f20{font-size:20px;} 100 | .fb{font-weight:bold;} 101 | .fn{font-weight:normal;} 102 | .t2{text-indent:2em;} 103 | .lh150{line-height:150%} 104 | .lh180{line-height:180%} 105 | .lh200{line-height:200%} 106 | .unl{text-decoration:underline;} 107 | .no_unl{text-decoration:none;} 108 | 109 | 110 | /* 长度高度 */ 111 | .w10{width:10px;} 112 | .w20{width:20px;} 113 | .w30{width:30px;} 114 | .w40{width:40px;} 115 | .w50{width:50px;} 116 | .w60{width:60px;} 117 | .w70{width:70px;} 118 | .w80{width:80px;} 119 | .w90{width:90px;} 120 | .w100{width:100px;} 121 | .w200{width:200px;} 122 | .w300{width:300px;} 123 | .w400{width:400px;} 124 | .w500{width:500px;} 125 | .w600{width:600px;} 126 | .w700{width:700px;} 127 | .w800{width:800px;} 128 | .w{width:100%} 129 | .h50{width:50px;} 130 | .h80{width:80px;} 131 | .h100{width:100px;} 132 | .h200{width:200px;} 133 | .h{height:100%} 134 | 135 | 136 | /* 边距 */ 137 | .m10{margin:10px;} 138 | .m15{margin:15px;} 139 | .m30{margin:30px;} 140 | .mt5{margin-top:5px;} 141 | .mt10{margin-top:10px;} 142 | .mt15{margin-top:15px;} 143 | .mt20{margin-top:20px;} 144 | .mt30{margin-top:30px;} 145 | .mt40{margin-top:40px;} 146 | .mt50{margin-top:50px;} 147 | .mt100{margin-top:100px;} 148 | .mb5{margin-bottom:5px;} 149 | .mb10{margin-bottom:10px;} 150 | .mb15{margin-bottom:15px;} 151 | .mb20{margin-bottom:20px;} 152 | .mb30{margin-bottom:30px;} 153 | .mb50{margin-bottom:50px;} 154 | .mb100{margin-bottom:100px;} 155 | .ml3{margin-left:3px;} 156 | .ml5{margin-left:5px;} 157 | .ml10{margin-left:10px;} 158 | .ml15{margin-left:15px;} 159 | .ml20{margin-left:20px;} 160 | .ml30{margin-left:30px;} 161 | .ml50{margin-left:50px;} 162 | .ml80{margin-left:80px;} 163 | .ml100{margin-left:100px;} 164 | .ml110{margin-left:110px;} 165 | .mr5{margin-right:5px;} 166 | .mr10{margin-right:10px;} 167 | .mr15{margin-right:15px;} 168 | .mr20{margin-right:20px;} 169 | .mr30{margin-right:30px;} 170 | .mr50{margin-right:50px;} 171 | .mr100{margin-right:100px;} 172 | .p10{padding:10px;} 173 | .p15{padding:15px;} 174 | .p20{padding:20px;} 175 | .p30{padding:30px;} 176 | .pt5{padding-top:5px;} 177 | .pt10{padding-top:10px;} 178 | .pt15{padding-top:15px;} 179 | .pt20{padding-top:20px;} 180 | .pt30{padding-top:30px;} 181 | .pt40{padding-top:40px;} 182 | .pt50{padding-top:50px;} 183 | .pt100{padding-top:100px;} 184 | .pb5{padding-bottom:5px;} 185 | .pb10{padding-bottom:10px;} 186 | .pb15{padding-bottom:15px;} 187 | .pb20{padding-bottom:20px;} 188 | .pb30{padding-bottom:30px;} 189 | .pb50{padding-bottom:50px;} 190 | .pb100{padding-bottom:100px;} 191 | .pl5{padding-left:5px;} 192 | .pl10{padding-left:10px;} 193 | .pl15{padding-left:15px;} 194 | .pl20{padding-left:20px;} 195 | .pl30{padding-left:30px;} 196 | .pl50{padding-left:50px;} 197 | .pl80{padding-left:80px;} 198 | .pl100{padding-left:100px;} 199 | .pr5{padding-right:5px;} 200 | .pr10{padding-right:10px;} 201 | .pr15{padding-right:15px;} 202 | .pr20{padding-right:20px;} 203 | .pr30{padding-right:30px;} 204 | .pr50{padding-right:50px;} 205 | .pr100{padding-right:100px;} 206 | 207 | /*@grid*/ 208 | .grid-990 { 209 | width: 990px; 210 | margin: 0 auto; 211 | } 212 | 213 | .grid-780 { 214 | width: 780px; 215 | margin: 0 auto; 216 | } 217 | 218 | .grid-790 { 219 | width: 790px; 220 | } 221 | 222 | .grid-190 { 223 | width: 190px; 224 | } 225 | 226 | /*@layout*/ 227 | 228 | 229 | inline-block: {display:-moz-inline-box; display:inline-block; *display:inline; zoom:1; *margin-right:0px; vertical-align:middle; } 230 | 231 | /*@global style*/ 232 | 233 | 234 | a { 235 | color:#2f88cc; 236 | text-decoration: none; 237 | } 238 | 239 | a:hover { 240 | text-decoration: none; 241 | } 242 | 243 | 244 | 245 | body { 246 | font-size:12px; 247 | } 248 | 249 | table { 250 | font-size: 1em; 251 | } 252 | 253 | 254 | 255 | .ui-draggable, .ui-droppable { 256 | background-position: top; 257 | } 258 | 259 | 260 | .ft-red { 261 | color: red; 262 | } 263 | .ft-wyred { 264 | color: #e43b3e; 265 | } 266 | .ft-orange { 267 | color: #ff8800; 268 | } 269 | .ft-white { 270 | color: white; 271 | } 272 | .ft-gray { 273 | color:#999; 274 | } 275 | .ft-normal { 276 | color:#666666; 277 | } 278 | .ft-green { 279 | color: #8cc63f; 280 | } 281 | .ft-blue { 282 | color: #2f88cc; 283 | } 284 | .ft-bd { 285 | font-weight: bold; 286 | } 287 | .ft-12 { 288 | font-size: 12px; 289 | } 290 | .ft-14 { 291 | font-size: 14px; 292 | } 293 | .ft-18 { 294 | font-size: 18px; 295 | } 296 | .ft-24 { 297 | font-size: 24px; 298 | } 299 | .ft-12b { 300 | font-size: 12px; 301 | font-weight: bold; 302 | } 303 | .ft-14b { 304 | font-size: 14px; 305 | font-weight: bold; 306 | } 307 | .ft-18b { 308 | font-size: 18px; 309 | font-weight: bold; 310 | } 311 | .ft-24b { 312 | font-size: 24px; 313 | font-weight: bold; 314 | } 315 | .ft-bar { 316 | color: #AAAAAA; 317 | margin: 0 5px; 318 | } 319 | 320 | /*icon sprite start*/ 321 | .icon-small-right,.icon-small-error,.icon-small-warn,.icon-small-notice,.icon-small-question,.icon-small-minus,.icon-small-clock,.icon-small-date{ 322 | width: 14px; 323 | height: 14px; 324 | display: inline-block; 325 | *display:inline; 326 | zoom: 1; 327 | background: url(../images/sp-icons.png) no-repeat; 328 | _background: url(../images/sp-icons-ie.png) no-repeat; 329 | overflow: hidden; 330 | vertical-align: middle; 331 | margin: 0px 5px; 332 | } 333 | .icon-small-right{ 334 | background-position: -16px -68px; 335 | } 336 | .icon-small-error{ 337 | background-position: 0 -68px; 338 | } 339 | .icon-small-warn{ 340 | background-position: -32px -68px; 341 | } 342 | .icon-small-notice{ 343 | background-position: -49px -68px; 344 | } 345 | .icon-small-question{ 346 | background-position: -64px -68px; 347 | } 348 | .icon-small-minus{ 349 | background-position: -80px -68px; 350 | } 351 | .icon-small-clock{ 352 | background-position: -96px -68px; 353 | } 354 | .icon-small-date{ 355 | background-position: -139px -68px; 356 | } 357 | 358 | .icon-big-right,.icon-big-error,.icon-big-warn,.icon-big-clock{ 359 | width: 64px; 360 | height: 64px; 361 | display: inline-block; 362 | *display:inline; 363 | zoom: 1; 364 | background: url(../images/sp-icons.png) no-repeat; 365 | _background: url(../images/sp-icons-ie.png) no-repeat; 366 | overflow: hidden; 367 | vertical-align: middle; 368 | } 369 | .icon-big-right{ 370 | background-position: 0px 0px; 371 | } 372 | .icon-big-error{ 373 | background-position: -74px 0px; 374 | } 375 | .icon-big-warn{ 376 | background-position: -148px 0px; 377 | } 378 | .icon-big-clock{ 379 | background-position: -222px 0px; 380 | } 381 | 382 | .icon-wait-right { 383 | background: url(../images/icon-loading.gif) no-repeat scroll 0 0 rgba(0, 0, 0, 0); 384 | height: 32px; 385 | width: 32px; 386 | display: inline-block; 387 | } 388 | /*icon sprite end*/ --------------------------------------------------------------------------------