preparing sqlite-based services

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-09-07 23:37:41 +02:00
parent db59964c98
commit 06cb6abdc6
12 changed files with 424 additions and 30 deletions

View File

@@ -0,0 +1,28 @@
/* © SRSoftware 2024 */
package de.srsoftware.oidc.datastore.file;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
public class FileStoreProvider extends HashMap<File, FileStore> {
private UuidHasher hasher;
public FileStoreProvider(UuidHasher passwordHasher) {
hasher = passwordHasher;
}
@Override
public FileStore get(Object o) {
if (o instanceof File storageFile) try {
var fileStore = super.get(storageFile);
if (fileStore == null) put(storageFile, fileStore = new FileStore(storageFile, hasher));
return fileStore;
} catch (IOException ioex) {
throw new RuntimeException(ioex);
}
return null;
}
}