Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
baac7ded
Commit
baac7ded
authored
Dec 10, 2025
by
Luna Riegel
Browse files
Feature: Add tempfile-mode flag to db settings
parent
50d7e64f
Changes
2
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/DataBaseSettings.java
View file @
baac7ded
...
...
@@ -50,10 +50,12 @@ public final class DataBaseSettings {
String
inMemoryModeString
=
props
.
getProperty
(
"inMemoryMode"
);
String
attemptFallbackString
=
props
.
getProperty
(
"attemptFallback"
);
String
debugModeString
=
props
.
getProperty
(
"debugMode"
);
String
tempModeString
=
props
.
getProperty
(
"tempMode"
);
boolean
inMemoryMode
=
Boolean
.
parseBoolean
(
inMemoryModeString
);
boolean
attemptFallback
=
attemptFallbackString
==
null
||
Boolean
.
parseBoolean
(
attemptFallbackString
);
boolean
debugMode
=
Boolean
.
parseBoolean
(
debugModeString
);
boolean
tempMode
=
Boolean
.
parseBoolean
(
tempModeString
);
int
poolSize
;
try
{
poolSize
=
Integer
.
parseInt
(
poolSizeString
);
...
...
@@ -86,7 +88,7 @@ public final class DataBaseSettings {
}
}
return
new
EmbeddedDatabaseConfiguration
(
name
,
directory
,
poolSize
,
inMemoryMode
,
attemptFallback
,
debugMode
);
return
new
EmbeddedDatabaseConfiguration
(
name
,
directory
,
poolSize
,
inMemoryMode
,
attemptFallback
,
debugMode
,
tempMode
);
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/database/EmbeddedDatabaseConfiguration.java
View file @
baac7ded
...
...
@@ -14,9 +14,11 @@ import java.io.File;
* database-file fails. Will be ignored if inMemoryMode is true
* @param debugMode If true, CityDoctor will start the embedded database in automatic mixed mode to allow access to the
* database during runtime.
* @param tempFileMode If true, CityDoctor will create the database in the system's temp directory. Will be ignored if
* inMemoryMode is true
*/
public
record
EmbeddedDatabaseConfiguration
(
String
databaseName
,
String
databaseDirectory
,
int
connectionPoolSize
,
boolean
inMemoryMode
,
boolean
attemptFallback
,
boolean
debugMode
)
{
boolean
inMemoryMode
,
boolean
attemptFallback
,
boolean
debugMode
,
boolean
tempFileMode
)
{
private
static
final
String
IN_MEMORY_PREFIX
=
"jdbc:h2:mem"
;
private
static
final
String
AUTO_SERVER_PARAMETER
=
";AUTO_SERVER=TRUE"
;
...
...
@@ -25,7 +27,12 @@ public record EmbeddedDatabaseConfiguration(String databaseName, String database
*/
EmbeddedDatabaseConfiguration
()
{
this
(
"cd_db"
,
File
.
separator
+
"database"
+
File
.
separator
,
Runtime
.
getRuntime
().
availableProcessors
(),
false
,
true
,
false
);
false
,
true
,
false
,
false
);
}
public
static
EmbeddedDatabaseConfiguration
getTestConfig
()
{
return
new
EmbeddedDatabaseConfiguration
(
"cd_db"
,
File
.
separator
+
"database"
+
File
.
separator
,
Runtime
.
getRuntime
().
availableProcessors
(),
true
,
true
,
true
,
false
);
}
public
String
getInMemoryH2Url
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment