├── .github └── workflows │ └── maven.yml ├── .gitignore ├── .idea ├── compiler.xml ├── discord.xml ├── jarRepositories.xml ├── libraries │ ├── Maven__com_google_code_gson_gson_2_8_9.xml │ ├── Maven__org_apache_commons_commons_pool2_2_11_1.xml │ ├── Maven__org_json_json_20211205.xml │ ├── Maven__org_projectlombok_lombok_1_18_24.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_32.xml │ └── Maven__redis_clients_jedis_4_2_3.xml ├── misc.xml ├── modules.xml ├── shelf │ ├── Uncommitted_changes_before_Update_at_9_08_2022_11_35_am_[Changes] │ │ └── shelved.patch │ └── Uncommitted_changes_before_Update_at_9_08_2022_11_35_am__Changes_.xml ├── vcs.xml └── workspace.xml ├── AtlasRedisAPI.iml ├── LICENSE.txt ├── README.md ├── docs ├── allclasses-frame.html ├── allclasses-noframe.html ├── constant-values.html ├── deprecated-list.html ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-2.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── net │ └── swofty │ │ └── redisapi │ │ ├── api │ │ ├── ChannelFunctionType.html │ │ ├── ChannelRegistry.html │ │ ├── RedisAPI.html │ │ ├── RedisChannel.html │ │ ├── Utility.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── events │ │ ├── EventRegistry.html │ │ ├── RedisMessagingReceiveEvent.html │ │ ├── RedisMessagingReceiveInterface.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ └── exceptions │ │ ├── ChannelAlreadyRegisteredException.html │ │ ├── ChannelDefinitionError.html │ │ ├── ChannelNotRegisteredException.html │ │ ├── CouldNotConnectToRedisException.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html ├── overview-frame.html ├── overview-summary.html ├── overview-tree.html ├── package-list ├── script.js ├── serialized-form.html └── stylesheet.css ├── pom.xml └── src └── main └── java └── net └── swofty └── redisapi ├── api ├── ChannelFunctionType.java ├── ChannelRegistry.java ├── RedisAPI.java ├── RedisChannel.java ├── RedisCredentials.java └── Utility.java ├── events ├── EventRegistry.java ├── RedisMessagingReceiveEvent.java └── RedisMessagingReceiveInterface.java └── exceptions ├── ChannelAlreadyRegisteredException.java ├── ChannelDefinitionError.java ├── ChannelNotRegisteredException.java ├── CouldNotConnectToRedisException.java └── MessageFailureException.java /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Set up JDK 11 20 | uses: actions/setup-java@v3 21 | with: 22 | java-version: '11' 23 | distribution: 'temurin' 24 | cache: maven 25 | - name: Build with Maven 26 | run: mvn -B package --file pom.xml 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /target/ -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/discord.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_gson_gson_2_8_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_pool2_2_11_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_json_json_20211205.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_projectlombok_lombok_1_18_24.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_32.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__redis_clients_jedis_4_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/shelf/Uncommitted_changes_before_Update_at_9_08_2022_11_35_am_[Changes]/shelved.patch: -------------------------------------------------------------------------------- 1 | Index: src/main/java/net/swofty/redisapi/api/ChannelRegistry.java 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP 4 | <+>package net.swofty.redisapi.api;\r\n\r\nimport net.swofty.redisapi.events.EventRegistry;\r\nimport net.swofty.redisapi.exceptions.ChannelAlreadyRegisteredException;\r\nimport net.swofty.redisapi.exceptions.ChannelNotRegisteredException;\r\nimport lombok.NonNull;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Objects;\r\n\r\npublic class ChannelRegistry {\r\n\r\n public static ArrayList registeredChannels = new ArrayList<>();\r\n\r\n /**\r\n * Used to receive a channel that has already been registered\r\n * @param channelName the name of the channel that is being filtered\r\n * @return channel object\r\n * @throws ChannelNotRegisteredException returns channelNotRegistered when you call this method upon a channel that does not exist\r\n */\r\n @NonNull\r\n public static RedisChannel getFromName(String channelName) {\r\n return registeredChannels.stream().filter(channel -> Objects.equals(channel.channelName, channelName)).findFirst().orElseThrow(() -> new ChannelNotRegisteredException(\"There is no channel registered with the name '\" + channelName + \"'\"));\r\n }\r\n\r\n public static void registerChannel(RedisChannel channel) {\r\n if (registeredChannels.stream().anyMatch(channel2 -> channel2.channelName.equals(channel.channelName)))\r\n throw new ChannelAlreadyRegisteredException(\"A channel already exists with this name '\" + channel.channelName + \"'\");\r\n\r\n registeredChannels.add(channel);\r\n Utility.runAsync(() -> RedisAPI.getInstance().getPool().getResource().subscribe(EventRegistry.pubSub, channel.channelName));\r\n }\r\n\r\n}\r\n 5 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 6 | <+>UTF-8 7 | =================================================================== 8 | diff --git a/src/main/java/net/swofty/redisapi/api/ChannelRegistry.java b/src/main/java/net/swofty/redisapi/api/ChannelRegistry.java 9 | --- a/src/main/java/net/swofty/redisapi/api/ChannelRegistry.java (revision b62fe2bd4d6000ee4d1308c9165d6629373b80ed) 10 | +++ b/src/main/java/net/swofty/redisapi/api/ChannelRegistry.java (date 1659798405303) 11 | @@ -30,5 +30,4 @@ 12 | registeredChannels.add(channel); 13 | Utility.runAsync(() -> RedisAPI.getInstance().getPool().getResource().subscribe(EventRegistry.pubSub, channel.channelName)); 14 | } 15 | - 16 | } 17 | Index: pom.xml 18 | IDEA additional info: 19 | Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP 20 | <+>\r\n\r\n 4.0.0\r\n\r\n net.swofty\r\n AtlasRedisAPI\r\n 1.0-SNAPSHOT\r\n\r\n \r\n 1.8\r\n 1.8\r\n \r\n\r\n \r\n \r\n org.projectlombok\r\n lombok\r\n 1.18.24\r\n provided\r\n \r\n \r\n redis.clients\r\n jedis\r\n 4.2.3\r\n compile\r\n \r\n \r\n\r\n 21 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 22 | <+>UTF-8 23 | =================================================================== 24 | diff --git a/pom.xml b/pom.xml 25 | --- a/pom.xml (revision b62fe2bd4d6000ee4d1308c9165d6629373b80ed) 26 | +++ b/pom.xml (date 1659837832149) 27 | @@ -28,4 +28,12 @@ 28 | 29 | 30 | 31 | + 32 | + 33 | + Apache License, Version 2.0 34 | + http://www.apache.org/licenses/LICENSE-2.0.txt 35 | + repo 36 | + 37 | + 38 | + 39 | 40 | \ No newline at end of file 41 | Index: .gitignore 42 | IDEA additional info: 43 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 44 | <+>UTF-8 45 | =================================================================== 46 | diff --git a/.gitignore b/.gitignore 47 | new file mode 100644 48 | --- /dev/null (date 1659789276517) 49 | +++ b/.gitignore (date 1659789276517) 50 | @@ -0,0 +1,2 @@ 51 | +# Project exclude paths 52 | +/target/ 53 | \ No newline at end of file 54 | Index: .idea/vcs.xml 55 | IDEA additional info: 56 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 57 | <+>UTF-8 58 | =================================================================== 59 | diff --git a/.idea/vcs.xml b/.idea/vcs.xml 60 | new file mode 100644 61 | --- /dev/null (date 1659789299540) 62 | +++ b/.idea/vcs.xml (date 1659789299540) 63 | @@ -0,0 +1,6 @@ 64 | + 65 | + 66 | + 67 | + 68 | + 69 | + 70 | \ No newline at end of file 71 | -------------------------------------------------------------------------------- /.idea/shelf/Uncommitted_changes_before_Update_at_9_08_2022_11_35_am__Changes_.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 13 | 14 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 1659780880574 78 | 85 | 86 | 1659790112404 87 | 92 | 93 | 1659790433463 94 | 99 | 100 | 1660009548233 101 | 106 | 109 | 110 | 112 | 113 | 122 | 123 | 124 | 125 | 126 | 127 | 129 | -------------------------------------------------------------------------------- /AtlasRedisAPI.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2022] [Jiří Apjár] 4 | Copyright (c) [2022] [Filip Zeman] 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Atlas Redis API 2 | ![badge](https://img.shields.io/github/v/release/Swofty-Developments/AtlasRedisAPI) 3 | [![badge](https://jitpack.io/v/Swofty-Developments/AtlasRedisAPI.svg)](https://jitpack.io/#Swofty-Developments/AtlasRedisAPI) 4 | ![badge](https://img.shields.io/github/last-commit/Swofty-Developments/AtlasRedisAPI) 5 | [![badge](https://img.shields.io/discord/830345347867476000?label=discord)](https://discord.gg/atlasmc) 6 | [![badge](https://img.shields.io/github/license/Swofty-Developments/AtlasRedisAPI)](https://github.com/Swofty-Developments/AtlasRedisAPI/blob/master/LICENSE.txt) 7 | 8 | **[JavaDoc 1.0.3](https://swofty-developments.github.io/AtlasRedisAPI/)** 9 | 10 | Used by Atlas Network. Simple but blazingly fast all-purpose Redis API. Perfect for use in JSP, Minecraft, Server Backends or just about anything else! 11 | 12 | ## Table of contents 13 | 14 | * [Getting started](#getting-started) 15 | * [Connecting to Redis Server](#connecting-to-redis-server) 16 | * [Subscribing to a channel](#subscribing-to-a-channel) 17 | * [Sending messages to a specific server](#subscribing-to-a-specific-server) 18 | * [Publishing messages](#publishing-messages) 19 | * [Events & incoming messages](#events--incoming-messages) 20 | * [License](#license) 21 | 22 | ## Getting started 23 | 24 | This API is intended for stand-alone usage, meaning that you do not need to run any extra spigot-plugins to use this library. 25 | 26 | ### Add AtlasRedisAPI to your project 27 | 28 | [![badge](https://jitpack.io/v/Swofty-Developments/AtlasRedisAPI.svg)](https://jitpack.io/#Swofty-Developments/AtlasRedisAPI) 29 | 30 | First, you need to setup the dependency on the AtlasRedisAPI. Replace **VERSION** with the version of the release. 31 | 32 |
33 | Maven 34 | 35 | ```xml 36 | 37 | 38 | jitpack.io 39 | https://jitpack.io 40 | 41 | 42 | 43 | 44 | 45 | com.github.Swofty-Developments 46 | AtlasRedisAPI 47 | VERSION 48 | 49 | 50 | ``` 51 |
52 | 53 |
54 | Gradle 55 | 56 | ```gradle 57 | allprojects { 58 | repositories { 59 | ... 60 | maven { url 'https://jitpack.io' } 61 | } 62 | } 63 | 64 | dependencies { 65 | implementation 'com.github.Swofty-Developments:AtlasRedisAPI:VERSION' 66 | } 67 | ``` 68 |
69 | 70 | ## Connecting to Redis Server 71 | 72 | Before doing anything on the API, it is necessary to generate an instance of the RedisAPI class to connect to your Redis server. 73 | 74 | ```java 75 | // 76 | // The standard way of connecting to an instance 77 | // Pass through a redis uri, must follow valid redis schema 78 | // Inside of the URI, you are able to pass through the IP, PORT, USERNAME and PASSWORD 79 | // 80 | RedisAPI.generateInstance("redis://localhost:6379"); 81 | ``` 82 | 83 | ## Subscribing to a channel 84 | 85 | To receive data from your Redis server, you need to subscribe selected channels. You can do it simply just by calling: 86 | 87 | ```java 88 | // 89 | // Note that you can register one class to more than one channel name, making it so that one listener class handles multiple channels. 90 | // 91 | RedisAPI.getInstance().registerChannel( 92 | "cove", // This is the name of the channel 93 | ExampleListener.class // Your listener class, see more about listening to Redis messages below. 94 | ); 95 | ``` 96 | ```java 97 | // You can also use consumers to do the same task 98 | RedisAPI.getInstance().registerChannel( 99 | "cove", // This is the name of the channel 100 | (event) -> { // the name of the variable for the Event 101 | System.out.println("message: " + event.getMessage() + " channel: " + event.getChannel()); 102 | } 103 | ); 104 | ``` 105 | 106 | ## Sending messages to a specific server 107 | 108 | Due to the nature of this API - There are probably going to be situations in which you will probably want to send a message to a specific pool listening to a channel. To do this, you need to add a Filter ID to your RedisAPI instance, this Filter ID is then checked against whenever you send a message from a different connection, check 'Publishing Messages' for more information on how to do that. 109 | ```java 110 | RedisAPI.getInstance().setFilterID("bungee"); // This RedisAPI instance will now block out any messages that do not have this filter id passed through with it. 111 | ``` 112 | 113 | ## Publishing messages 114 | 115 | You can easily publish messages to the RedisAPI instance. It is not required to subscribe channel before you publish a message: 116 | 117 | ```java 118 | // For sending a message to every single instance of the Redis pool listening to the channel 119 | RedisAPI.getInstance().publishMessage( 120 | ChannelRegistry.getFromName("cove"), // The name that you pass through here is the same as the name you pass through when registering a channel, look at 'Subscribing to a channel' for more information 121 | "examplemessage" // The message that you want to pass through the channel 122 | ); 123 | 124 | // For sending a message to a specific instance of the Redis pool listening to a channel 125 | RedisAPI.getInstance().publishMessage( 126 | "bungeecordserver", // This is the filter ID for the message, meaning that only Redis pools that have their filter code set to this value will recieve the message 127 | ChannelRegistry.getFromName("cove"), // The name that you pass through here is the same as the name you pass through when registering a channel, look at 'Subscribing to a channel' for more information 128 | "examplemessage" // The message that you want to pass through the channel 129 | ); 130 | ``` 131 | 132 | ## Events & Incoming messages 133 | 134 | AtlasRedisAPI uses a class-based listener system, with every class being its own independant channel handler. Details are below: 135 | 136 | ```java 137 | // 138 | // Only messages that are passed through the channel name given when registering the channel class will be passed onto this event. 139 | // So if this class is registered using RedisAPI.getInstance().registerChannel("cove", ExampleListener.class) then this class will only listen to messages coming through the "cove" channel. 140 | // 141 | public class ExampleListener implements RedisMessagingReceiveInterface { 142 | @Override 143 | public void onMessage(String channel, String message) { 144 | System.out.println("test"); 145 | } 146 | } 147 | 148 | ``` 149 | 150 | ## License 151 | AtlasRedisAPI is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/Swofty-Developments/AtlasRedisAPI/blob/master/LICENSE.txt) for more information. 152 | -------------------------------------------------------------------------------- /docs/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 |

All Classes

13 |
14 | 28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Constant Field Values 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Constant Field Values

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Deprecated API

73 |

Contents

74 |
75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 92 |
93 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /docs/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | API Help 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

How This API Document Is Organized

73 |
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
74 |
75 |
76 | 175 | This help file applies to API documentation generated using the standard doclet.
176 | 177 |
178 | 179 | 180 | 181 | 182 | 183 | 184 | 193 |
194 | 221 | 222 | 223 | 224 | -------------------------------------------------------------------------------- /docs/index-files/index-10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | P-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

P

75 |
76 |
publishMessage(RedisChannel, String) - Method in class net.swofty.redisapi.api.RedisAPI
77 |
78 |
Publishes a message to the generated instances redis pool
79 |
80 |
publishMessage(String, RedisChannel, String) - Method in class net.swofty.redisapi.api.RedisAPI
81 |
82 |
Publishes a message to the generated instances redis pool
83 |
84 |
pubSub - Static variable in class net.swofty.redisapi.events.EventRegistry
85 |
 
86 |
87 | C E F G H I M N O P R S T U V 
88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 105 |
106 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /docs/index-files/index-12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | S-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

S

75 |
76 |
setFilterID(String) - Method in class net.swofty.redisapi.api.RedisAPI
77 |
78 |
This method is used to set a filter ID onto your Redis Pool, you can then use this when publishing messages to 79 | a channel to ensure that a specific RedisAPI instance receives your message
80 |
81 |
82 | C E F G H I M N O P R S T U V 
83 | 84 |
85 | 86 | 87 | 88 | 89 | 90 | 91 | 100 |
101 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /docs/index-files/index-13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | T-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

T

75 |
76 |
timestamp - Variable in class net.swofty.redisapi.api.RedisChannel
77 |
78 |
Timestamp in unix milliseconds of when the channel last had a message received through it
79 |
80 |
81 | C E F G H I M N O P R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | U-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

U

75 |
76 |
Utility - Class in net.swofty.redisapi.api
77 |
 
78 |
Utility() - Constructor for class net.swofty.redisapi.api.Utility
79 |
 
80 |
81 | C E F G H I M N O P R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-15.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | V-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

V

75 |
76 |
valueOf(String) - Static method in enum net.swofty.redisapi.api.ChannelFunctionType
77 |
78 |
Returns the enum constant of this type with the specified name.
79 |
80 |
values() - Static method in enum net.swofty.redisapi.api.ChannelFunctionType
81 |
82 |
Returns an array containing the constants of this enum type, in 83 | the order they are declared.
84 |
85 |
86 | C E F G H I M N O P R S T U V 
87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 104 |
105 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/index-files/index-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | E-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

E

75 |
76 |
EventRegistry - Class in net.swofty.redisapi.events
77 |
 
78 |
EventRegistry() - Constructor for class net.swofty.redisapi.events.EventRegistry
79 |
 
80 |
81 | C E F G H I M N O P R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | F-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

F

75 |
76 |
functionType - Variable in class net.swofty.redisapi.api.RedisChannel
77 |
78 |
Used to determine what type of function is being used to receive messages.
79 |
80 |
81 | C E F G H I M N O P R S T U V 
82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 99 |
100 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /docs/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | G-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

G

75 |
76 |
generateInstance(String, String) - Static method in class net.swofty.redisapi.api.RedisAPI
77 |
78 |
Creates a new main Redis pool instance, there will only ever be one at a time so #getInstance should be used after generation
79 |
80 |
generateInstance(String) - Static method in class net.swofty.redisapi.api.RedisAPI
81 |
82 |
Creates a new main Redis pool instance, there will only ever be one at a time so #getInstance should be used after generation
83 |
84 |
getFromName(String) - Static method in class net.swofty.redisapi.api.ChannelRegistry
85 |
86 |
Used to receive a channel that has already been registered
87 |
88 |
getTimestamp() - Method in class net.swofty.redisapi.api.RedisChannel
89 |
90 |
This function returns the timestamp of the last time the channel had something sent through it
91 |
92 |
93 | C E F G H I M N O P R S T U V 
94 | 95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/index-files/index-5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | H-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

H

75 |
76 |
handleAll(String, String) - Static method in class net.swofty.redisapi.events.EventRegistry
77 |
 
78 |
79 | C E F G H I M N O P R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 97 |
98 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/index-files/index-6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | I-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

I

75 |
76 |
instance - Static variable in class net.swofty.redisapi.api.RedisAPI
77 |
 
78 |
79 | C E F G H I M N O P R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 97 |
98 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/index-files/index-7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | M-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

M

75 |
76 |
message - Variable in class net.swofty.redisapi.events.RedisMessagingReceiveEvent
77 |
 
78 |
79 | C E F G H I M N O P R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 97 |
98 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/index-files/index-8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | N-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

N

75 |
76 |
net.swofty.redisapi.api - package net.swofty.redisapi.api
77 |
 
78 |
net.swofty.redisapi.events - package net.swofty.redisapi.events
79 |
 
80 |
net.swofty.redisapi.exceptions - package net.swofty.redisapi.exceptions
81 |
 
82 |
83 | C E F G H I M N O P R S T U V 
84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 101 |
102 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/index-files/index-9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | O-Index 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
C E F G H I M N O P R S T U V  72 | 73 | 74 |

O

75 |
76 |
onMessage(String, String) - Method in interface net.swofty.redisapi.events.RedisMessagingReceiveInterface
77 |
 
78 |
79 | C E F G H I M N O P R S T U V 
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 97 |
98 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | <noscript> 69 | <div>JavaScript is disabled on your browser.</div> 70 | </noscript> 71 | <h2>Frame Alert</h2> 72 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p> 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/api/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.api 7 | 8 | 9 | 10 | 11 | 12 |

net.swofty.redisapi.api

13 |
14 |

Classes

15 | 21 |

Enums

22 | 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/api/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.api 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package net.swofty.redisapi.api

73 |
74 |
75 | 119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 | 127 | 128 | 137 |
138 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/api/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.api Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package net.swofty.redisapi.api

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Class Hierarchy

80 | 90 |

Enum Hierarchy

91 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 120 |
121 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/events/RedisMessagingReceiveEvent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RedisMessagingReceiveEvent 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 85 | 86 | 87 |
88 |
net.swofty.redisapi.events
89 |

Class RedisMessagingReceiveEvent

90 |
91 |
92 | 100 |
101 |
    102 |
  • 103 |
    104 |
    105 |
    public class RedisMessagingReceiveEvent
    106 | extends java.lang.Object
    107 |
  • 108 |
109 |
110 |
111 |
    112 |
  • 113 | 114 |
      115 |
    • 116 | 117 | 118 |

      Field Summary

      119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 |
      Fields 
      Modifier and TypeField and Description
      java.lang.Stringchannel 
      java.lang.Stringmessage 
      134 |
    • 135 |
    136 | 137 |
      138 |
    • 139 | 140 | 141 |

      Method Summary

      142 |
        143 |
      • 144 | 145 | 146 |

        Methods inherited from class java.lang.Object

        147 | clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • 148 |
      149 |
    • 150 |
    151 |
  • 152 |
153 |
154 |
155 |
    156 |
  • 157 | 158 |
      159 |
    • 160 | 161 | 162 |

      Field Detail

      163 | 164 | 165 | 166 |
        167 |
      • 168 |

        channel

        169 |
        public java.lang.String channel
        170 |
      • 171 |
      172 | 173 | 174 | 175 |
        176 |
      • 177 |

        message

        178 |
        public java.lang.String message
        179 |
      • 180 |
      181 |
    • 182 |
    183 |
  • 184 |
185 |
186 |
187 | 188 | 189 |
190 | 191 | 192 | 193 | 194 | 195 | 196 | 205 |
206 | 248 | 249 | 250 | 251 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/events/RedisMessagingReceiveInterface.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RedisMessagingReceiveInterface 7 | 8 | 9 | 10 | 11 | 12 | 28 | 31 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 48 |
49 | 91 | 92 | 93 |
94 |
net.swofty.redisapi.events
95 |

Interface RedisMessagingReceiveInterface

96 |
97 |
98 |
99 |
    100 |
  • 101 |
    102 |
    103 |
    public interface RedisMessagingReceiveInterface
    104 |
  • 105 |
106 |
107 |
108 |
    109 |
  • 110 | 111 |
      112 |
    • 113 | 114 | 115 |

      Method Summary

      116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 126 | 127 |
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      voidonMessage(java.lang.String channel, 125 | java.lang.String message) 
      128 |
    • 129 |
    130 |
  • 131 |
132 |
133 |
134 |
    135 |
  • 136 | 137 |
      138 |
    • 139 | 140 | 141 |

      Method Detail

      142 | 143 | 144 | 145 |
        146 |
      • 147 |

        onMessage

        148 |
        void onMessage(java.lang.String channel,
        149 |                java.lang.String message)
        150 |
      • 151 |
      152 |
    • 153 |
    154 |
  • 155 |
156 |
157 |
158 | 159 | 160 |
161 | 162 | 163 | 164 | 165 | 166 | 167 | 176 |
177 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/events/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.events 7 | 8 | 9 | 10 | 11 | 12 |

net.swofty.redisapi.events

13 |
14 |

Interfaces

15 | 18 |

Classes

19 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/events/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.events 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package net.swofty.redisapi.events

73 |
74 |
75 | 111 |
112 | 113 |
114 | 115 | 116 | 117 | 118 | 119 | 120 | 129 |
130 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/events/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.events Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package net.swofty.redisapi.events

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Class Hierarchy

80 | 88 |

Interface Hierarchy

89 | 92 |
93 | 94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 110 |
111 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/exceptions/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.exceptions 7 | 8 | 9 | 10 | 11 | 12 |

net.swofty.redisapi.exceptions

13 |
14 |

Exceptions

15 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/exceptions/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.exceptions 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Package net.swofty.redisapi.exceptions

73 |
74 |
75 | 112 |
113 | 114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 130 |
131 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /docs/net/swofty/redisapi/exceptions/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | net.swofty.redisapi.exceptions Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For Package net.swofty.redisapi.exceptions

73 | Package Hierarchies: 74 | 77 |
78 |
79 |

Class Hierarchy

80 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 120 |
121 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview List 7 | 8 | 9 | 10 | 11 | 12 |
All Classes
13 |
14 |

Packages

15 | 20 |
21 |

 

22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
Packages 
PackageDescription
net.swofty.redisapi.api 
net.swofty.redisapi.events 
net.swofty.redisapi.exceptions 
93 |
94 | 95 |
96 | 97 | 98 | 99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /docs/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Hierarchy For All Packages

73 | Package Hierarchies: 74 | 79 |
80 |
81 |

Class Hierarchy

82 | 110 |

Interface Hierarchy

111 | 114 |

Enum Hierarchy

115 | 126 |
127 | 128 |
129 | 130 | 131 | 132 | 133 | 134 | 135 | 144 |
145 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/package-list: -------------------------------------------------------------------------------- 1 | net.swofty.redisapi.api 2 | net.swofty.redisapi.events 3 | net.swofty.redisapi.exceptions 4 | -------------------------------------------------------------------------------- /docs/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/serialized-form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Serialized Form 7 | 8 | 9 | 10 | 11 | 12 | 22 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 42 |
43 | 70 | 71 |
72 |

Serialized Form

73 |
74 |
75 | 102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | 120 |
121 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | net.swofty 8 | AtlasRedisAPI 9 | 1.1.3 10 | 11 | 12 | 1.8 13 | 1.8 14 | 15 | 16 | 17 | 18 | org.projectlombok 19 | lombok 20 | 1.18.24 21 | provided 22 | 23 | 24 | redis.clients 25 | jedis 26 | 4.2.3 27 | compile 28 | 29 | 30 | 31 | 32 | 33 | Apache License, Version 2.0 34 | http://www.apache.org/licenses/LICENSE-2.0.txt 35 | repo 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/api/ChannelFunctionType.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.api; 2 | 3 | public enum ChannelFunctionType { 4 | CONSUMER, 5 | CLASS 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/api/ChannelRegistry.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.api; 2 | 3 | import lombok.experimental.UtilityClass; 4 | import net.swofty.redisapi.exceptions.ChannelAlreadyRegisteredException; 5 | import net.swofty.redisapi.exceptions.ChannelNotRegisteredException; 6 | import lombok.NonNull; 7 | 8 | import java.util.ArrayList; 9 | 10 | @UtilityClass 11 | public class ChannelRegistry { 12 | 13 | public ArrayList registeredChannels = new ArrayList<>(); 14 | 15 | /** 16 | * Used to receive a channel that has already been registered 17 | * @param channelName the name of the channel that is being filtered 18 | * @return channel object 19 | * @throws ChannelNotRegisteredException returns channelNotRegistered when you call this method upon a channel that does not exist 20 | */ 21 | @NonNull 22 | public RedisChannel getFromName(String channelName) { 23 | return new RedisChannel(channelName, (e) -> {}); 24 | // return registeredChannels.stream().filter(channel -> Objects.equals(channel.channelName, channelName)).findFirst().orElseThrow(() -> new ChannelNotRegisteredException("There is no channel registered with the name '" + channelName + "'")); 25 | } 26 | 27 | public void registerChannel(RedisChannel channel) { 28 | if (registeredChannels.stream().anyMatch(channel2 -> channel2.channelName.equals(channel.channelName))) 29 | throw new ChannelAlreadyRegisteredException("A channel already exists with this name '" + channel.channelName + "'"); 30 | 31 | registeredChannels.add(channel); 32 | // RedisAPI.getInstance().getPool().getResource().subscribe(EventRegistry.pubSub, channel.channelName); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/api/RedisChannel.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.api; 2 | 3 | import net.swofty.redisapi.events.RedisMessagingReceiveEvent; 4 | import net.swofty.redisapi.events.RedisMessagingReceiveInterface; 5 | 6 | import java.util.function.Consumer; 7 | 8 | public class RedisChannel { 9 | 10 | /** 11 | * Consumer that contains the function ran when a message is received on this channel 12 | */ 13 | public Consumer receiveEvent; 14 | /** 15 | * Class that contains the function ran when a message is received on this channel 16 | */ 17 | public Class receiveInterface; 18 | 19 | /** 20 | * Used to determine what type of function is being used to receive messages. 21 | */ 22 | public ChannelFunctionType functionType; 23 | 24 | /** 25 | * Name of the channel that messages are sent through 26 | */ 27 | public String channelName; 28 | 29 | /** 30 | * Timestamp in unix milliseconds of when the channel last had a message received through it 31 | */ 32 | public Long timestamp; 33 | 34 | public RedisChannel(String channelName, Consumer receiveEventClass) { 35 | this.channelName = channelName; 36 | this.receiveEvent = receiveEventClass; 37 | this.functionType = ChannelFunctionType.CONSUMER; 38 | } 39 | 40 | public RedisChannel(String channelName, Class classz) { 41 | this.channelName = channelName; 42 | this.receiveInterface = classz; 43 | this.functionType = ChannelFunctionType.CLASS; 44 | } 45 | 46 | /** 47 | * This function returns the timestamp of the last time the channel had something sent through it 48 | * 49 | * @return The timestamp of the last time the user was updated. 50 | */ 51 | public java.lang.Long getTimestamp() { 52 | return timestamp; 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/api/RedisCredentials.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.api; 2 | 3 | import lombok.*; 4 | import lombok.experimental.FieldDefaults; 5 | 6 | @Getter 7 | @AllArgsConstructor 8 | @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) 9 | public class RedisCredentials { 10 | 11 | @NonNull 12 | String host; 13 | 14 | @NonNull 15 | int port; 16 | 17 | String user; 18 | String password; 19 | 20 | boolean ssl; 21 | 22 | public RedisCredentials(@NonNull String host, @NonNull int port, @NonNull String password, boolean ssl) { 23 | this.host = host; 24 | this.port = port; 25 | this.password = password; 26 | this.user = null; 27 | this.ssl = ssl; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "RedisCredentials(" + 33 | "host=" + this.getHost() + ", " + 34 | "port=" + this.getPort() + ", " + 35 | "user=" + this.getUser() + ", " + 36 | "password=" + this.getPassword() + 37 | ")"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/api/Utility.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.api; 2 | 3 | public class Utility { 4 | 5 | protected static void runAsync(Runnable runnable) { 6 | new Thread(runnable).start(); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/events/EventRegistry.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.events; 2 | 3 | import net.swofty.redisapi.api.ChannelRegistry; 4 | import net.swofty.redisapi.api.RedisAPI; 5 | import net.swofty.redisapi.api.RedisChannel; 6 | import lombok.SneakyThrows; 7 | import net.swofty.redisapi.exceptions.ChannelDefinitionError; 8 | import redis.clients.jedis.JedisPubSub; 9 | 10 | import java.util.Objects; 11 | import java.util.Optional; 12 | 13 | public class EventRegistry { 14 | 15 | public static JedisPubSub pubSub = null; 16 | 17 | @SneakyThrows 18 | public static void handleAll(String channel, String message) { 19 | String filterID = message.split(";")[0]; 20 | 21 | if (filterID.equals("all") || filterID.equals(RedisAPI.getInstance().getFilterId())) { 22 | Optional optionalChannelBeingCalled = ChannelRegistry.registeredChannels.stream().filter(channel2 -> Objects.equals(channel2.channelName, channel)).findAny(); 23 | if (optionalChannelBeingCalled.isPresent()) { 24 | RedisChannel channelBeingCalled = optionalChannelBeingCalled.get(); 25 | 26 | switch (channelBeingCalled.functionType) { 27 | case CLASS: 28 | RedisMessagingReceiveInterface receiveInterface = channelBeingCalled.receiveInterface.newInstance(); 29 | receiveInterface.onMessage(channel, message); 30 | return; 31 | 32 | case CONSUMER: 33 | channelBeingCalled.receiveEvent.accept(new RedisMessagingReceiveEvent(channel, message)); 34 | return; 35 | } 36 | throw new ChannelDefinitionError("No receive event or receive interface was set for the channel '" + channel + "'"); 37 | } 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/events/RedisMessagingReceiveEvent.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.events; 2 | 3 | public class RedisMessagingReceiveEvent { 4 | 5 | public String channel; 6 | public String message; 7 | 8 | RedisMessagingReceiveEvent (String channel, String message) { 9 | this.channel = channel; 10 | this.message = message; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/events/RedisMessagingReceiveInterface.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.events; 2 | 3 | public interface RedisMessagingReceiveInterface { 4 | void onMessage(String channel, String message); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/exceptions/ChannelAlreadyRegisteredException.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.exceptions; 2 | 3 | public class ChannelAlreadyRegisteredException extends RuntimeException { 4 | 5 | public ChannelAlreadyRegisteredException(String errorMessage) { 6 | super(errorMessage); 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/exceptions/ChannelDefinitionError.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.exceptions; 2 | 3 | /** 4 | * This class is a custom exception that is thrown when a channel definition is invalid, this is usually because 5 | * there is no event consumer or class passed through 6 | */ 7 | public class ChannelDefinitionError extends RuntimeException { 8 | 9 | public ChannelDefinitionError(String errorMessage) { 10 | super(errorMessage); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/exceptions/ChannelNotRegisteredException.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.exceptions; 2 | 3 | /** 4 | * This class is a custom exception class that is thrown when a class is not registered yet there is a message 5 | * trying to be sent through it 6 | */ 7 | public class ChannelNotRegisteredException extends RuntimeException { 8 | 9 | public ChannelNotRegisteredException(String errorMessage) { 10 | super(errorMessage); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/exceptions/CouldNotConnectToRedisException.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.exceptions; 2 | 3 | /** 4 | * This class is a custom exception class that throws when jedis process is unable to connect to Redis 5 | */ 6 | public class CouldNotConnectToRedisException extends RuntimeException { 7 | 8 | public CouldNotConnectToRedisException(String errorMessage) { 9 | super(errorMessage); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /src/main/java/net/swofty/redisapi/exceptions/MessageFailureException.java: -------------------------------------------------------------------------------- 1 | package net.swofty.redisapi.exceptions; 2 | 3 | public class MessageFailureException extends RuntimeException 4 | { 5 | public MessageFailureException(String errorMessage, Throwable t) { 6 | super(errorMessage); 7 | this.setStackTrace(t.getStackTrace()); 8 | } 9 | } 10 | --------------------------------------------------------------------------------