Package org.trellisldp.api
Class NoopResourceService
- java.lang.Object
-
- org.trellisldp.api.NoopResourceService
-
- All Implemented Interfaces:
ResourceService,RetrievalService<Resource>
public class NoopResourceService extends Object implements ResourceService
A no-op resource service that can be used with CDI and proxy objects.
-
-
Constructor Summary
Constructors Constructor Description NoopResourceService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>add(IRI identifier, Dataset dataset)CompletionStage<Void>delete(Metadata metadata)Delete a resource from the server.StringgenerateIdentifier()An identifier generator.CompletionStage<Resource>get(IRI identifier)Get a resource by the given identifier.CompletionStage<Void>replace(Metadata metadata, Dataset dataset)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.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.trellisldp.api.ResourceService
create, getResourceIdentifier, skolemize, toExternal, toInternal, unskolemize
-
-
-
-
Method Detail
-
get
public CompletionStage<Resource> get(IRI identifier)
Description copied from interface:RetrievalServiceGet a resource by the given identifier.- Specified by:
getin interfaceRetrievalService<Resource>- Parameters:
identifier- the resource identifier- Returns:
- the resource
-
replace
public CompletionStage<Void> replace(Metadata metadata, Dataset dataset)
Description copied from interface:ResourceServiceReplace a resource in the server.- Specified by:
replacein interfaceResourceService- Parameters:
metadata- metadata for the resourcedataset- the dataset to be persisted- Returns:
- a new completion stage that, when the stage completes normally, indicates that the supplied data
were successfully stored in the corresponding persistence layer. In the case of an unsuccessful write operation,
the
CompletionStagewill complete exceptionally and can be handled withCompletionStage.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.
-
delete
public CompletionStage<Void> delete(Metadata metadata)
Description copied from interface:ResourceServiceDelete a resource from the server.- Specified by:
deletein interfaceResourceService- Parameters:
metadata- metadata for the resource- Returns:
- a new completion stage that, when the stage completes normally, indicates that the resource
was successfully deleted from the corresponding persistence layer. In the case of an unsuccessful delete
operation, the
CompletionStagewill complete exceptionally and can be handled withCompletionStage.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.
-
add
public CompletionStage<Void> add(IRI identifier, Dataset dataset)
- Specified by:
addin interfaceResourceService- Parameters:
identifier- the identifier under which to persist a datasetdataset- a dataset to persist- Returns:
- a new completion stage that, when the stage completes normally, indicates that the supplied data
were successfully stored in the corresponding persistence layer. In the case of an unsuccessful write operation,
the
CompletionStagewill complete exceptionally and can be handled withCompletionStage.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.
-
touch
public CompletionStage<Void> touch(IRI identifier)
Description copied from interface:ResourceServiceUpdate the modification date of the provided resource.- Specified by:
touchin interfaceResourceService- Parameters:
identifier- the identifier of the resource- Returns:
- a new completion stage that, when the stage completes normally, indicates that the identified resource has been updated with a new modification date.
-
supportedInteractionModels
public Set<IRI> supportedInteractionModels()
Description copied from interface:ResourceServiceReturn a collection of interaction models supported by this Resource Service.- Specified by:
supportedInteractionModelsin interfaceResourceService- Returns:
- a set of supported interaction models
-
generateIdentifier
public String generateIdentifier()
Description copied from interface:ResourceServiceAn identifier generator.- Specified by:
generateIdentifierin interfaceResourceService- Returns:
- a new identifier
-
-