Package com.adobe.acs.commons.fam
Interface ActionManager
@ProviderType
public interface ActionManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(boolean useForce) Cancel all work scheduled using this action manager.voidForcefully terminate open resolvers, should only be performed by the factory If using withQueryResults or deferredWithResolvers, use addCleanupTask instead.voiddeferredWithResolver(CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> action) Perform action at some later time using a provided pooled resolverintintintList all failed actionsList all failed actions for mbean reportinggetName()intProvide statistics row for mbean reportingintbooleanHave all actions completed?voidonFailure(CheckedBiConsumer<List<Failure>, org.apache.sling.api.resource.ResourceResolver> failureTask) Register a handler to be fired when the work has completed and there was at least one error.voidRegister a handler to be fired when the work is completed, successfully or not.voidonSuccess(CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> successTask) Register a handler to be fired when the work has completed with no errors.voidsetCurrentItem(String item) Note the name or path of the item currently being processed This is particularly useful for error reportingintwithQueryResults(String queryStatement, String language, CheckedBiConsumer<org.apache.sling.api.resource.ResourceResolver, String> callback, CheckedBiFunction<org.apache.sling.api.resource.ResourceResolver, String, Boolean>... filters) Schedule an activity to occur for every node found by a given query.voidwithResolver(CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> action) Perform action right now using a provided pooled resolver
-
Method Details
-
withQueryResults
int withQueryResults(String queryStatement, String language, CheckedBiConsumer<org.apache.sling.api.resource.ResourceResolver, String> callback, CheckedBiFunction<org.apache.sling.api.resource.ResourceResolver, throws javax.jcr.RepositoryException, org.apache.sling.api.resource.PersistenceException, ExceptionString, Boolean>... filters) Schedule an activity to occur for every node found by a given query. Optionally, programmatic filters can be used to ignore query results that are not of interest to the activity. These filters can usually take on more complex logic perform faster than having the query engine do the same.- Parameters:
queryStatement- Query stringlanguage- Query language to usecallback- Callback action to perform for every query resultfilters- Optional filters return true if action should be taken- Returns:
- Count of items found in query
- Throws:
javax.jcr.RepositoryExceptionorg.apache.sling.api.resource.PersistenceExceptionException
-
deferredWithResolver
Perform action at some later time using a provided pooled resolver- Parameters:
action- Action to perform
-
withResolver
void withResolver(CheckedConsumer<org.apache.sling.api.resource.ResourceResolver> action) throws Exception Perform action right now using a provided pooled resolver- Parameters:
action- Action to perform- Throws:
Exception
-
cancel
void cancel(boolean useForce) Cancel all work scheduled using this action manager.- Parameters:
useForce- If true, forces active work to be interrupted.
-
onSuccess
Register a handler to be fired when the work has completed with no errors.- Parameters:
successTask-
-
onFailure
void onFailure(CheckedBiConsumer<List<Failure>, org.apache.sling.api.resource.ResourceResolver> failureTask) Register a handler to be fired when the work has completed and there was at least one error.- Parameters:
failureTask-
-
onFinish
Register a handler to be fired when the work is completed, successfully or not. Note: These handlers are called after the success/fail handlers.- Parameters:
finishHandler-
-
isComplete
boolean isComplete()Have all actions completed?- Returns:
- True if all scheduled work has been completed
-
closeAllResolvers
void closeAllResolvers()Forcefully terminate open resolvers, should only be performed by the factory If using withQueryResults or deferredWithResolvers, use addCleanupTask instead. -
getFailureList
List all failed actions- Returns:
- List of failures
-
getFailures
List all failed actions for mbean reporting- Returns:
- List of composite data for failures
- Throws:
OpenDataException
-
getStatistics
Provide statistics row for mbean reporting- Returns:
- Throws:
OpenDataException
-
setCurrentItem
Note the name or path of the item currently being processed This is particularly useful for error reporting- Parameters:
item- Item name or path being processed currently
-
getName
String getName()- Returns:
- The name set on this action manager at the time of its creation
-
getAddedCount
int getAddedCount()- Returns:
- The number of items of work added for processing.
-
getSuccessCount
int getSuccessCount()- Returns:
- The number of items of work that were successfully processed.
-
getErrorCount
int getErrorCount()- Returns:
- The number of items of work that were unsuccessfully processed.
-
getCompletedCount
int getCompletedCount()- Returns:
- The number of items of work that were processed.
-
getRemainingCount
int getRemainingCount()- Returns:
- The number of items of work that have been added but have not yet been processed.
-