Wasted a few hours without testing

This commit is contained in:
Willem Cazander 2022-10-17 00:10:53 +02:00
parent 53748cae84
commit 4a140b3459
8 changed files with 79 additions and 35 deletions

View file

@ -15,6 +15,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
@ -32,7 +37,8 @@
<Import-Package>
${tos4.packages},
${vrgem4.packages},
${mmdoc.packages}
${mmdoc.packages},
${mariadb.packages}
</Import-Package>
<Bundle-Vendor>distributedrebirth.love</Bundle-Vendor>
</instructions>

View file

@ -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);

View file

@ -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);

View file

@ -17,6 +17,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
@ -30,6 +34,9 @@
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
@ -44,10 +51,11 @@
<fileset dir="src/main/chain" />
</copy>
<copy todir="target/chain/bundle">
<file file="target/dependency/slf4j-api-1.7.36.jar" />
<file file="target/dependency/logback-core-1.2.10.jar" />
<file file="target/dependency/logback-classic-1.2.10.jar" />
<file file="target/dependency/commons-lang3-3.5.jar" />
<file file="target/dependency/slf4j-api.jar" />
<file file="target/dependency/logback-core.jar" />
<file file="target/dependency/logback-classic.jar" />
<file file="target/dependency/commons-lang3.jar" />
<file file="target/dependency/mariadb-java-client.jar" />
</copy>
<java failonerror="true" fork="true" classname="love.distributedrebirth.warpme.hash.WaterShotAddict">
<arg value="target/chain" />

View file

@ -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">
<soft:hash file="warp-sea.xml" hex="0"/>
<soft:hash file="bundle/slf4j-api-1.7.36.jar" hex="0"/>
<soft:hash file="bundle/logback-core-1.2.10.jar" hex="0"/>
<soft:hash file="bundle/logback-classic-1.2.10.jar" hex="0"/>
<soft:hash file="bundle/commons-lang3-3.5.jar" hex="0"/>
<soft:hash file="bundle/slf4j-api.jar" hex="0"/>
<soft:hash file="bundle/logback-core.jar" hex="0"/>
<soft:hash file="bundle/logback-classic.jar" hex="0"/>
<soft:hash file="bundle/commons-lang3.jar" hex="0"/>
<soft:hash file="bundle/mariadb-java-client.jar" hex="0"/>
</root:shot>

View file

@ -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">
<link:sea name="Dep Osgi Lib" provider="gdxapp4d.system" author="للَّٰهِilLצسُو">
<link:magic file="bundle/slf4j-api-1.7.36.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/logback-core-1.2.10.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/logback-classic-1.2.10.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/commons-lang3-3.5.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/slf4j-api.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/logback-core.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/logback-classic.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/commons-lang3.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/mariadb-java-client.jar" mime="application/vnd.osgi.bundle"/>
</link:sea>
</root:ocean>

View file

@ -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) {

22
pom.xml
View file

@ -232,6 +232,23 @@
org.postgresql.xa.jdbc3,
org.postgresql.xa.jdbc4
</mmdoc.packages>
<mariadb.packages>
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
</mariadb.packages>
</properties>
<dependencyManagement>
<dependencies>
@ -366,6 +383,11 @@
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.8</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>