public abstract class AbstractTrackedResourceProvider extends Object implements TrackedResourceProvider
Constructor and Description |
---|
AbstractTrackedResourceProvider(ResourceEventStore eventStore)
Constructs a provider that can use the specified event store to grab changes that were registered in there.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Function<ResourceEvent,URI> |
createUriFactory(HttpServletRequest request)
Returns a function that can associate a URI to the resource wrapped by the specified event.
|
Collection<TrackedResource> |
getAllResources(HttpServletRequest request)
Calls
queryAllResources(HttpServletRequest) to compute all existing resources in the system. |
Collection<TrackedResource> |
getChangedResources(Date after,
HttpServletRequest request)
Combines resources retrieved dynamically by calling
queryChangedResources(Date, HttpServletRequest)
with changes extracted from the attached event store. |
protected ResourceEventStore |
getResourceEventStore()
Returns the store attached to this provider;
|
protected abstract Collection<TrackedResource> |
queryAllResources(HttpServletRequest request)
Queries all existing
tracked resources in the system. |
protected abstract Collection<TrackedResource> |
queryChangedResources(Date after,
HttpServletRequest request)
Queries the
tracked resources that have changed after a given time. |
public AbstractTrackedResourceProvider(ResourceEventStore eventStore)
eventStore
- the store where events can be queried from.protected final ResourceEventStore getResourceEventStore()
public Collection<TrackedResource> getAllResources(HttpServletRequest request)
queryAllResources(HttpServletRequest)
to compute all existing resources in the system.
Also clears the event store so that any yet registered event is not integrated in the change log.
The assumption of this implementation is that all resources can be dynamically queried at this time.getAllResources
in interface TrackedResourceProvider
request
- the current HTTP request.protected abstract Collection<TrackedResource> queryAllResources(HttpServletRequest request)
tracked resources
in the system.
Returned Resources must use the CREATED
event type.request
- the current HTTP request.public Collection<TrackedResource> getChangedResources(Date after, HttpServletRequest request)
queryChangedResources(Date, HttpServletRequest)
with changes extracted from the attached event store.getChangedResources
in interface TrackedResourceProvider
after
- the reference time to search changed resources.request
- the current HTTP request.after
date; an unsorted list of changed resources otherwise.protected abstract Collection<TrackedResource> queryChangedResources(Date after, HttpServletRequest request)
tracked resources
that have changed after a given time.
This includes resources that were created, modified or deleted since that date.after
- the reference time to search changed resources.request
- the current HTTP request.after
date; an unsorted list of changed resources otherwise.protected abstract Function<ResourceEvent,URI> createUriFactory(HttpServletRequest request)
request
- the current HTTP request.