preparing sqlite-based services
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user