├── _config.yml ├── run.bat ├── redis_core ├── src │ ├── main │ │ ├── resources │ │ │ ├── Exception.properties │ │ │ ├── logback.properties │ │ │ ├── logback_2.xml │ │ │ └── logback.xml │ │ └── java │ │ │ └── com │ │ │ └── redis │ │ │ ├── config │ │ │ ├── RunStatus.java │ │ │ ├── MythProperties.java │ │ │ ├── Configs.java │ │ │ ├── RedisPoolProperty.java │ │ │ ├── RedisPools.java │ │ │ ├── PropertyFile.java │ │ │ └── PoolManagement.java │ │ │ ├── common │ │ │ ├── exception │ │ │ │ ├── ClientExceptionInfo.java │ │ │ │ ├── NoticeInfo.java │ │ │ │ ├── ReadConfigException.java │ │ │ │ ├── ActionErrorException.java │ │ │ │ ├── TypeErrorException.java │ │ │ │ ├── RedisConnectionException.java │ │ │ │ ├── MythException.java │ │ │ │ └── ExceptionInfo.java │ │ │ └── Commands.java │ │ │ ├── MythRedis.java │ │ │ ├── utils │ │ │ ├── MythTime.java │ │ │ └── MythReflect.java │ │ │ └── assemble │ │ │ ├── hash │ │ │ └── RedisHash.java │ │ │ ├── set │ │ │ ├── RedisSet.java │ │ │ └── sort │ │ │ │ └── RedisSortSet.java │ │ │ ├── key │ │ │ └── RedisKey.java │ │ │ └── list │ │ │ └── RedisList.java │ └── test │ │ └── java │ │ ├── com │ │ └── redis │ │ │ ├── utils │ │ │ ├── MythTimeTest.java │ │ │ ├── RedisBenchMark.java │ │ │ └── MythReflectTest.java │ │ │ ├── config │ │ │ ├── RunStatusTest.java │ │ │ ├── RedisPoolPropertyTest.java │ │ │ ├── PropertyFileTest.java │ │ │ └── PoolManagementTest.java │ │ │ ├── common │ │ │ └── exception │ │ │ │ └── ExceptionTest.java │ │ │ └── assemble │ │ │ ├── hash │ │ │ └── RedisHashTest.java │ │ │ ├── key │ │ │ └── RedisKeyTest.java │ │ │ ├── set │ │ │ ├── sort │ │ │ │ └── RedisSortSetTest.java │ │ │ └── RedisSetTest.java │ │ │ └── list │ │ │ └── RedisListTest.java │ │ └── config │ │ └── JunitTest.java └── build.gradle ├── settings.gradle ├── .gitignore ├── ChangeLog.md ├── run.sh ├── Technology.md ├── dependencys.gradle ├── redis_client ├── src │ ├── main │ │ ├── java │ │ │ └── redis │ │ │ │ └── manager │ │ │ │ ├── compont │ │ │ │ ├── menu │ │ │ │ │ ├── MyMenuItem.java │ │ │ │ │ ├── DestroyMenu.java │ │ │ │ │ ├── AttributeSetMenu.java │ │ │ │ │ ├── CreateKeyMenu.java │ │ │ │ │ └── DelMenu.java │ │ │ │ ├── MyTab.java │ │ │ │ ├── alert │ │ │ │ │ └── MyAlert.java │ │ │ │ ├── MyTreeItem.java │ │ │ │ └── MyContextMenu.java │ │ │ │ ├── controller │ │ │ │ ├── operation │ │ │ │ │ ├── DoAction.java │ │ │ │ │ ├── panel │ │ │ │ │ │ ├── ShowPanel.java │ │ │ │ │ │ ├── ConnectPanel.java │ │ │ │ │ │ └── HashPanel.java │ │ │ │ │ ├── StringAction.java │ │ │ │ │ ├── SetAction.java │ │ │ │ │ ├── HashAction.java │ │ │ │ │ ├── ZsetAction.java │ │ │ │ │ └── ListAction.java │ │ │ │ ├── ListAddController.java │ │ │ │ ├── HashAddController.java │ │ │ │ ├── AddKeyController.java │ │ │ │ └── TabPaneController.java │ │ │ │ ├── entity │ │ │ │ └── TableEntity.java │ │ │ │ └── Main.java │ │ └── resources │ │ │ └── views │ │ │ ├── ListAddLayout.fxml │ │ │ ├── HashAddLayout.fxml │ │ │ ├── AddKeyLayout.fxml │ │ │ ├── MainLayout.fxml │ │ │ ├── ConnectLayout.fxml │ │ │ └── TabPaneLayout.fxml │ └── test │ │ └── java │ │ └── redis │ │ └── manager │ │ └── AppTest.java └── build.gradle ├── README.md └── Process.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | java -jar ./redis_client/build/libs/redis_client-1.0.0-all.jar 2 | -------------------------------------------------------------------------------- /redis_core/src/main/resources/Exception.properties: -------------------------------------------------------------------------------- 1 | connection_config_not_exist=连接配置不存在,请刷新重试,或者新建连接 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'MythRedisClient' 2 | include 'redis_core','redis_client' 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.iml 3 | .gradle/ 4 | logs/ 5 | .idea/ 6 | target/ 7 | *.out 8 | buildgenerated-src/ 9 | !build.gradle 10 | out/ 11 | 12 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | ## 初步基本可用 2 | > 2017-07-01 18:33:18 3 | 4 | - [ ] 手动输入命令的执行界面 5 | - sh脚本启动的优化 + 6 | - 尽可能抛弃Spring框架,轻量化 + 7 | 8 | ## 1.0.0 9 | > 2017-07-09 10:06:49 10 | 11 | - 全面舍弃Spring框架,采用懒汉单例模式,因为感觉Spring没有体现出优势,反而觉得占用地方 12 | 13 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 使用这种方式将输出台的信息全部发送到黑洞,但是项目正常的log文件输出还是正常的 4 | # 也说明了java的日志输出是当前jar运行路径下新建 log 目录然后输出log文件 5 | # 可以配置 alias redis_client='sh yourpath/run.sh' 方便运行 6 | cd `dirname $0` 7 | nohup java -jar `find . -name *-all.jar` -Xmx1024m -Xms1024m -Xmn512m >/dev/null 2>&1 8 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/config/RunStatus.java: -------------------------------------------------------------------------------- 1 | package com.redis.config; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-18 上午8:14 5 | */ 6 | public interface RunStatus { 7 | // 配置文件中找不到key时的返回值,用作判断使用 8 | String PROPERTY_IS_NULL = null; 9 | } 10 | -------------------------------------------------------------------------------- /Technology.md: -------------------------------------------------------------------------------- 1 | # 关于技术实现的细节解释 2 | - 自定义的异常是实例化的时候可以自定义的记录日志,而且自定义异常提示信息,方便弹窗提示等便利的提示 3 | 4 | ### 关于 redis_core 模块的初始化 5 | - 使用PoolManagemen的单例获取实例,设置下配置文件中的id就可用了 6 | - 所以在进行配置文件的操作的时候,打开的是没有连接池实例的连接池管理对象 7 | - 切换连接池,通过 switchPool方法来实现(不能直接set,如果前台进行了限制倒也可以),因为都是动态获取Jedis连接的 8 | 9 | - [ ] 关于Redis的多服务器的管理,树形图以及窗口缩放内存泄露问题 2017-09-29 22:55:08 10 | 11 | 12 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/ClientExceptionInfo.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-26 上午9:27 5 | * 管理 客户端的异常提示信息 6 | * 7 | * @author Kuangcp 8 | */ 9 | public interface ClientExceptionInfo { 10 | 11 | // JavaFX 12 | String CONNECTION_UNUSABLE = "连接不可用"; 13 | } 14 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/NoticeInfo.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-12 上午10:24 5 | * 记录操作的放在这里 6 | */ 7 | public interface NoticeInfo { 8 | 9 | String MAP_CONTAIN_POOL = "缓存集合中已经存在 从内存中调用: "; 10 | String CONFIG_CONTAIN_POOL = "配置文件中存在该连接池配置: "; 11 | String CRETE_POOL = "创建连接池并存入配置文件 : "; 12 | String DELETE_POOL_SUCCESS = "删除该连接池配置成功 : "; 13 | String DELETE_POOL_FAILED = "删除该连接池配置失败 : "; 14 | 15 | String DESTROY_POOL = "销毁连接池 : "; 16 | String ERROR_INFO = "错误栈信息如下 : "; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /redis_core/src/test/java/com/redis/utils/MythTimeTest.java: -------------------------------------------------------------------------------- 1 | package com.redis.utils; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * Created by https://github.com/kuangcp on 17-6-21 上午10:10 7 | */ 8 | public class MythTimeTest { 9 | @Test 10 | public void getTime() throws Exception { 11 | System.out.println(MythTime.getTime()); 12 | } 13 | 14 | @Test 15 | public void getDateTime() throws Exception { 16 | System.out.println(MythTime.getDateTime()); 17 | } 18 | @Test 19 | public void testDate(){ 20 | System.out.println(MythTime.getDate()); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/ReadConfigException.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-12 上午9:54 5 | */ 6 | public class ReadConfigException extends MythException { 7 | 8 | public ReadConfigException() { 9 | } 10 | 11 | public ReadConfigException(String message) { 12 | super(message); 13 | } 14 | 15 | public ReadConfigException(String message, Class location) { 16 | super(message, location); 17 | } 18 | 19 | public ReadConfigException(String message, Throwable cause, Class location) { 20 | super(message, cause, location); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/ActionErrorException.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-22 上午10:20 5 | */ 6 | public class ActionErrorException extends MythException { 7 | 8 | public ActionErrorException() { 9 | } 10 | 11 | public ActionErrorException(String message) { 12 | super(message); 13 | } 14 | 15 | public ActionErrorException(String message, Class location) { 16 | super(message, location); 17 | } 18 | 19 | public ActionErrorException(String message, Throwable cause, Class location) { 20 | super(message, cause, location); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /redis_core/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: "info.robotbrain.lombok" 3 | 4 | javadoc { 5 | options { 6 | encoding "UTF-8" 7 | charSet 'UTF-8' 8 | author true 9 | version true 10 | links "http://docs.oracle.com/javase/8/docs/api" 11 | } 12 | } 13 | configurations { 14 | } 15 | sourceCompatibility = 1.8 16 | buildscript { 17 | repositories { 18 | maven { 19 | url "https://plugins.gradle.org/m2/" 20 | } 21 | } 22 | dependencies { 23 | classpath "info.robotbrain.gradle.lombok:lombok-gradle:1.1" 24 | } 25 | } 26 | repositories { 27 | mavenCentral() 28 | } 29 | 30 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/TypeErrorException.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-18 上午9:28 5 | */ 6 | public class TypeErrorException extends MythException { 7 | 8 | public TypeErrorException() { 9 | super(); 10 | } 11 | 12 | public TypeErrorException(String message) { 13 | super(message); 14 | } 15 | 16 | public TypeErrorException(String message, Class location) { 17 | super(message, location); 18 | } 19 | 20 | public TypeErrorException(String message, Throwable cause, Class location) { 21 | super(message, cause, location); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/RedisConnectionException.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-9 下午9:17 5 | * 在得到异常的时候就加入日志 6 | */ 7 | public class RedisConnectionException extends MythException { 8 | 9 | public RedisConnectionException() { 10 | } 11 | 12 | public RedisConnectionException(String msg) { 13 | super(msg); 14 | } 15 | 16 | public RedisConnectionException(String msg, Class location) { 17 | super(msg, location); 18 | } 19 | 20 | public RedisConnectionException(String message, Throwable cause, Class location) { 21 | super(message, cause, location); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dependencys.gradle: -------------------------------------------------------------------------------- 1 | ext.versions = [ 2 | spring : '4.3.8.RELEASE', 3 | slf4j : '1.7.22', 4 | logback : '1.1.11', 5 | httpclient: '4.3.1', 6 | jedis : '2.9.0', 7 | junit : '4.12', 8 | ] 9 | ext.libraries = [ 10 | "junit" : "junit:junit:$versions.junit", 11 | "logback-classic": "ch.qos.logback:logback-classic:$versions.logback", 12 | "common-logging" : "commons-logging:commons-logging:1.1.11", 13 | "jedis" : "redis.clients:jedis:$versions.jedis", 14 | "mockito-core" : "org.mockito:mockito-core:2.7.22", 15 | "slf4j-api" : "org.slf4j:slf4j-api:$versions.slf4j", 16 | "openjfx-dialogs": "org.controlsfx:openjfx-dialogs:1.0.2", 17 | 18 | ] -------------------------------------------------------------------------------- /redis_core/src/test/java/com/redis/config/RunStatusTest.java: -------------------------------------------------------------------------------- 1 | package com.redis.config; 2 | 3 | import org.junit.Test; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | import java.io.File; 8 | 9 | /** 10 | * Created by https://github.com/kuangcp on 17-6-9 上午10:24 11 | */ 12 | public class RunStatusTest { 13 | private static Logger logger = LoggerFactory.getLogger(RunStatus.class); 14 | // 将配置文件放在用户目录下作为隐藏文件 15 | @Test 16 | public void path(){ 17 | String propertyFile = System.getProperty("user.home") + File.separatorChar +".MythRedisClient.properties"; 18 | logger.info(propertyFile); 19 | assert(propertyFile.endsWith(".MythRedisClient.properties")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /redis_core/src/test/java/com/redis/common/exception/ExceptionTest.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | import org.junit.Test; 4 | 5 | /** 6 | * Created by https://github.com/kuangcp on 17-6-13 下午8:36 7 | * 测试Exception 日志记录 8 | */ 9 | public class ExceptionTest { 10 | 11 | // 测试自定义异常类的机制 12 | @Test 13 | public void run(){ 14 | System.out.println(""); 15 | Exception e = new RedisConnectionException(ExceptionInfo.OPEN_CONFIG_FAILED,ExceptionTest.class); 16 | try { 17 | throw new ReadConfigException(ExceptionInfo.GET_POOL_BY_ID_FAILED,e,ExceptionTest.class); 18 | } catch (ReadConfigException e1) { 19 | e1.printStackTrace(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/MythRedis.java: -------------------------------------------------------------------------------- 1 | package com.redis; 2 | 3 | import com.redis.config.PoolManagement; 4 | 5 | /** 6 | * Created by https://github.com/kuangcp on 17-6-17 下午7:56 7 | * 主线程 8 | */ 9 | public class MythRedis implements Runnable{ 10 | private boolean runFlag = true; 11 | 12 | public static void init(String id){ 13 | PoolManagement management; 14 | management = PoolManagement.getInstance(); 15 | management.setCurrentPoolId(id); 16 | Thread thread = new Thread(new MythRedis()); 17 | thread.start(); 18 | } 19 | 20 | public static void main(String[]s){ 21 | init("1024"); 22 | } 23 | 24 | @Override 25 | public void run() { 26 | while (runFlag){ 27 | 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /redis_core/src/test/java/com/redis/utils/RedisBenchMark.java: -------------------------------------------------------------------------------- 1 | package com.redis.utils; 2 | 3 | import com.redis.config.PoolManagement; 4 | import org.junit.Test; 5 | import redis.clients.jedis.Jedis; 6 | 7 | /** 8 | * Created by https://github.com/kuangcp on 17-6-29 上午10:58 9 | * 使用本地,所以性能测出来很快,一般受限于带宽 10 | * 11 | * @author Kuangcp 12 | */ 13 | public class RedisBenchMark { 14 | 15 | @Test 16 | public void checkSet() { 17 | PoolManagement management = PoolManagement.getInstance(); 18 | management.setCurrentPoolId("1010"); 19 | Jedis jedis = management.getRedisPool().getJedis(); 20 | 21 | System.out.println(MythTime.getTime()); 22 | for (int i = 0; i < 30000; i++) { 23 | jedis.set(i + "", "23232323"); 24 | } 25 | System.out.println(MythTime.getTime()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /redis_client/src/main/java/redis/manager/compont/menu/MyMenuItem.java: -------------------------------------------------------------------------------- 1 | package redis.manager.compont.menu; 2 | 3 | import com.redis.assemble.key.RedisKey; 4 | import com.redis.config.PoolManagement; 5 | import javafx.scene.control.MenuItem; 6 | import javafx.scene.control.TreeView; 7 | import redis.manager.Main; 8 | 9 | /** 10 | * 上下文菜单的抽象类, 所有上下文菜单的基类. 11 | * User: huang 12 | * Date: 17-6-25 13 | */ 14 | public abstract class MyMenuItem extends MenuItem { 15 | 16 | protected PoolManagement poolManagement = Main.getManagement(); 17 | protected RedisKey redisKey = Main.getRedisKey(); 18 | 19 | protected MyMenuItem(String label) { 20 | super(label); 21 | } 22 | 23 | /** 24 | * 点击处理方法. 25 | * @param treeView treeView 26 | */ 27 | protected abstract void setAction(TreeView treeView); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /redis_client/src/test/java/redis/manager/AppTest.java: -------------------------------------------------------------------------------- 1 | package redis.manager; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple Main. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest(String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/utils/MythTime.java: -------------------------------------------------------------------------------- 1 | package com.redis.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * Created by https://github.com/kuangcp on 17-6-21 上午10:07 8 | * 自定义时间工具类 9 | */ 10 | public class MythTime { 11 | 12 | private static SimpleDateFormat simpleDateFormat; 13 | 14 | public static String getTime() { 15 | Date date = new Date(); 16 | simpleDateFormat = new SimpleDateFormat("HH:mm:ss:MM"); 17 | return simpleDateFormat.format(date); 18 | } 19 | 20 | public static String getDateTime() { 21 | Date date = new Date(); 22 | simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:MM"); 23 | return simpleDateFormat.format(date); 24 | } 25 | 26 | public static String getDate() { 27 | Date date = new Date(); 28 | simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); 29 | return simpleDateFormat.format(date); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/MythException.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * Created by https://github.com/kuangcp on 17-6-12 上午9:57 8 | * 暂时使用时间来记录,考虑是否添加时间日期上去 9 | */ 10 | public class MythException extends Exception { 11 | 12 | private Logger logger; 13 | 14 | public MythException() { 15 | } 16 | 17 | public MythException(String message) { 18 | super(message); 19 | } 20 | 21 | public MythException(String message, Class location) { 22 | super(message); 23 | logger = LoggerFactory.getLogger(location); 24 | logger.error(" " + this.getClass().getSimpleName() + " : " + message); 25 | } 26 | 27 | public MythException(String message, Throwable cause, Class location) { 28 | super(message, cause); 29 | logger = LoggerFactory.getLogger(location); 30 | logger.error(" " + this.getClass().getSimpleName() + " :" + message); 31 | logger.debug(NoticeInfo.ERROR_INFO, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /redis_client/src/main/java/redis/manager/compont/MyTab.java: -------------------------------------------------------------------------------- 1 | package redis.manager.compont; 2 | 3 | import javafx.fxml.FXMLLoader; 4 | import javafx.scene.control.Tab; 5 | import javafx.scene.layout.AnchorPane; 6 | import redis.manager.Main; 7 | 8 | import java.io.IOException; 9 | 10 | /** 11 | * 我的tab. 12 | * User: huang 13 | * Date: 17-6-9 14 | */ 15 | public class MyTab extends Tab { 16 | private FXMLLoader loader; 17 | 18 | public MyTab(String title) { 19 | super(title); 20 | } 21 | 22 | /** 23 | * 初始化设置, 添加一个特定的Pane. 24 | */ 25 | public void init() { 26 | loader = new FXMLLoader(); 27 | loader.setLocation(Main.class.getResource("/views/TabPaneLayout.fxml")); 28 | try { 29 | AnchorPane tabPane = loader.load(); 30 | // 添加新标签页 31 | this.setContent(tabPane); 32 | 33 | } catch (IOException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | public FXMLLoader getLoader() { 39 | return loader; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /redis_core/src/main/resources/logback.properties: -------------------------------------------------------------------------------- 1 | ## 配置文件并没有生效 2 | #log4j.rootLogger = debug,A,B,C 3 | ##log4j.logger.com.redis = debug 4 | ##log4j.logger.assemble = debug 5 | ## 输出到控制台 6 | #log4j.appender.A = org.apache.log4j.ConsoleAppender 7 | #log4j.appender.A.Target = System.out 8 | #log4j.appender.A.layout = org.apache.log4j.PatternLayout 9 | #log4j.appender.A.layout.ConversionPattern = %p %t %c - %m%n 10 | # 11 | ## 输出到日志文件 12 | #log4j.appender.B = org.apache.log4j.DailyRollingFileAppender 13 | #log4j.appender.B.File = /home/kcp/logs/logs.log 14 | #log4j.appender.B.Append = true 15 | #log4j.appender.B.Threshold = DEBUG # 输出EBUG级别以上的日志 16 | #log4j.appender.B.layout = org.apache.log4j.PatternLayout 17 | #log4j.appender.B.layout.ConversionPattern = %p %t %c - %m%n 18 | ## 保存异常信息到单独文件 19 | #log4j.appender.C = org.apache.log4j.DailyRollingFileAppender 20 | #log4j.appender.C.File = logs/error.log # 异常日志文件名 21 | #log4j.appender.C.Append = true 22 | #log4j.appender.C.Threshold = ERROR #只输出ERROR级别以上的日志 23 | #log4j.appender.C.layout = org.apache.log4j.PatternLayout 24 | #log4j.appender.C.layout.ConversionPattern = %p %t %c - %m%n -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/config/MythProperties.java: -------------------------------------------------------------------------------- 1 | package com.redis.config; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.util.Properties; 5 | 6 | /** 7 | * Created by https://github.com/kuangcp on 17-6-9 下午7:34 8 | * Properties的改良类 9 | */ 10 | public class MythProperties extends Properties{ 11 | 12 | public int getInt(String key){ 13 | return Integer.parseInt(this.getProperty(key)); 14 | } 15 | public String getString(String key){ 16 | String result = RunStatus.PROPERTY_IS_NULL; 17 | try { 18 | String temp = this.getProperty(key); 19 | if(temp!=null){ 20 | result = new String(temp.getBytes("utf-8"), "utf-8"); 21 | // System.out.println(result); 22 | }else{ 23 | // 如果没有这个key就返回null 24 | return result; 25 | } 26 | } catch (UnsupportedEncodingException e) { 27 | e.printStackTrace(); 28 | } 29 | return result; 30 | } 31 | 32 | public boolean getBoolean(String key) { 33 | return Boolean.parseBoolean(key); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /redis_client/src/main/java/redis/manager/compont/alert/MyAlert.java: -------------------------------------------------------------------------------- 1 | package redis.manager.compont.alert; 2 | 3 | import javafx.beans.NamedArg; 4 | import javafx.scene.control.Alert; 5 | 6 | /** 7 | * 使用单例获取提示框. 8 | * User: huang 9 | * Date: 17-6-27 10 | */ 11 | public final class MyAlert { 12 | 13 | private static Alert warningAlert; 14 | 15 | private MyAlert() { 16 | 17 | } 18 | 19 | /** 20 | * 获取提示框实例. 21 | * @param alertType 类型 22 | * @return 提示框实例 23 | */ 24 | public synchronized static Alert getInstance(@NamedArg("alertType") Alert.AlertType alertType) { 25 | if (warningAlert == null) { 26 | synchronized (MyAlert.class) { 27 | if (warningAlert == null) { 28 | warningAlert = new Alert(alertType); 29 | warningAlert.setHeaderText(""); 30 | } 31 | } 32 | return warningAlert; 33 | } 34 | synchronized (MyAlert.class) { 35 | warningAlert.setAlertType(alertType); 36 | warningAlert.setHeaderText(""); 37 | return warningAlert; 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /redis_core/src/main/java/com/redis/common/exception/ExceptionInfo.java: -------------------------------------------------------------------------------- 1 | package com.redis.common.exception; 2 | 3 | /** 4 | * Created by https://github.com/kuangcp on 17-6-12 上午10:08 5 | * 各种异常提示信息放在这里 6 | */ 7 | public interface ExceptionInfo { 8 | 9 | String GET_POOL_BY_ID_FAILED = "获取指定id的连接池失败"; 10 | String NOT_EXIST_CURRENT_POOL = "当前没有活跃的连接池(Init CurrentId is Null)"; 11 | 12 | 13 | String POOL_NOT_AVAILABLE = "该连接池获取连接失败"; 14 | String DELETE_POOL_ERROR = "删除连接池异常"; 15 | String DELETE_POOL_NOT_EXIST = "要删除的连接池配置不存在:"; 16 | String VALUE_NOT_INT = "该对象不能转换成数值类型"; 17 | String KEY_TYPE_NOT_STRING = "Key 不是String类型"; 18 | 19 | String CREATE_CONFIG_SUCCESS = "创建主配置文件成功"; 20 | String CREATE_CONFIG_FAILED = "创建主配置文件失败,检查文件夹访问权限"; 21 | String OPEN_CONFIG_FAILED = "打开配置文件失败:"; 22 | String POOL_NOT_EXIST_CONFIG = "配置文件中不存在该连接池,请刷新重试或新建添加"; 23 | String UPDATE_CONFIG_KEY_FAILED = "配置文件中更新属性失败"; 24 | String SAVE_CONFIG__KEY_FAILED = "配置文件中添加属性失败"; 25 | String DELETE_CONFIG_KEY_FAILED = "配置文件中删除属性失败"; 26 | 27 | String KEY_NOT_EXIST = "Key 不存在"; 28 | String TYPE_ERROR = "类型错误"; 29 | String INPUT_CONFIG_ERROR = "面板中输入的信息有错误"; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /redis_client/src/main/java/redis/manager/compont/menu/DestroyMenu.java: -------------------------------------------------------------------------------- 1 | package redis.manager.compont.menu; 2 | 3 | import javafx.scene.control.Label; 4 | import javafx.scene.control.TreeItem; 5 | import javafx.scene.control.TreeView; 6 | 7 | /** 8 | * Describe. 9 | * User: huang 10 | * Date: 17-6-26 11 | */ 12 | public class DestroyMenu extends MyMenuItem { 13 | 14 | public DestroyMenu(TreeView treeView) { 15 | super("销毁"); 16 | setAction(treeView); 17 | } 18 | 19 | 20 | /** 21 | * 删除连接. 22 | * @param treeView 23 | */ 24 | @Override 25 | protected void setAction(TreeView treeView) { 26 | super.setOnAction( 27 | (event) -> { 28 | TreeItem