public class JsonFileStorage<T> extends FileStorage<T> implements ArtifactStorage<T>
| Constructor and Description |
|---|
JsonFileStorage(java.nio.file.Path storagePath,
T emptyEntity) |
JsonFileStorage(java.nio.file.Path storagePath,
T emptyEntity,
java.lang.Class<T> entityType) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
read(java.nio.file.Path dirPath,
java.lang.String id)
Reads an artifact.
|
protected boolean |
remove(java.nio.file.Path dirPath,
java.lang.String id)
Removes an artifact.
|
protected void |
write(java.nio.file.Path dirPath,
java.lang.String id,
T entity)
Writes the artifacts to the file system.
|
get, getTagForId, put, putToReserved, remove, reserveclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, getTagForId, put, putToReserved, remove, reservepublic JsonFileStorage(java.nio.file.Path storagePath,
T emptyEntity,
java.lang.Class<T> entityType)
public JsonFileStorage(java.nio.file.Path storagePath,
T emptyEntity)
protected void write(java.nio.file.Path dirPath,
java.lang.String id,
T entity)
throws java.io.IOException
FileStoragewrite in class FileStorage<T>dirPath - The directory in which the artifact should be stored.id - The ID of the artifact.entity - The artifact to be stored.java.io.IOException - If writing fails.protected T read(java.nio.file.Path dirPath, java.lang.String id) throws java.io.IOException
FileStorageread in class FileStorage<T>java.io.IOExceptionprotected boolean remove(java.nio.file.Path dirPath,
java.lang.String id)
FileStorageremove in class FileStorage<T>true if the artifact existed and was removed successfully.