Package org.opensaml.profile.action.impl
Class PopulateMetricContext
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.profile.action.AbstractProfileAction
-
- org.opensaml.profile.action.impl.PopulateMetricContext
-
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
public class PopulateMetricContext extends AbstractProfileAction
An action that populates aMetricContext
child of theProfileRequestContext
with a set of rules for activating timer measurements and counters on associated objects during the execution of a profile request.Unlike a more typical "lookup strategy" design used in most other places, the strategy function supplied is free, and indeed expected, to directly manipulate the created child context directly rather than returning the data to use. The function may return false to indicate a lack of success, but this value is merely logged.
- Event:
EventIds.PROCEED_EVENT_ID
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
PopulateMetricContext.NullFunction
Default function to remove the context from the tree when no metrics are installed.
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
log
Class logger.private Function<ProfileRequestContext,Boolean>
metricStrategy
Strategy function for establishing metric mappings to apply.
-
Constructor Summary
Constructors Constructor Description PopulateMetricContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doExecute(ProfileRequestContext profileRequestContext)
protected void
doInitialize()
void
setMetricStrategy(Function<ProfileRequestContext,Boolean> strategy)
Set strategy to establish the metric mappings to use.-
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, doPreExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
metricStrategy
@NonnullAfterInit private Function<ProfileRequestContext,Boolean> metricStrategy
Strategy function for establishing metric mappings to apply.
-
-
Method Detail
-
setMetricStrategy
public void setMetricStrategy(@Nullable Function<ProfileRequestContext,Boolean> strategy)
Set strategy to establish the metric mappings to use.- Parameters:
strategy
- timer mapping strategy
-
doInitialize
protected void doInitialize() throws ComponentInitializationException
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)
- Overrides:
doExecute
in classAbstractProfileAction
-
-