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.String
generateIdentifier()
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:RetrievalService
Get a resource by the given identifier.- Specified by:
get
in interfaceRetrievalService<Resource>
- Parameters:
identifier
- the resource identifier- Returns:
- the resource
-
replace
public CompletionStage<Void> replace(Metadata metadata, Dataset dataset)
Description copied from interface:ResourceService
Replace a resource in the server.- Specified by:
replace
in 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
CompletionStage
will 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:ResourceService
Delete a resource from the server.- Specified by:
delete
in 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
CompletionStage
will 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:
add
in 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
CompletionStage
will 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:ResourceService
Update the modification date of the provided resource.- Specified by:
touch
in 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:ResourceService
Return a collection of interaction models supported by this Resource Service.- Specified by:
supportedInteractionModels
in interfaceResourceService
- Returns:
- a set of supported interaction models
-
generateIdentifier
public String generateIdentifier()
Description copied from interface:ResourceService
An identifier generator.- Specified by:
generateIdentifier
in interfaceResourceService
- Returns:
- a new identifier
-
-