public class AttemptsManagerDefault extends Object implements AttemptsManager
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository,
AttemptFactory attemptFactory,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig) |
| Modifier and Type | Method and Description |
|---|---|
Attempt |
attempt(String actionName,
AttemptCriteria... criterias)
Gets the current
Attempt, given the action to protect
and criterias. |
Attempt |
attempt(String actionName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Gets the current
Attempt, given the action to protect
and criterias. |
protected AttemptFactory |
getAttemptFactory() |
protected AttemptRule |
getAttemptRule(String actionName) |
Map<String,AttemptRule> |
getAttemptRulesByActionName()
Gets all the registered
AttemptRule rules,
by action names. |
protected SpincastAttemptsLimiterPluginConfig |
getSpincastAttemptsLimiterPluginConfig() |
protected SpincastAttemptsLimiterPluginRepository |
getSpincastAttemptsLimiterPluginRepository() |
void |
registerAttempRule(AttemptRule attemptRule)
Registers a
AttemptRule rule. |
void |
registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Creates and registers a
AttemptRule
rule from the required informations. |
@Inject public AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository, AttemptFactory attemptFactory, SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig)
protected SpincastAttemptsLimiterPluginRepository getSpincastAttemptsLimiterPluginRepository()
public Map<String,AttemptRule> getAttemptRulesByActionName()
AttemptsManagerAttemptRule rules,
by action names.getAttemptRulesByActionName in interface AttemptsManagerprotected AttemptRule getAttemptRule(String actionName)
protected AttemptFactory getAttemptFactory()
protected SpincastAttemptsLimiterPluginConfig getSpincastAttemptsLimiterPluginConfig()
public Attempt attempt(String actionName, AttemptCriteria... criterias)
AttemptsManagerAttempt, given the action to protect
and criterias. With this object you can:
Attempt.isMaxReached().
Attempt.incrementAttemptsCount(),
if you didn't let the {AttemptsManager.attempt(String, AttemptCriteria...)} method do
it automatically
(see SpincastAttemptsLimiterPluginConfig.getDefaultAttemptAutoIncrementType()).
attempt in interface AttemptsManagerpublic Attempt attempt(String actionName, AttemptsAutoIncrementType attemptsAutoIncrementType, AttemptCriteria... criterias)
AttemptsManagerAttempt, given the action to protect
and criterias. With this object you can:
Attempt.isMaxReached().
Attempt.incrementAttemptsCount(),
if you didn't let the {#attempt(String, AttemptAutoIncrementType, AttemptCriteria...))} method do
it automatically.
attempt in interface AttemptsManagerattemptsAutoIncrementType - Specifies if the method should increment the
number of attempts by itself. If you don't let it do it, you need to increment
the number of attempts by yourself, by calling Attempt.incrementAttemptsCount()
on the returned object.public void registerAttempRule(AttemptRule attemptRule)
AttemptsManagerAttemptRule rule.registerAttempRule in interface AttemptsManagerpublic void registerAttempRule(String actionName, int nbrMaxAttemptsPerDuration, Duration duration)
AttemptsManagerAttemptRule
rule from the required informations.registerAttempRule in interface AttemptsManagerCopyright © 2018. All rights reserved.