public class MixedStorage<T> extends java.lang.Object implements ArtifactStorage<T>
| Constructor and Description |
|---|
MixedStorage(java.lang.Class<T> entityType,
FileStorage<T> fileStorage) |
MixedStorage(java.nio.file.Path storagePath,
T emptyEntity)
Uses the default
JsonFileStorage. |
MixedStorage(java.nio.file.Path storagePath,
T emptyEntity,
java.lang.Class<T> entityType)
Uses the default
JsonFileStorage. |
| Modifier and Type | Method and Description |
|---|---|
T |
get(java.lang.String id)
Retrieves the model for the given id.
|
java.lang.String |
getTagForId(java.lang.String id)
Returns the tag that is part of the ID.
|
java.lang.String |
put(T entity,
java.lang.String tag)
Adds a new entity and returns the automatically created id.
|
java.lang.String |
put(T entity,
java.lang.String tag,
boolean persist)
Adds a new entity and returns the automatically created id.
|
void |
putToReserved(java.lang.String id,
T entity)
Adds a new entity to an already reserved slot.
|
boolean |
remove(java.lang.String id)
Removes the model with the passed id and returns whether the id was present.
|
java.lang.String |
reserve(java.lang.String tag)
Reserves a slot in the storage.
|
java.lang.String |
reserve(java.lang.String tag,
boolean persist)
Reserves a slot in the storage.
|
public MixedStorage(java.lang.Class<T> entityType, FileStorage<T> fileStorage)
public MixedStorage(java.nio.file.Path storagePath,
T emptyEntity,
java.lang.Class<T> entityType)
JsonFileStorage.storagePath - emptyEntity - entityType - public MixedStorage(java.nio.file.Path storagePath,
T emptyEntity)
JsonFileStorage.storagePath - emptyEntity - public java.lang.String reserve(java.lang.String tag,
boolean persist)
tag - The tag of the entity.persist - Whether the FileStorage should be used.public void putToReserved(java.lang.String id,
T entity)
ArtifactStorageputToReserved in interface ArtifactStorage<T>id - The ID of the slot.entity - The entity to be stored.public java.lang.String put(T entity, java.lang.String tag, boolean persist)
entity - The entity to be stored.tag - The tag of the entity.persist - Whether the FileStorage should be used.public java.lang.String reserve(java.lang.String tag)
ArtifactStoragereserve in interface ArtifactStorage<T>tag - The tag of the entity.public java.lang.String put(T entity, java.lang.String tag)
ArtifactStorageput in interface ArtifactStorage<T>entity - The entity to be stored.tag - The tag of the entity.public T get(java.lang.String id)
ArtifactStorageget in interface ArtifactStorage<T>id - The id of the model.WorkloadModel.public boolean remove(java.lang.String id)
ArtifactStorageremove in interface ArtifactStorage<T>id - The id to be removed.true, if the passed id was present and successfully removed.public java.lang.String getTagForId(java.lang.String id)
ArtifactStoragegetTagForId in interface ArtifactStorage<T>id - The ID containing the tag.