public class InMemoryResourceService extends Object implements ResourceService
ResourceService that stores its contents in memory, for testing.| Constructor and Description |
|---|
InMemoryResourceService() |
| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Void> |
add(IRI identifier,
Dataset newData) |
CompletionStage<Void> |
delete(Metadata metadata)
Delete a resource from the server.
|
String |
generateIdentifier()
An identifier generator.
|
CompletionStage<? extends Resource> |
get(IRI identifier)
Get a resource by the given identifier.
|
CompletionStage<Void> |
replace(Metadata metadata,
Dataset data)
Replace a resource in the server.
|
Set<IRI> |
supportedInteractionModels()
Return a collection of interaction models supported by this Resource Service.
|
CompletionStage<Void> |
touch(IRI identifier)
Update the modification date of the provided resource.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, skolemize, toExternal, toInternal, unskolemizepublic CompletionStage<? extends Resource> get(IRI identifier)
RetrievalServiceget in interface RetrievalService<Resource>identifier - the resource identifierpublic CompletionStage<Void> replace(Metadata metadata, Dataset data)
ResourceServicereplace in interface ResourceServicemetadata - metadata for the resourcedata - the dataset to be persistedCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> delete(Metadata metadata)
ResourceServicedelete in interface ResourceServicemetadata - metadata for the resourceCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> add(IRI identifier, Dataset newData)
add in interface ResourceServiceidentifier - the identifier under which to persist a datasetnewData - a dataset to persistCompletionStage will complete exceptionally and can be handled with
CompletionStage.handle(java.util.function.BiFunction<? super T, java.lang.Throwable, ? extends U>), CompletionStage.exceptionally(java.util.function.Function<java.lang.Throwable, ? extends T>) or similar methods.public CompletionStage<Void> touch(IRI identifier)
ResourceServicetouch in interface ResourceServiceidentifier - the identifier of the resourcepublic Set<IRI> supportedInteractionModels()
ResourceServicesupportedInteractionModels in interface ResourceServicepublic String generateIdentifier()
ResourceServicegenerateIdentifier in interface ResourceService