From 4a140b3459d61194531f3627ec0f518e66407889 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 17 Oct 2022 00:10:53 +0200 Subject: [PATCH] Wasted a few hours without testing --- gdxapp4d-app-mmdoc/pom.xml | 8 ++++- .../gdxapp4d/app/mmdoc/MMDocDeskApp.java | 34 +++++++++---------- .../gdxapp4d/app/mmdoc/MMDocManager.java | 15 +++++--- gdxapp4d-chain-dep-osgi-lib/pom.xml | 16 ++++++--- .../src/main/chain/warp-hash.xml | 9 ++--- .../src/main/chain/warp-sea.xml | 9 ++--- .../gdxapp4d/tos4/GDXAppTos4BootFactory.java | 1 - pom.xml | 22 ++++++++++++ 8 files changed, 79 insertions(+), 35 deletions(-) diff --git a/gdxapp4d-app-mmdoc/pom.xml b/gdxapp4d-app-mmdoc/pom.xml index 3b3961bf..9f88146d 100644 --- a/gdxapp4d-app-mmdoc/pom.xml +++ b/gdxapp4d-app-mmdoc/pom.xml @@ -15,6 +15,11 @@ ${project.version} provided + + org.mariadb.jdbc + mariadb-java-client + provided + @@ -32,7 +37,8 @@ ${tos4.packages}, ${vrgem4.packages}, - ${mmdoc.packages} + ${mmdoc.packages}, + ${mariadb.packages} distributedrebirth.love diff --git a/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocDeskApp.java b/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocDeskApp.java index a09a1c7c..0138817d 100644 --- a/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocDeskApp.java +++ b/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocDeskApp.java @@ -1,7 +1,6 @@ package love.distributedrebirth.gdxapp4d.app.mmdoc; import java.io.File; -import java.sql.SQLException; import java.util.Map.Entry; import java.util.function.Consumer; @@ -26,7 +25,7 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer { private final NativeFileChooser fileChooser; private final NativeFileChooserConfiguration fileChooserConfig; - private final MMDocManager docManager = new MMDocManager(); + private final MMDocManager docManager; private final ImString dbHost = new ImString(); private final ImString dbName = new ImString(); private final ImString dbUser = new ImString(); @@ -39,6 +38,8 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer { fileChooserConfig = new NativeFileChooserConfiguration(); fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home")); fileChooserConfig.title = "Choose file"; + docManager = new MMDocManager(); + docManager.loadDrivers(); } public void create() { @@ -75,25 +76,24 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer { result = "Added CSV file"; })); } - ImGui.sameLine(); - if (ImGui.button("Add PG")) { - try { - docManager.addDocModelJdbcPg(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get()); - result = "Added PG DB"; - } catch (SQLException e) { - e.printStackTrace(); - result = e.getMessage(); + try { + ImGui.sameLine(); + if (ImGui.button("Add Mariadb")) { + docManager.addDocModelJdbcMy(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get()); + result = "Added MariaDB"; } - } - - if (ImGui.button("Generate")) { - try { + ImGui.sameLine(); + if (ImGui.button("Add Postgresql")) { + docManager.addDocModelJdbcPg(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get()); + result = "Added Postgresqk DB"; + } + if (ImGui.button("Generate")) { docManager.generate(new File(docTarget.get())); result = "done"; - } catch (Exception e) { - e.printStackTrace(); - result = e.getMessage(); } + } catch (Exception e) { + e.printStackTrace(); + result = e.getMessage(); } ImGui.sameLine(); ImGui.text("Result: "+result); diff --git a/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocManager.java b/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocManager.java index 76e0408a..a3d8d144 100644 --- a/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocManager.java +++ b/gdxapp4d-app-mmdoc/src/main/java/love/distributedrebirth/gdxapp4d/app/mmdoc/MMDocManager.java @@ -14,15 +14,22 @@ public class MMDocManager { private final DocModelDataStore dms = new DocModelDataStore(); + public void loadDrivers() { // mariadb has to be forced to load in ogsi bundle, pg works fine(no osgi info) + try { + Class.forName(org.postgresql.Driver.class.getName()); + //Class.forName(org.h2.Driver.class.getName()); + //Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver.class.getName()); + Class.forName(org.mariadb.jdbc.Driver.class.getName()); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + public DocModelDataStore getDataStore() { return dms; } public void generate(File targetPath) throws Exception { - Class.forName(org.postgresql.Driver.class.getName()); - //Class.forName(org.h2.Driver.class.getName()); - //Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver.class.getName()); - try { DocModelWriter writer = new DocModelWriter(dms); writer.writeModelDoc(targetPath); diff --git a/gdxapp4d-chain-dep-osgi-lib/pom.xml b/gdxapp4d-chain-dep-osgi-lib/pom.xml index 07c17798..9b675b4c 100644 --- a/gdxapp4d-chain-dep-osgi-lib/pom.xml +++ b/gdxapp4d-chain-dep-osgi-lib/pom.xml @@ -17,6 +17,10 @@ org.apache.commons commons-lang3 + + org.mariadb.jdbc + mariadb-java-client + @@ -30,6 +34,9 @@ copy-dependencies + + true + @@ -44,10 +51,11 @@ - - - - + + + + + diff --git a/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-hash.xml b/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-hash.xml index d3d6678b..c8e02f4b 100644 --- a/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-hash.xml +++ b/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-hash.xml @@ -4,8 +4,9 @@ xmlns:soft="http://warp-hash.x4o.distributedrebirth.love/xml/ns/warp-hash-soft" xsi:schemaLocation="http://wrap-core.x4o.distributedrebirth.love/xml/ns/warp-hash-root http://warp-hash.x4o.distributedrebirth.love/xml/ns/warp-hash-root-1.0.xsd"> - - - - + + + + + diff --git a/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-sea.xml b/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-sea.xml index 541911df..5a2db848 100644 --- a/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-sea.xml +++ b/gdxapp4d-chain-dep-osgi-lib/src/main/chain/warp-sea.xml @@ -4,9 +4,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root-1.0.xsd"> - - - - + + + + + diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java index e3af3cf0..67794b87 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java @@ -189,7 +189,6 @@ public class GDXAppTos4BootFactory { "org.postgresql.xa,"+ "org.postgresql.xa.jdbc3,"+ "org.postgresql.xa.jdbc4" - ); // ; version=1.0.0 if (cachedir != null) { diff --git a/pom.xml b/pom.xml index d58c6472..4f685cbd 100644 --- a/pom.xml +++ b/pom.xml @@ -232,6 +232,23 @@ org.postgresql.xa.jdbc3, org.postgresql.xa.jdbc4 + + org.mariadb.jdbc, + org.mariadb.jdbc.client, + org.mariadb.jdbc.client.util, + org.mariadb.jdbc.client.socket, + org.mariadb.jdbc.message, + org.mariadb.jdbc.type, + org.mariadb.jdbc.export, + org.mariadb.jdbc.plugin, + org.mariadb.jdbc.plugin.codec, + org.mariadb.jdbc.plugin.authentication.standard, + org.mariadb.jdbc.plugin.authentication.addon, + org.mariadb.jdbc.plugin.credential.aws, + org.mariadb.jdbc.plugin.credential.env, + org.mariadb.jdbc.plugin.credential.system, + org.mariadb.jdbc.plugin.tls.main + @@ -366,6 +383,11 @@ postgresql 9.1-901-1.jdbc4 + + org.mariadb.jdbc + mariadb-java-client + 3.0.8 +