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

View file

@ -1,7 +1,6 @@
package love.distributedrebirth.gdxapp4d.app.mmdoc; package love.distributedrebirth.gdxapp4d.app.mmdoc;
import java.io.File; import java.io.File;
import java.sql.SQLException;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -26,7 +25,7 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer {
private final NativeFileChooser fileChooser; private final NativeFileChooser fileChooser;
private final NativeFileChooserConfiguration fileChooserConfig; private final NativeFileChooserConfiguration fileChooserConfig;
private final MMDocManager docManager = new MMDocManager(); private final MMDocManager docManager;
private final ImString dbHost = new ImString(); private final ImString dbHost = new ImString();
private final ImString dbName = new ImString(); private final ImString dbName = new ImString();
private final ImString dbUser = new ImString(); private final ImString dbUser = new ImString();
@ -39,6 +38,8 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer {
fileChooserConfig = new NativeFileChooserConfiguration(); fileChooserConfig = new NativeFileChooserConfiguration();
fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home")); fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home"));
fileChooserConfig.title = "Choose file"; fileChooserConfig.title = "Choose file";
docManager = new MMDocManager();
docManager.loadDrivers();
} }
public void create() { public void create() {
@ -75,26 +76,25 @@ public class MMDocDeskApp extends AbstractDeskApp implements DeskAppRenderer {
result = "Added CSV file"; result = "Added CSV file";
})); }));
} }
try {
ImGui.sameLine(); ImGui.sameLine();
if (ImGui.button("Add PG")) { if (ImGui.button("Add Mariadb")) {
try { docManager.addDocModelJdbcMy(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get());
result = "Added MariaDB";
}
ImGui.sameLine();
if (ImGui.button("Add Postgresql")) {
docManager.addDocModelJdbcPg(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get()); docManager.addDocModelJdbcPg(dbHost.get(), dbName.get(), dbUser.get(), dbPass.get());
result = "Added PG DB"; result = "Added Postgresqk DB";
} catch (SQLException e) {
e.printStackTrace();
result = e.getMessage();
} }
}
if (ImGui.button("Generate")) { if (ImGui.button("Generate")) {
try {
docManager.generate(new File(docTarget.get())); docManager.generate(new File(docTarget.get()));
result = "done"; result = "done";
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
result = e.getMessage(); result = e.getMessage();
} }
}
ImGui.sameLine(); ImGui.sameLine();
ImGui.text("Result: "+result); ImGui.text("Result: "+result);

View file

@ -14,15 +14,22 @@ public class MMDocManager {
private final DocModelDataStore dms = new DocModelDataStore(); 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() { public DocModelDataStore getDataStore() {
return dms; return dms;
} }
public void generate(File targetPath) throws Exception { 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 { try {
DocModelWriter writer = new DocModelWriter(dms); DocModelWriter writer = new DocModelWriter(dms);
writer.writeModelDoc(targetPath); writer.writeModelDoc(targetPath);

View file

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

View file

@ -4,8 +4,9 @@
xmlns:soft="http://warp-hash.x4o.distributedrebirth.love/xml/ns/warp-hash-soft" 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"> 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="warp-sea.xml" hex="0"/>
<soft:hash file="bundle/slf4j-api-1.7.36.jar" hex="0"/> <soft:hash file="bundle/slf4j-api.jar" hex="0"/>
<soft:hash file="bundle/logback-core-1.2.10.jar" hex="0"/> <soft:hash file="bundle/logback-core.jar" hex="0"/>
<soft:hash file="bundle/logback-classic-1.2.10.jar" hex="0"/> <soft:hash file="bundle/logback-classic.jar" hex="0"/>
<soft:hash file="bundle/commons-lang3-3.5.jar" hex="0"/> <soft:hash file="bundle/commons-lang3.jar" hex="0"/>
<soft:hash file="bundle/mariadb-java-client.jar" hex="0"/>
</root:shot> </root:shot>

View file

@ -4,9 +4,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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: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/slf4j-api.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-core.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/logback-classic.jar" mime="application/vnd.osgi.bundle"/>
<link:magic file="bundle/commons-lang3-3.5.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> </link:sea>
</root:ocean> </root:ocean>

View file

@ -189,7 +189,6 @@ public class GDXAppTos4BootFactory {
"org.postgresql.xa,"+ "org.postgresql.xa,"+
"org.postgresql.xa.jdbc3,"+ "org.postgresql.xa.jdbc3,"+
"org.postgresql.xa.jdbc4" "org.postgresql.xa.jdbc4"
); // ; version=1.0.0 ); // ; version=1.0.0
if (cachedir != null) { if (cachedir != null) {

22
pom.xml
View file

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