Package org.trellisldp.jdbc
Class DBWrappedMementoService
- java.lang.Object
-
- org.trellisldp.jdbc.DBWrappedMementoService
-
- All Implemented Interfaces:
MementoService
@ApplicationScoped public class DBWrappedMementoService extends Object implements MementoService
-
-
Constructor Summary
Constructors Constructor Description DBWrappedMementoService()
Create a new DB enhanced MementoService object.DBWrappedMementoService(DataSource ds)
Create a new DB enhanced MementoService object.DBWrappedMementoService(DataSource ds, MementoService service)
Create a new DB enhanced MementoService object.DBWrappedMementoService(org.jdbi.v3.core.Jdbi jdbi, MementoService service)
Create a new DB enhanced MementoService object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Resource>
get(IRI identifier, Instant time)
Fetch a Memento resource for the given time.CompletionStage<SortedSet<Instant>>
mementos(IRI identifier)
Get the times for all of the Mementos of the given resource.CompletionStage<Void>
put(Resource resource)
Create a new Memento for a resource.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.trellisldp.api.MementoService
put
-
-
-
-
Constructor Detail
-
DBWrappedMementoService
public DBWrappedMementoService()
Create a new DB enhanced MementoService object.This constructor is generally used by CDI proxies and should not be invoked directly.
-
DBWrappedMementoService
@Inject public DBWrappedMementoService(DataSource ds)
Create a new DB enhanced MementoService object.- Parameters:
ds
- the DataSource object
-
DBWrappedMementoService
public DBWrappedMementoService(DataSource ds, MementoService service)
Create a new DB enhanced MementoService object.- Parameters:
ds
- the DataSource objectservice
- the memento service implementation
-
DBWrappedMementoService
public DBWrappedMementoService(org.jdbi.v3.core.Jdbi jdbi, MementoService service)
Create a new DB enhanced MementoService object.- Parameters:
jdbi
- the JDBI objectservice
- the memento service implementation
-
-
Method Detail
-
get
public CompletionStage<Resource> get(IRI identifier, Instant time)
Description copied from interface:MementoService
Fetch a Memento resource for the given time.- Specified by:
get
in interfaceMementoService
- Parameters:
identifier
- the resource identifiertime
- the requested time- Returns:
- the new completion stage, containing the fetched resource
-
put
public CompletionStage<Void> put(Resource resource)
Description copied from interface:MementoService
Create a new Memento for a resource.- Specified by:
put
in interfaceMementoService
- Parameters:
resource
- the resource- Returns:
- a new completion stage that, when the stage completes normally, indicates that the Memento resource was
successfully created 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.
-
mementos
public CompletionStage<SortedSet<Instant>> mementos(IRI identifier)
Description copied from interface:MementoService
Get the times for all of the Mementos of the given resource.- Specified by:
mementos
in interfaceMementoService
- Parameters:
identifier
- the resource identifier- Returns:
- the new completion stage containing a collection of Memento dateTimes
-
-