Package org.swisspush.gateleen.qos
Class QoSRule
- java.lang.Object
-
- org.swisspush.gateleen.qos.QoSRule
-
public class QoSRule extends Object
Represents a rule for the QoS Handler.- Author:
- https://github.com/ljucam [Mario Ljuca]
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAction(String action)Adds an action.voidclearAction()Removes all actions for this rule.List<String>getActions()Returns a list of actions which hase to be performed.DoublegetReject()Returns the ratio which indicates if the request should be rejected or not.PatterngetUrlPattern()Returns a precompiled pattern for this rule.DoublegetWarn()Returns the ratio which indicates if the request should be logged with a warning or not.booleanperformAction()Indicates if an action has to be performed or not.voidremoveAction(String action)Removes the action.voidsetReject(Double reject)Sets the ratio which indicates if the request should be rejected or not.voidsetWarn(Double warn)Returns the ratio which indicates if the request should be logged with a warning or not.
-
-
-
Constructor Detail
-
QoSRule
public QoSRule(Pattern urlPattern)
Creates a new QoS rule object with the given pattern.- Parameters:
urlPattern- the url pattern for this rule
-
-
Method Detail
-
getReject
public Double getReject()
Returns the ratio which indicates if the request should be rejected or not.- Returns:
- the ratio
-
setReject
public void setReject(Double reject)
Sets the ratio which indicates if the request should be rejected or not.- Parameters:
reject- the ratio
-
getWarn
public Double getWarn()
Returns the ratio which indicates if the request should be logged with a warning or not.- Returns:
- the ratio
-
setWarn
public void setWarn(Double warn)
Returns the ratio which indicates if the request should be logged with a warning or not.- Parameters:
warn- the ratio
-
getUrlPattern
public Pattern getUrlPattern()
Returns a precompiled pattern for this rule.- Returns:
- precompiled pattern
-
performAction
public boolean performAction()
Indicates if an action has to be performed or not.- Returns:
- true if an action has to be performed, otherwise false
-
getActions
public List<String> getActions()
Returns a list of actions which hase to be performed.- Returns:
- a list of actions which have to be performed
-
addAction
public void addAction(String action)
Adds an action.- Parameters:
action- the action
-
removeAction
public void removeAction(String action)
Removes the action.- Parameters:
action- the action
-
clearAction
public void clearAction()
Removes all actions for this rule.
-
-