Interface TrackedResourceCollector
- All Known Implementing Classes:
ProcessResourceCollector
- Since:
- 1.10.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumDetermines when to collect resource events. -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectBaseMembers(Collection<ProjectArea> trsExposedProjects, Consumer<ResourceSeed> baseMembersConsumer) Collects all base members, accessible by thecurrent user.default voidcollectResourceEventsAfter(Date after, Collection<ProjectArea> trsExposedProjects, Consumer<ResourceEvent> resourceEventsConsumer) Collects latestchange eventsafter a moment in time, visible by thecurrent user.Determines when to collect events by querying changes in the host application.
-
Method Details
-
collectBaseMembers
void collectBaseMembers(Collection<ProjectArea> trsExposedProjects, Consumer<ResourceSeed> baseMembersConsumer) Collects all base members, accessible by thecurrent user.Implementation must notify the consumer of each artifact of the application that must be reported as TRS base member. Consumers may raise
CancellationExceptionto indicate the collecting process must stop, but implementations must no propagate this exception, this is a convenient way to stop a searching process.- Parameters:
trsExposedProjects- the collection of TRS exposed projectsbaseMembersConsumer- base members consumer.- Throws:
CompletionException- if consumer raise it to stop the collecting process due an error occurred.- Since:
- 4.0.0
-
getEventCollectorStrategy
Determines when to collect events by querying changes in the host application. Default implementation returnsTrackedResourceCollector.EventCollectorStrategy.NEVER, which impliescollectResourceEventsAfteris never called. Subclasses that overridecollectResourceEventsAftermust also override this method to either returnTrackedResourceCollector.EventCollectorStrategy.STARTUPorTrackedResourceCollector.EventCollectorStrategy.ALWAYS.- Returns:
- the strategy indicating when to collect resource events
- Since:
- 3.7.0
-
collectResourceEventsAfter
default void collectResourceEventsAfter(Date after, Collection<ProjectArea> trsExposedProjects, Consumer<ResourceEvent> resourceEventsConsumer) Collects latestchange eventsafter a moment in time, visible by thecurrent user.Implementations must call this
consumer's accept methodper change event sinceafterchronologically - this means older events first and newer events last.Implementers are advised to prefer using listeners in the application to record events as they occur with
ResourceEventStore.store(ResourceEvent...), which is the most reliable way to handle large volume of events. This method should be implemented in following cases:- Some changes can be queried in the application and cannot be captured using a listener.
- TRS implementation is started after the host application or can be disabled for a period of time, which makes some events not to be captured by listeners
CancellationExceptionto indicate the collecting process must stop, but implementations must no propagate this exception, this is a convenient way to stop a searching process.Default implementation throws
UnsupportedOperationException, as default implementation ofgetEventCollectorStrategy()is to returnNEVER. Applications overridinggetEventCollectorStrategy()must also override this method.- Parameters:
after- the reference time to search changed resources.trsExposedProjects- the collection of TRS exposed projectsresourceEventsConsumer- change events consumer.- Throws:
CompletionException- if consumer raise it to stop the collecting process due an error occurred.- Since:
- 4.0.0
-