public class ResourceDbLocationProvider extends java.lang.Object implements DbLocationProvider
#resource and #resource_script. This functionality is primarily aimed at testing
to support a fresh database file for embeddable databases such as H2, Sqlite, etc.
Handle expression syntax like: ${#resource /org/example/MyDatabase.db [, MyName][, args]}
Where /org/example/MyDatabase.db is an absolute Java resource path to a sql database file and the optional
MyName parameter is the file name to be used for the resulting URL path string (if different from the file name),
and args can be additional options such as ";create=true;blah=blah". Alternatively, additional options
can usually be provided as DbConfig properties.
Copies the contents of /org/example/MyDatabase.db to a temp directory and returns the temp dir path, and if
specified, replaces MyDatabase.db file name with MyName.
Also handles ${#resource_script ... } with same functionality as #resource, but the resource path is
a DDL script instead of a database file. Here, MyName must be provided as the resulting URL db file name. The
DDL file is executed when the first connection is made to the db.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
RESOURCE |
static java.lang.String |
RESOURCE_SCRIPT |
PROVIDED, UNHANDLED| Constructor and Description |
|---|
ResourceDbLocationProvider() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteTempDbDir(ExecutionEnv executionEnv,
java.lang.String dbFileResourcePath) |
manifold.rt.api.util.Pair<java.lang.Object,java.util.function.Consumer<java.sql.Connection>> |
getLocation(java.util.function.Function<java.lang.String,manifold.api.util.cache.FqnCache<manifold.api.fs.IFile>> resByExt,
ExecutionEnv executionEnv,
java.lang.String tag,
java.lang.String... args) |
static @NotNull java.lang.String |
makeTempDirName(java.lang.String dbFileResourcePath) |
static manifold.api.fs.IFile |
maybeGetCompileTimeResource(java.util.function.Function<java.lang.String,manifold.api.util.cache.FqnCache<manifold.api.fs.IFile>> resByExt,
ExecutionEnv executionEnv,
java.lang.String dbFileResourcePath) |
public static final java.lang.String RESOURCE
public static final java.lang.String RESOURCE_SCRIPT
public manifold.rt.api.util.Pair<java.lang.Object,java.util.function.Consumer<java.sql.Connection>> getLocation(java.util.function.Function<java.lang.String,manifold.api.util.cache.FqnCache<manifold.api.fs.IFile>> resByExt,
ExecutionEnv executionEnv,
java.lang.String tag,
java.lang.String... args)
getLocation in interface DbLocationProvider@NotNull public static @NotNull java.lang.String makeTempDirName(java.lang.String dbFileResourcePath)
public static void deleteTempDbDir(ExecutionEnv executionEnv, java.lang.String dbFileResourcePath)
public static manifold.api.fs.IFile maybeGetCompileTimeResource(java.util.function.Function<java.lang.String,manifold.api.util.cache.FqnCache<manifold.api.fs.IFile>> resByExt,
ExecutionEnv executionEnv,
java.lang.String dbFileResourcePath)
Copyright © 2024. All rights reserved.