From b6dbb9a112848576f7bbd90937ca3bf86c3bdc83 Mon Sep 17 00:00:00 2001 From: ao Date: Tue, 2 Nov 2021 22:15:45 +0000 Subject: [PATCH] Migrate package from `gl` to `ms` --- Dockerfile | 6 +-- README.md | 2 +- pom.xml | 8 ++-- .../{gl => ms}/ao/serengeti/Serengeti.java | 18 +++---- .../ao/serengeti/data/DatabaseObjectData.java | 2 +- .../helpers/AppendingObjectOutputStream.java | 2 +- .../ao/serengeti/helpers/Globals.java | 4 +- .../ao/serengeti/helpers/GlobalsTest.java | 5 +- .../ao/serengeti/helpers/ShutdownHandler.java | 6 ++- .../ao/serengeti/network/Network.java | 8 ++-- .../ao/serengeti/query/QueryEngine.java | 6 +-- .../ao/serengeti/query/QueryLog.java | 12 ++--- .../serengeti/query/QueryResponseObject.java | 2 +- .../ao/serengeti/schema/DatabaseObject.java | 5 +- .../serengeti/schema/TableReplicaObject.java | 4 +- .../serengeti/schema/TableStorageObject.java | 4 +- .../ao/serengeti/server/Server.java | 16 +++---- .../ao/serengeti/server/ServerConstants.java | 2 +- .../ao/serengeti/storage/Storage.java | 47 +++++++++---------- .../serengeti/storage/StorageReshuffle.java | 13 ++--- .../storage/StorageResponseObject.java | 2 +- .../serengeti/storage/StorageScheduler.java | 8 ++-- .../{gl => ms}/ao/serengeti/ui/Dashboard.java | 7 +-- .../ao/serengeti/ui/Interactive.java | 7 +-- .../ao/serengeti/SerengetiTest.java | 4 +- .../ao/serengeti/storage/StorageTest.java | 6 +-- .../ao/serengeti/ui/DashboardTest.java | 2 +- .../ao/serengeti/ui/InteractiveTest.java | 2 +- 28 files changed, 98 insertions(+), 112 deletions(-) rename src/main/java/{gl => ms}/ao/serengeti/Serengeti.java (81%) rename src/main/java/{gl => ms}/ao/serengeti/data/DatabaseObjectData.java (91%) rename src/main/java/{gl => ms}/ao/serengeti/helpers/AppendingObjectOutputStream.java (94%) rename src/main/java/{gl => ms}/ao/serengeti/helpers/Globals.java (99%) rename src/main/java/{gl => ms}/ao/serengeti/helpers/GlobalsTest.java (82%) rename src/main/java/{gl => ms}/ao/serengeti/helpers/ShutdownHandler.java (81%) rename src/main/java/{gl => ms}/ao/serengeti/network/Network.java (99%) rename src/main/java/{gl => ms}/ao/serengeti/query/QueryEngine.java (98%) rename src/main/java/{gl => ms}/ao/serengeti/query/QueryLog.java (97%) rename src/main/java/{gl => ms}/ao/serengeti/query/QueryResponseObject.java (96%) rename src/main/java/{gl => ms}/ao/serengeti/schema/DatabaseObject.java (91%) rename src/main/java/{gl => ms}/ao/serengeti/schema/TableReplicaObject.java (97%) rename src/main/java/{gl => ms}/ao/serengeti/schema/TableStorageObject.java (98%) rename src/main/java/{gl => ms}/ao/serengeti/server/Server.java (97%) rename src/main/java/{gl => ms}/ao/serengeti/server/ServerConstants.java (86%) rename src/main/java/{gl => ms}/ao/serengeti/storage/Storage.java (90%) rename src/main/java/{gl => ms}/ao/serengeti/storage/StorageReshuffle.java (86%) rename src/main/java/{gl => ms}/ao/serengeti/storage/StorageResponseObject.java (90%) rename src/main/java/{gl => ms}/ao/serengeti/storage/StorageScheduler.java (94%) rename src/main/java/{gl => ms}/ao/serengeti/ui/Dashboard.java (83%) rename src/main/java/{gl => ms}/ao/serengeti/ui/Interactive.java (85%) rename src/test/java/{gl => ms}/ao/serengeti/SerengetiTest.java (79%) rename src/test/java/{gl => ms}/ao/serengeti/storage/StorageTest.java (88%) rename src/test/java/{gl => ms}/ao/serengeti/ui/DashboardTest.java (96%) rename src/test/java/{gl => ms}/ao/serengeti/ui/InteractiveTest.java (96%) diff --git a/Dockerfile b/Dockerfile index 9aef307..7b11584 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM openjdk:8 -COPY ./target/Serengeti-1.2-SNAPSHOT-jar-with-dependencies.jar /tmp +COPY ./target/Serengeti-1.3-SNAPSHOT-jar-with-dependencies.jar /tmp WORKDIR /tmp EXPOSE 1985 -#ENTRYPOINT ["java","gl.ao.serengeti.Serengeti"] -CMD java -jar Serengeti-1.2-SNAPSHOT-jar-with-dependencies.jar +#ENTRYPOINT ["java","Serengeti"] +CMD java -jar Serengeti-1.3-SNAPSHOT-jar-with-dependencies.jar diff --git a/README.md b/README.md index b434f17..20ca756 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Yes, of course you can! `+ Application` -Set the `classpath` to `Serengeti` and the `Main class` to `gl.ao.serengeti.Serengeti` +Set the `classpath` to `Serengeti` and the `Main class` to `Serengeti` `Run the application!` diff --git a/pom.xml b/pom.xml index 4b810fa..4c5bf4c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - gl.ao.serengeti + ms.ao.serengeti Serengeti - 1.2-SNAPSHOT + 1.3-SNAPSHOT src/main/java @@ -35,7 +35,7 @@ - + @@ -47,7 +47,7 @@ - gl.ao.serengeti.Serengeti + ms.ao.serengeti.Serengeti diff --git a/src/main/java/gl/ao/serengeti/Serengeti.java b/src/main/java/ms/ao/serengeti/Serengeti.java similarity index 81% rename from src/main/java/gl/ao/serengeti/Serengeti.java rename to src/main/java/ms/ao/serengeti/Serengeti.java index cb8df1d..3f29f8a 100644 --- a/src/main/java/gl/ao/serengeti/Serengeti.java +++ b/src/main/java/ms/ao/serengeti/Serengeti.java @@ -1,13 +1,13 @@ -package gl.ao.serengeti; +package ms.ao.serengeti; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.helpers.ShutdownHandler; -import gl.ao.serengeti.network.Network; -import gl.ao.serengeti.server.Server; -import gl.ao.serengeti.storage.Storage; -import gl.ao.serengeti.storage.StorageReshuffle; -import gl.ao.serengeti.storage.StorageScheduler; -import gl.ao.serengeti.ui.Interactive; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.helpers.ShutdownHandler; +import ms.ao.serengeti.network.Network; +import ms.ao.serengeti.server.Server; +import ms.ao.serengeti.storage.Storage; +import ms.ao.serengeti.storage.StorageReshuffle; +import ms.ao.serengeti.storage.StorageScheduler; +import ms.ao.serengeti.ui.Interactive; import java.io.BufferedReader; import java.io.InputStream; diff --git a/src/main/java/gl/ao/serengeti/data/DatabaseObjectData.java b/src/main/java/ms/ao/serengeti/data/DatabaseObjectData.java similarity index 91% rename from src/main/java/gl/ao/serengeti/data/DatabaseObjectData.java rename to src/main/java/ms/ao/serengeti/data/DatabaseObjectData.java index 5d79b46..9da5743 100644 --- a/src/main/java/gl/ao/serengeti/data/DatabaseObjectData.java +++ b/src/main/java/ms/ao/serengeti/data/DatabaseObjectData.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.data; +package ms.ao.serengeti.data; public class DatabaseObjectData { diff --git a/src/main/java/gl/ao/serengeti/helpers/AppendingObjectOutputStream.java b/src/main/java/ms/ao/serengeti/helpers/AppendingObjectOutputStream.java similarity index 94% rename from src/main/java/gl/ao/serengeti/helpers/AppendingObjectOutputStream.java rename to src/main/java/ms/ao/serengeti/helpers/AppendingObjectOutputStream.java index 0662859..6a89217 100644 --- a/src/main/java/gl/ao/serengeti/helpers/AppendingObjectOutputStream.java +++ b/src/main/java/ms/ao/serengeti/helpers/AppendingObjectOutputStream.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.helpers; +package ms.ao.serengeti.helpers; import java.io.IOException; import java.io.ObjectOutputStream; diff --git a/src/main/java/gl/ao/serengeti/helpers/Globals.java b/src/main/java/ms/ao/serengeti/helpers/Globals.java similarity index 99% rename from src/main/java/gl/ao/serengeti/helpers/Globals.java rename to src/main/java/ms/ao/serengeti/helpers/Globals.java index fecf22a..9916e9e 100644 --- a/src/main/java/gl/ao/serengeti/helpers/Globals.java +++ b/src/main/java/ms/ao/serengeti/helpers/Globals.java @@ -1,6 +1,6 @@ -package gl.ao.serengeti.helpers; +package ms.ao.serengeti.helpers; -import gl.ao.serengeti.Serengeti; +import ms.ao.serengeti.Serengeti; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; diff --git a/src/main/java/gl/ao/serengeti/helpers/GlobalsTest.java b/src/main/java/ms/ao/serengeti/helpers/GlobalsTest.java similarity index 82% rename from src/main/java/gl/ao/serengeti/helpers/GlobalsTest.java rename to src/main/java/ms/ao/serengeti/helpers/GlobalsTest.java index f6fef78..5ae276b 100644 --- a/src/main/java/gl/ao/serengeti/helpers/GlobalsTest.java +++ b/src/main/java/ms/ao/serengeti/helpers/GlobalsTest.java @@ -1,10 +1,7 @@ -package gl.ao.serengeti.helpers; +package ms.ao.serengeti.helpers; -import gl.ao.serengeti.helpers.Globals; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.NotSerializableException; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/main/java/gl/ao/serengeti/helpers/ShutdownHandler.java b/src/main/java/ms/ao/serengeti/helpers/ShutdownHandler.java similarity index 81% rename from src/main/java/gl/ao/serengeti/helpers/ShutdownHandler.java rename to src/main/java/ms/ao/serengeti/helpers/ShutdownHandler.java index 1543fbc..4307d74 100644 --- a/src/main/java/gl/ao/serengeti/helpers/ShutdownHandler.java +++ b/src/main/java/ms/ao/serengeti/helpers/ShutdownHandler.java @@ -1,4 +1,6 @@ -package gl.ao.serengeti.helpers; +package ms.ao.serengeti.helpers; + +import ms.ao.serengeti.Serengeti; public class ShutdownHandler { @@ -13,7 +15,7 @@ public ShutdownHandler() { Runtime.getRuntime().addShutdownHook(new Thread(() -> { System.out.println("Safe Shutdown Initiated.."); - if (gl.ao.serengeti.Serengeti.storageScheduler.performPersistToDisk()) { + if (Serengeti.storageScheduler.performPersistToDisk()) { System.out.println("Safe Shutdown Completed Succesfully"); } })); diff --git a/src/main/java/gl/ao/serengeti/network/Network.java b/src/main/java/ms/ao/serengeti/network/Network.java similarity index 99% rename from src/main/java/gl/ao/serengeti/network/Network.java rename to src/main/java/ms/ao/serengeti/network/Network.java index 09673ee..5163394 100644 --- a/src/main/java/gl/ao/serengeti/network/Network.java +++ b/src/main/java/ms/ao/serengeti/network/Network.java @@ -1,8 +1,8 @@ -package gl.ao.serengeti.network; +package ms.ao.serengeti.network; -import gl.ao.serengeti.Serengeti; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.storage.Storage; +import ms.ao.serengeti.Serengeti; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.storage.Storage; import org.json.JSONArray; import org.json.JSONObject; diff --git a/src/main/java/gl/ao/serengeti/query/QueryEngine.java b/src/main/java/ms/ao/serengeti/query/QueryEngine.java similarity index 98% rename from src/main/java/gl/ao/serengeti/query/QueryEngine.java rename to src/main/java/ms/ao/serengeti/query/QueryEngine.java index f4d7a2b..d48aa83 100644 --- a/src/main/java/gl/ao/serengeti/query/QueryEngine.java +++ b/src/main/java/ms/ao/serengeti/query/QueryEngine.java @@ -1,7 +1,7 @@ -package gl.ao.serengeti.query; +package ms.ao.serengeti.query; -import gl.ao.serengeti.Serengeti; -import gl.ao.serengeti.storage.StorageResponseObject; +import ms.ao.serengeti.Serengeti; +import ms.ao.serengeti.storage.StorageResponseObject; import org.json.JSONObject; import java.util.ArrayList; diff --git a/src/main/java/gl/ao/serengeti/query/QueryLog.java b/src/main/java/ms/ao/serengeti/query/QueryLog.java similarity index 97% rename from src/main/java/gl/ao/serengeti/query/QueryLog.java rename to src/main/java/ms/ao/serengeti/query/QueryLog.java index cec5cb0..896d5ab 100644 --- a/src/main/java/gl/ao/serengeti/query/QueryLog.java +++ b/src/main/java/ms/ao/serengeti/query/QueryLog.java @@ -1,10 +1,10 @@ -package gl.ao.serengeti.query; +package ms.ao.serengeti.query; -import gl.ao.serengeti.Serengeti; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.schema.TableReplicaObject; -import gl.ao.serengeti.schema.TableStorageObject; -import gl.ao.serengeti.storage.Storage; +import ms.ao.serengeti.Serengeti; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.schema.TableReplicaObject; +import ms.ao.serengeti.schema.TableStorageObject; +import ms.ao.serengeti.storage.Storage; import org.json.JSONObject; import java.util.ArrayList; diff --git a/src/main/java/gl/ao/serengeti/query/QueryResponseObject.java b/src/main/java/ms/ao/serengeti/query/QueryResponseObject.java similarity index 96% rename from src/main/java/gl/ao/serengeti/query/QueryResponseObject.java rename to src/main/java/ms/ao/serengeti/query/QueryResponseObject.java index 39da7b5..99eafb9 100644 --- a/src/main/java/gl/ao/serengeti/query/QueryResponseObject.java +++ b/src/main/java/ms/ao/serengeti/query/QueryResponseObject.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.query; +package ms.ao.serengeti.query; import org.json.JSONArray; import org.json.JSONObject; diff --git a/src/main/java/gl/ao/serengeti/schema/DatabaseObject.java b/src/main/java/ms/ao/serengeti/schema/DatabaseObject.java similarity index 91% rename from src/main/java/gl/ao/serengeti/schema/DatabaseObject.java rename to src/main/java/ms/ao/serengeti/schema/DatabaseObject.java index 604b53b..d553c0c 100644 --- a/src/main/java/gl/ao/serengeti/schema/DatabaseObject.java +++ b/src/main/java/ms/ao/serengeti/schema/DatabaseObject.java @@ -1,7 +1,6 @@ -package gl.ao.serengeti.schema; +package ms.ao.serengeti.schema; -import gl.ao.serengeti.data.DatabaseObjectData; -import gl.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.helpers.Globals; import java.io.*; import java.nio.file.Files; diff --git a/src/main/java/gl/ao/serengeti/schema/TableReplicaObject.java b/src/main/java/ms/ao/serengeti/schema/TableReplicaObject.java similarity index 97% rename from src/main/java/gl/ao/serengeti/schema/TableReplicaObject.java rename to src/main/java/ms/ao/serengeti/schema/TableReplicaObject.java index fc1af95..77c120e 100644 --- a/src/main/java/gl/ao/serengeti/schema/TableReplicaObject.java +++ b/src/main/java/ms/ao/serengeti/schema/TableReplicaObject.java @@ -1,6 +1,6 @@ -package gl.ao.serengeti.schema; +package ms.ao.serengeti.schema; -import gl.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.helpers.Globals; import org.json.JSONObject; import java.io.*; diff --git a/src/main/java/gl/ao/serengeti/schema/TableStorageObject.java b/src/main/java/ms/ao/serengeti/schema/TableStorageObject.java similarity index 98% rename from src/main/java/gl/ao/serengeti/schema/TableStorageObject.java rename to src/main/java/ms/ao/serengeti/schema/TableStorageObject.java index 651245e..ad01956 100644 --- a/src/main/java/gl/ao/serengeti/schema/TableStorageObject.java +++ b/src/main/java/ms/ao/serengeti/schema/TableStorageObject.java @@ -1,6 +1,6 @@ -package gl.ao.serengeti.schema; +package ms.ao.serengeti.schema; -import gl.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.helpers.Globals; import org.json.JSONObject; import java.io.*; diff --git a/src/main/java/gl/ao/serengeti/server/Server.java b/src/main/java/ms/ao/serengeti/server/Server.java similarity index 97% rename from src/main/java/gl/ao/serengeti/server/Server.java rename to src/main/java/ms/ao/serengeti/server/Server.java index ea1fbd2..be4b965 100644 --- a/src/main/java/gl/ao/serengeti/server/Server.java +++ b/src/main/java/ms/ao/serengeti/server/Server.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.server; +package ms.ao.serengeti.server; import java.io.*; import java.lang.management.ManagementFactory; @@ -16,13 +16,13 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; -import gl.ao.serengeti.Serengeti; -import gl.ao.serengeti.network.Network; -import gl.ao.serengeti.ui.Dashboard; -import gl.ao.serengeti.ui.Interactive; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.query.QueryEngine; -import gl.ao.serengeti.query.QueryLog; +import ms.ao.serengeti.Serengeti; +import ms.ao.serengeti.network.Network; +import ms.ao.serengeti.ui.Dashboard; +import ms.ao.serengeti.ui.Interactive; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.query.QueryEngine; +import ms.ao.serengeti.query.QueryLog; import org.json.JSONArray; import org.json.JSONObject; diff --git a/src/main/java/gl/ao/serengeti/server/ServerConstants.java b/src/main/java/ms/ao/serengeti/server/ServerConstants.java similarity index 86% rename from src/main/java/gl/ao/serengeti/server/ServerConstants.java rename to src/main/java/ms/ao/serengeti/server/ServerConstants.java index 62b106f..da34e1b 100644 --- a/src/main/java/gl/ao/serengeti/server/ServerConstants.java +++ b/src/main/java/ms/ao/serengeti/server/ServerConstants.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.server; +package ms.ao.serengeti.server; import java.io.Serializable; diff --git a/src/main/java/gl/ao/serengeti/storage/Storage.java b/src/main/java/ms/ao/serengeti/storage/Storage.java similarity index 90% rename from src/main/java/gl/ao/serengeti/storage/Storage.java rename to src/main/java/ms/ao/serengeti/storage/Storage.java index e9f088c..c912f64 100644 --- a/src/main/java/gl/ao/serengeti/storage/Storage.java +++ b/src/main/java/ms/ao/serengeti/storage/Storage.java @@ -1,16 +1,15 @@ -package gl.ao.serengeti.storage; - -import gl.ao.serengeti.Serengeti; -import gl.ao.serengeti.query.QueryLog; -import gl.ao.serengeti.schema.DatabaseObject; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.schema.TableReplicaObject; -import gl.ao.serengeti.schema.TableStorageObject; +package ms.ao.serengeti.storage; + +import ms.ao.serengeti.Serengeti; +import ms.ao.serengeti.query.QueryLog; +import ms.ao.serengeti.schema.DatabaseObject; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.schema.TableReplicaObject; +import ms.ao.serengeti.schema.TableStorageObject; import org.json.JSONArray; import org.json.JSONObject; import java.io.File; -import java.io.FilenameFilter; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -140,7 +139,7 @@ public List select(String db, String table, String selectWhat, String co List list = new ArrayList<>(); Set uuids = new HashSet(); - JSONArray array = gl.ao.serengeti.Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ + JSONArray array = Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ put("type", "SelectRespond"); put("selectWhat", selectWhat); put("db", db); @@ -189,7 +188,7 @@ public StorageResponseObject insert(String db, String table, JSONObject json, bo if (!tableExists(db, table)) createTable(db, table); createTablePathIfNotExists(db, table); - JSONObject _nodes = gl.ao.serengeti.Serengeti.network.getPrimarySecondary(); + JSONObject _nodes = Serengeti.network.getPrimarySecondary(); String _node_primary_id = _nodes.getJSONObject("primary").getString("id"); String _node_primary_ip = _nodes.getJSONObject("primary").getString("ip"); String _node_secondary_id = _nodes.getJSONObject("secondary").getString("id"); @@ -205,12 +204,12 @@ public StorageResponseObject insert(String db, String table, JSONObject json, bo put("json", json); put("type", "ReplicateInsertObject"); }}.toString(); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonInsertReplicate); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonInsertReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonInsertReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonInsertReplicate); // tell all nodes about where the replicated data is stored - gl.ao.serengeti.Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ + Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ put("type", "TableReplicaObjectInsertOrReplace"); put("db", db); put("table", table); @@ -261,9 +260,9 @@ public boolean update(String db, String table, String update_key, String update_ JSONObject _nodes = tro.getRowReplica(_row_id); String _node_primary_id = _nodes.getString("primary"); - String _node_primary_ip = gl.ao.serengeti.Serengeti.network.getIPFromUUID(_node_primary_id); + String _node_primary_ip = Serengeti.network.getIPFromUUID(_node_primary_id); String _node_secondary_id = _nodes.getString("secondary"); - String _node_secondary_ip = gl.ao.serengeti.Serengeti.network.getIPFromUUID(_node_secondary_id); + String _node_secondary_ip = Serengeti.network.getIPFromUUID(_node_secondary_id); JSONObject _json = new JSONObject() {{ put("update_key", update_key); @@ -280,8 +279,8 @@ public boolean update(String db, String table, String update_key, String update_ put("json", _json); put("type", "ReplicateUpdateObject"); }}.toString(); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonUpdateReplicate); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonUpdateReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonUpdateReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonUpdateReplicate); return true; } @@ -318,9 +317,9 @@ public boolean delete(String db, String table, String where_col, String where_va JSONObject _nodes = tro.getRowReplica(_row_id); String _node_primary_id = _nodes.getString("primary"); - String _node_primary_ip = gl.ao.serengeti.Serengeti.network.getIPFromUUID(_node_primary_id); + String _node_primary_ip = Serengeti.network.getIPFromUUID(_node_primary_id); String _node_secondary_id = _nodes.getString("secondary"); - String _node_secondary_ip = gl.ao.serengeti.Serengeti.network.getIPFromUUID(_node_secondary_id); + String _node_secondary_ip = Serengeti.network.getIPFromUUID(_node_secondary_id); JSONObject _json = new JSONObject() {{ put("where_col", where_col); @@ -335,11 +334,11 @@ public boolean delete(String db, String table, String where_col, String where_va put("json", _json); put("type", "ReplicateDeleteObject"); }}.toString(); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonDeleteReplicate); - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonDeleteReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_primary_id, _node_primary_ip, _jsonDeleteReplicate); + Serengeti.network.communicateQueryLogSingleNode(_node_secondary_id, _node_secondary_ip, _jsonDeleteReplicate); // tell all nodes about where the replicated data is stored - gl.ao.serengeti.Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ + Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ put("type", "TableReplicaObjectDelete"); put("db", db); put("table", table); @@ -385,7 +384,7 @@ public boolean createDatabase(String db, boolean isReplicationAction) { Files.write(file, data); //create directory path if not exists - gl.ao.serengeti.Serengeti.storage.createDatabasePathIfNotExists(db); + Serengeti.storage.createDatabasePathIfNotExists(db); loadMetaDatabasesToMemory(); diff --git a/src/main/java/gl/ao/serengeti/storage/StorageReshuffle.java b/src/main/java/ms/ao/serengeti/storage/StorageReshuffle.java similarity index 86% rename from src/main/java/gl/ao/serengeti/storage/StorageReshuffle.java rename to src/main/java/ms/ao/serengeti/storage/StorageReshuffle.java index ad7b154..e485b7a 100644 --- a/src/main/java/gl/ao/serengeti/storage/StorageReshuffle.java +++ b/src/main/java/ms/ao/serengeti/storage/StorageReshuffle.java @@ -1,5 +1,6 @@ -package gl.ao.serengeti.storage; +package ms.ao.serengeti.storage; +import ms.ao.serengeti.Serengeti; import org.json.JSONObject; import java.util.Arrays; @@ -16,7 +17,7 @@ public void queueLostNode(JSONObject node) { new Thread(() -> { try { Thread.sleep(10000); - boolean nodeIsOnline = gl.ao.serengeti.Serengeti.network.nodeIsOnline(json.getString("ip")); + boolean nodeIsOnline = Serengeti.network.nodeIsOnline(json.getString("ip")); if (!nodeIsOnline) { // find out if we need to move any local data to another node @@ -24,7 +25,7 @@ public void queueLostNode(JSONObject node) { for (String rowKey: Storage.tableReplicaObjects.get(tableKey).row_replicas.keySet()) { String strRow = Storage.tableReplicaObjects.get(tableKey).row_replicas.get(rowKey); JSONObject jsonRow = new JSONObject(strRow); - JSONObject prisec = gl.ao.serengeti.Serengeti.network.getPrimarySecondary(); + JSONObject prisec = Serengeti.network.getPrimarySecondary(); String newPrimaryId = ((JSONObject)prisec.get("primary")).getString("id"); String newPrimaryIp = ((JSONObject)prisec.get("primary")).getString("ip"); String newSecondaryId = ((JSONObject)prisec.get("secondary")).getString("id"); @@ -55,16 +56,16 @@ public void queueLostNode(JSONObject node) { }}.toString(); if (found.equals("primary")) { - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(newPrimaryId, newPrimaryIp, _jsonReplaceReplicate); + Serengeti.network.communicateQueryLogSingleNode(newPrimaryId, newPrimaryIp, _jsonReplaceReplicate); row_replica = Storage.tableReplicaObjects.get(tableKey).updateNewPrimary(rowKey, newPrimaryId); } else if (found.equals("secondary")) { - gl.ao.serengeti.Serengeti.network.communicateQueryLogSingleNode(newPrimaryId, newPrimaryIp, _jsonReplaceReplicate); + Serengeti.network.communicateQueryLogSingleNode(newPrimaryId, newPrimaryIp, _jsonReplaceReplicate); row_replica = Storage.tableReplicaObjects.get(tableKey).updateNewSecondary(rowKey, newSecondaryId); } if (row_replica != null) { final JSONObject row_replica_final = row_replica; - gl.ao.serengeti.Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ + Serengeti.network.communicateQueryLogAllNodes(new JSONObject() {{ put("type", "TableReplicaObjectInsertOrReplace"); put("db", databaseName); put("table", tableName); diff --git a/src/main/java/gl/ao/serengeti/storage/StorageResponseObject.java b/src/main/java/ms/ao/serengeti/storage/StorageResponseObject.java similarity index 90% rename from src/main/java/gl/ao/serengeti/storage/StorageResponseObject.java rename to src/main/java/ms/ao/serengeti/storage/StorageResponseObject.java index 79d53be..19a9f3a 100644 --- a/src/main/java/gl/ao/serengeti/storage/StorageResponseObject.java +++ b/src/main/java/ms/ao/serengeti/storage/StorageResponseObject.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.storage; +package ms.ao.serengeti.storage; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/gl/ao/serengeti/storage/StorageScheduler.java b/src/main/java/ms/ao/serengeti/storage/StorageScheduler.java similarity index 94% rename from src/main/java/gl/ao/serengeti/storage/StorageScheduler.java rename to src/main/java/ms/ao/serengeti/storage/StorageScheduler.java index 3ea1f57..32091cd 100644 --- a/src/main/java/gl/ao/serengeti/storage/StorageScheduler.java +++ b/src/main/java/ms/ao/serengeti/storage/StorageScheduler.java @@ -1,8 +1,8 @@ -package gl.ao.serengeti.storage; +package ms.ao.serengeti.storage; -import gl.ao.serengeti.helpers.Globals; -import gl.ao.serengeti.network.Network; -import gl.ao.serengeti.schema.DatabaseObject; +import ms.ao.serengeti.helpers.Globals; +import ms.ao.serengeti.network.Network; +import ms.ao.serengeti.schema.DatabaseObject; import java.nio.file.Files; import java.nio.file.Path; diff --git a/src/main/java/gl/ao/serengeti/ui/Dashboard.java b/src/main/java/ms/ao/serengeti/ui/Dashboard.java similarity index 83% rename from src/main/java/gl/ao/serengeti/ui/Dashboard.java rename to src/main/java/ms/ao/serengeti/ui/Dashboard.java index ab35866..5a1be4f 100644 --- a/src/main/java/gl/ao/serengeti/ui/Dashboard.java +++ b/src/main/java/ms/ao/serengeti/ui/Dashboard.java @@ -1,13 +1,8 @@ -package gl.ao.serengeti.ui; - -import gl.ao.serengeti.helpers.Globals; +package ms.ao.serengeti.ui; import java.io.*; import java.net.URISyntaxException; -import java.net.URL; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.Objects; import java.util.stream.Collectors; diff --git a/src/main/java/gl/ao/serengeti/ui/Interactive.java b/src/main/java/ms/ao/serengeti/ui/Interactive.java similarity index 85% rename from src/main/java/gl/ao/serengeti/ui/Interactive.java rename to src/main/java/ms/ao/serengeti/ui/Interactive.java index cd5e1e5..1d7ee9b 100644 --- a/src/main/java/gl/ao/serengeti/ui/Interactive.java +++ b/src/main/java/ms/ao/serengeti/ui/Interactive.java @@ -1,16 +1,11 @@ -package gl.ao.serengeti.ui; - -import gl.ao.serengeti.helpers.Globals; +package ms.ao.serengeti.ui; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URISyntaxException; -import java.net.URL; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.Objects; import java.util.stream.Collectors; diff --git a/src/test/java/gl/ao/serengeti/SerengetiTest.java b/src/test/java/ms/ao/serengeti/SerengetiTest.java similarity index 79% rename from src/test/java/gl/ao/serengeti/SerengetiTest.java rename to src/test/java/ms/ao/serengeti/SerengetiTest.java index 1bcaaee..62b0172 100644 --- a/src/test/java/gl/ao/serengeti/SerengetiTest.java +++ b/src/test/java/ms/ao/serengeti/SerengetiTest.java @@ -1,6 +1,6 @@ -package gl.ao.serengeti; +package ms.ao.serengeti; -import gl.ao.serengeti.storage.Storage; +import ms.ao.serengeti.storage.Storage; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/gl/ao/serengeti/storage/StorageTest.java b/src/test/java/ms/ao/serengeti/storage/StorageTest.java similarity index 88% rename from src/test/java/gl/ao/serengeti/storage/StorageTest.java rename to src/test/java/ms/ao/serengeti/storage/StorageTest.java index 38a3852..5f3903b 100644 --- a/src/test/java/gl/ao/serengeti/storage/StorageTest.java +++ b/src/test/java/ms/ao/serengeti/storage/StorageTest.java @@ -1,10 +1,8 @@ -package gl.ao.serengeti.storage; +package ms.ao.serengeti.storage; -import gl.ao.serengeti.Serengeti; +import ms.ao.serengeti.Serengeti; import org.junit.jupiter.api.*; -import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.util.Random; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/gl/ao/serengeti/ui/DashboardTest.java b/src/test/java/ms/ao/serengeti/ui/DashboardTest.java similarity index 96% rename from src/test/java/gl/ao/serengeti/ui/DashboardTest.java rename to src/test/java/ms/ao/serengeti/ui/DashboardTest.java index d4c5eae..773c8f4 100644 --- a/src/test/java/gl/ao/serengeti/ui/DashboardTest.java +++ b/src/test/java/ms/ao/serengeti/ui/DashboardTest.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.ui; +package ms.ao.serengeti.ui; import org.junit.jupiter.api.Test; import java.io.BufferedReader; diff --git a/src/test/java/gl/ao/serengeti/ui/InteractiveTest.java b/src/test/java/ms/ao/serengeti/ui/InteractiveTest.java similarity index 96% rename from src/test/java/gl/ao/serengeti/ui/InteractiveTest.java rename to src/test/java/ms/ao/serengeti/ui/InteractiveTest.java index e656ce7..7d8471b 100644 --- a/src/test/java/gl/ao/serengeti/ui/InteractiveTest.java +++ b/src/test/java/ms/ao/serengeti/ui/InteractiveTest.java @@ -1,4 +1,4 @@ -package gl.ao.serengeti.ui; +package ms.ao.serengeti.ui; import org.junit.jupiter.api.Test; import java.io.BufferedReader;