Class TrsFeedManager
TrsFeedController registering, see registerFeedController(TrsFeedController).- Since:
- 3.3.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAborts a running/completed process.Concludes a completed process.Fetches a running or completed process.fetchStatus(String process, String feed) Fetches a running or completed process status.forceUpdate(String feed, Set<String> projectAreasScope, String user) Starts aforce updateprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.Gets all project areas that are currently exposed in the TRS Process feed.getFeedController(String feedIdentifer) Gets theTrsFeedControllerfor a managed TRS feed.protected abstract URIgetFeedEndpoint(TrsFeed feed) Gets aTrsFeedendpoint.getFeedProjectAreas(String feed) Gets theexposed project areaswith the number of resources on a given feed.getFeeds()Gets every managedTrsFeed.getFunctionalUser(boolean includeBoundConsumersCount) Gets the TRS functional user.static TrsFeedManagerGets theTrsFeedManagersingleton instance.booleanisExposedProjectArea(String projectAreaId) Determines whether the given project is currently exposed in the TRS Process feed.protected booleanisProjectArea(ResourceSeed resourceSeed) Determines whether the given resource seed represents aproject area.voidpopulateRootServices(RootServices rootServices) Populates aRootServicesresource with registered TRS feeds.Starts arebuildprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.final voidregisterFeedController(TrsFeedController trsFeedController) Registers a TRS feed controller.voidRemoves the current TRS functional user.Starts arepairprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.setFunctionalUser(String identifier) Sets the TRS functional user.static voidsetInstance(TrsFeedManager trsFeedManager) Sets theTrsFeedManagersingleton instance.Starts avalidationprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.
-
Constructor Details
-
TrsFeedManager
public TrsFeedManager()
-
-
Method Details
-
setInstance
Sets theTrsFeedManagersingleton instance.- Parameters:
trsFeedManager- theTrsFeedManagerto use.
-
getInstance
Gets theTrsFeedManagersingleton instance.- Returns:
- the
TrsFeedManagersingleton instance. - See Also:
-
registerFeedController
Registers a TRS feed controller. A TrsFeedController must be registered before any call on theTrsAdminServiceor before anyTrsServiceusing it is registered. Typically, aTrsFeedControllermust be registered during the application initialization phase after theTrsFeedManageris configured.If the
collector strategyof the feed controller is to always collect resource events or to collect them specifically at startup time, a background thread is started toquerychanges that occurred in the host application since the last TRS refresh, provided TRS content is yet computed.- Parameters:
trsFeedController- the TRS feed controller.
-
getFeedController
Gets theTrsFeedControllerfor a managed TRS feed.- Parameters:
feedIdentifer- the TRS feed identifier.- Returns:
- the TRS feed controller.
- Throws:
MissingTrsFeedException- if there are no TRS feed identified by feedIdentifier.
-
getFeeds
Gets every managedTrsFeed.- Returns:
- a collection of
TrsFeed.
-
populateRootServices
Populates aRootServicesresource with registered TRS feeds.- Parameters:
rootServices- theRootServicesresource to populate.
-
getFeedEndpoint
Gets aTrsFeedendpoint. -
getFunctionalUser
public Person getFunctionalUser(boolean includeBoundConsumersCount) throws MissingTrsFunctionalUserException, UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException Gets the TRS functional user.- Parameters:
includeBoundConsumersCount- whether or not to include the bound consumers count.- Returns:
- the TRS functional user as an OSLC
Person. - Throws:
MissingTrsFunctionalUserException- if the TRS functional user is not set.UnresolvedTrsFunctionalUserException- if the TRS functional user can't be resolved.TrsFunctionalUserStoreException- if an error prevents getting the TRS functional user.
-
setFunctionalUser
public Person setFunctionalUser(String identifier) throws UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException Sets the TRS functional user. Internally verify the user withPersonStore.getInstance().getPerson(identifier).- Parameters:
identifier- the identifier of the TRS functional user to set.- Returns:
- the new TRS functional user as an OSLC Person.
- Throws:
UnresolvedTrsFunctionalUserException- if the TRS functional user can't be resolved.TrsFunctionalUserStoreException- if an error prevents setting the TRS functional user.
-
removeFunctionalUser
Removes the current TRS functional user.- Throws:
TrsFunctionalUserStoreException- if an error prevents the TRS functional user removal.
-
getExposedProjectAreas
public Collection<ProjectArea> getExposedProjectAreas() throws ProjectAreaStoreException, TrsStoreExceptionGets all project areas that are currently exposed in the TRS Process feed. This method is notably useful to determine what should be replied when getting theAccessContextListresource.This method returns a snapshot of the Process feed current content. Be aware that a project area having project associations is not part of the returned list if no repair process (including the TRS job) has been completed since then to incorporate the project in the feed. The
ProjectAreaStore.getAccessibleOslcProjectAreas()method may be used to know which project areas must eventually be part of the Process feed- Returns:
- all the project areas exposed to TRS feeds.
- Throws:
ProjectAreaStoreException- if project areas cannot be resolved.TrsStoreException- if an error prevents accessing the TRS store.- Since:
- 4.0.0
-
isExposedProjectArea
Determines whether the given project is currently exposed in the TRS Process feed.- Parameters:
projectAreaId- the project identifier.- Returns:
trueif the project is present in Process feed- Throws:
TrsStoreException- if an error prevents accessing the TRS store.- Since:
- 3.11.0
-
validate
public TrsProcess validate(String feed, Set<String> projectAreasScope, String user) throws MissingTrsFeedException, MissingTrsFunctionalUserException, UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException, ConcurrentTrsProcessException, TrsStoreException, ProjectAreaStoreException Starts avalidationprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.- Parameters:
feed- the target feed identifier.projectAreasScope- optional subset of project areas to validate. Use an empty set to validate all exposed project areas.user- the executing user, typically the logged-in user.- Returns:
- the validation created process or the previously created process, for the same feed, if one was already running/completed.
- Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.MissingTrsFunctionalUserException- if the functional user is not set.UnresolvedTrsFunctionalUserException- if the functional user is not known.TrsFunctionalUserStoreException- if the functional user cannot be resolved.ConcurrentTrsProcessException- if another process is already running.TrsStoreException- if the lock cannot be acquired to avoid concurrency.ProjectAreaStoreException- if the exposed project areas cannot be resolved.- Since:
- 3.11.0
-
repair
public TrsProcess repair(String feed, Set<String> projectAreasScope, String user) throws MissingTrsFeedException, MissingTrsFunctionalUserException, UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException, ConcurrentTrsProcessException, TrsStoreException, ProjectAreaStoreException Starts arepairprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.Note: if the feed is not build by the moment this method is called, a rebuild process is started instead.
- Parameters:
feed- the target feed identifier.projectAreasScope- optional subset of project areas to repair. Use an empty set to validate all exposed project areas.user- the executing user, typically the logged-in user.- Returns:
- the repair created process or the previously created process, for the same feed, if one was already running/completed.
- Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.MissingTrsFunctionalUserException- if the functional user is not set.UnresolvedTrsFunctionalUserException- if the functional user is not known.TrsFunctionalUserStoreException- if the functional user cannot be resolved.ConcurrentTrsProcessException- if another process is already running.TrsStoreException- if the lock cannot be acquired to avoid concurrency.ProjectAreaStoreException- if the exposed project areas cannot be resolved.- Since:
- 3.11.0
-
forceUpdate
public TrsProcess forceUpdate(String feed, Set<String> projectAreasScope, String user) throws MissingTrsFeedException, MissingTrsFunctionalUserException, UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException, ConcurrentTrsProcessException, TrsStoreException, ProjectAreaStoreException Starts aforce updateprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.- Parameters:
feed- the target feed identifier.projectAreasScope- the project areas to force update.user- the executing user, typically the logged-in user.- Returns:
- the force update created process or the previously created process, for the same feed, if one was already running/completed.
- Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.MissingTrsFunctionalUserException- if the functional user is not set.UnresolvedTrsFunctionalUserException- if the functional user is not known.TrsFunctionalUserStoreException- if the functional user cannot be resolved.ConcurrentTrsProcessException- if another process is already running.TrsStoreException- if the lock cannot be acquired to avoid concurrency.ProjectAreaStoreException- if the exposed project areas cannot be resolved.- Since:
- 3.11.0
-
rebuild
public TrsProcess rebuild(String feed, String user) throws MissingTrsFeedException, MissingTrsFunctionalUserException, UnresolvedTrsFunctionalUserException, TrsFunctionalUserStoreException, ConcurrentTrsProcessException, TrsStoreException, ProjectAreaStoreException Starts arebuildprocess, on a separate thread, for a given feed if no other process is already running (or completed) for the same target feed.- Parameters:
feed- the target feed identifier.user- the executing user, typically the logged-in user.- Returns:
- the rebuilding created process or the previously created process, for the same feed, if one was already running/completed.
- Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.MissingTrsFunctionalUserException- if the functional user is not set.UnresolvedTrsFunctionalUserException- if the functional user is not known.TrsFunctionalUserStoreException- if the functional user cannot be resolved.ConcurrentTrsProcessException- if another process is already running.TrsStoreException- if the lock cannot be acquired to avoid concurrency.ProjectAreaStoreException- if the exposed project areas cannot be resolved.- Since:
- 3.11.0
-
fetch
Fetches a running or completed process.- Parameters:
process- the process identifier to fetch.feed- the owner feed.- Returns:
- an empty
Optionalif no process exists; the contained reference otherwise. - Throws:
MissingTrsFeedException- if nofeedexists.- Since:
- 3.11.0
-
fetchStatus
public Optional<TrsProcessStatus> fetchStatus(String process, String feed) throws MissingTrsFeedException Fetches a running or completed process status.This method is convenient to get only the part of the process that is changing over time.
- Parameters:
process- the process identifier to fetch.feed- the owner feed.- Returns:
- an empty
Optionalif no process exists; the contained status reference otherwise. - Throws:
MissingTrsFeedException- if nofeedexists.- Since:
- 3.12.0
-
abort
public Optional<TrsProcess> abort(String process, String feed, String user) throws MissingTrsFeedException, TrsStoreException Aborts a running/completed process.- Parameters:
process- the process id to abort.feed- the feed identifier.user- the executing user, typically the logged-in user.- Returns:
- an empty
Optionalif no process exists; the contained reference of the aborted process otherwise. - Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.TrsStoreException- if the lock cannot be acquired to avoid concurrency.- Since:
- 3.11.0
-
conclude
public Optional<TrsProcess> conclude(String process, String feed, String user) throws MissingTrsFeedException, TrsStoreException Concludes a completed process.- Parameters:
process- the completed process id to conclude.feed- the feed identifier.user- the executing user, typically the logged-in user.- Returns:
- an empty
Optionalif no process exists; the contained reference of the concluded process otherwise. - Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.TrsStoreException- if the lock cannot be acquired to avoid concurrency.- Since:
- 3.11.0
-
getFeedProjectAreas
public Collection<ProjectArea> getFeedProjectAreas(String feed) throws MissingTrsFeedException, ProjectAreaStoreException, TrsStoreException Gets theexposed project areaswith the number of resources on a given feed.- Parameters:
feed- the given feed identifier.- Returns:
- the exposed project areas with the corresponding number of resources on the given feed.
- Throws:
MissingTrsFeedException- if no feed is registered withfeedidentifier.ProjectAreaStoreException- if project areas cannot be resolved.TrsStoreException- if members cannot be counted.- Since:
- 4.0.0
-
isProjectArea
Determines whether the given resource seed represents aproject area.Default implementation returns
trueif the resource seed has aproject area idthat is equal to itsid. Subclasses may override this method if a different strategy should apply.- Parameters:
resourceSeed- a resource seed- Returns:
trueif the resource seed represents a project area,falseotherwise- Since:
- 3.11.0
-