Package com.smartfoxserver.v2.util
Class SFSFloodFilter
- java.lang.Object
-
- com.smartfoxserver.v2.core.service.BaseCoreService
-
- com.smartfoxserver.v2.util.SFSFloodFilter
-
- All Implemented Interfaces:
com.smartfoxserver.bitswarm.service.IService
,com.smartfoxserver.v2.core.ICoreService
,IFloodFilter<SystemRequest>
public class SFSFloodFilter extends com.smartfoxserver.v2.core.service.BaseCoreService implements IFloodFilter<SystemRequest>
-
-
Constructor Summary
Constructors Constructor Description SFSFloodFilter(com.smartfoxserver.v2.entities.managers.IBannedUserManager manager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequestFilter(SystemRequest request, int reqPerSecond)
void
clearAllFilters()
void
filterRequest(SystemRequest reqType, User user)
int
getBanDurationMinutes()
java.lang.String
getBanMessage()
BanMode
getBanMode()
int
getMaxFloodingAttempts()
java.util.Map<SystemRequest,java.lang.Integer>
getRequestTable()
int
getSecondsBeforeBan()
void
init(java.lang.Object o)
Initialize serviceboolean
isLogFloodingAttempts()
boolean
isRequestFiltered(SystemRequest request)
void
setActive(boolean flag)
void
setBanDurationMinutes(int banDurationMinutes)
void
setBanMessage(java.lang.String banMessage)
void
setBanMode(BanMode banMode)
void
setLogFloodingAttempts(boolean logFloodingAttempts)
void
setMaxFloodingAttempts(int maxFloodingAttempts)
void
setSecondsBeforeBan(int secondsBeforeBan)
-
Methods inherited from class com.smartfoxserver.v2.core.service.BaseCoreService
destroy, getId, getName, handleMessage, isActive, setName, toString
-
-
-
-
Method Detail
-
init
public void init(java.lang.Object o)
Description copied from interface:com.smartfoxserver.bitswarm.service.IService
Initialize service- Specified by:
init
in interfacecom.smartfoxserver.bitswarm.service.IService
- Overrides:
init
in classcom.smartfoxserver.v2.core.service.BaseCoreService
- Parameters:
o
- custom parameters
-
filterRequest
public void filterRequest(SystemRequest reqType, User user) throws SFSFloodingException
- Specified by:
filterRequest
in interfaceIFloodFilter<SystemRequest>
- Throws:
SFSFloodingException
-
setActive
public void setActive(boolean flag)
- Specified by:
setActive
in interfaceIFloodFilter<SystemRequest>
-
addRequestFilter
public void addRequestFilter(SystemRequest request, int reqPerSecond)
- Specified by:
addRequestFilter
in interfaceIFloodFilter<SystemRequest>
-
getRequestTable
public java.util.Map<SystemRequest,java.lang.Integer> getRequestTable()
- Specified by:
getRequestTable
in interfaceIFloodFilter<SystemRequest>
-
clearAllFilters
public void clearAllFilters()
- Specified by:
clearAllFilters
in interfaceIFloodFilter<SystemRequest>
-
isRequestFiltered
public boolean isRequestFiltered(SystemRequest request)
- Specified by:
isRequestFiltered
in interfaceIFloodFilter<SystemRequest>
-
getBanDurationMinutes
public int getBanDurationMinutes()
- Specified by:
getBanDurationMinutes
in interfaceIFloodFilter<SystemRequest>
-
setBanDurationMinutes
public void setBanDurationMinutes(int banDurationMinutes)
- Specified by:
setBanDurationMinutes
in interfaceIFloodFilter<SystemRequest>
-
getMaxFloodingAttempts
public int getMaxFloodingAttempts()
- Specified by:
getMaxFloodingAttempts
in interfaceIFloodFilter<SystemRequest>
-
setMaxFloodingAttempts
public void setMaxFloodingAttempts(int maxFloodingAttempts)
- Specified by:
setMaxFloodingAttempts
in interfaceIFloodFilter<SystemRequest>
-
getSecondsBeforeBan
public int getSecondsBeforeBan()
- Specified by:
getSecondsBeforeBan
in interfaceIFloodFilter<SystemRequest>
-
setSecondsBeforeBan
public void setSecondsBeforeBan(int secondsBeforeBan)
- Specified by:
setSecondsBeforeBan
in interfaceIFloodFilter<SystemRequest>
-
isLogFloodingAttempts
public boolean isLogFloodingAttempts()
- Specified by:
isLogFloodingAttempts
in interfaceIFloodFilter<SystemRequest>
-
setLogFloodingAttempts
public void setLogFloodingAttempts(boolean logFloodingAttempts)
- Specified by:
setLogFloodingAttempts
in interfaceIFloodFilter<SystemRequest>
-
getBanMode
public BanMode getBanMode()
- Specified by:
getBanMode
in interfaceIFloodFilter<SystemRequest>
-
setBanMode
public void setBanMode(BanMode banMode)
- Specified by:
setBanMode
in interfaceIFloodFilter<SystemRequest>
-
getBanMessage
public java.lang.String getBanMessage()
- Specified by:
getBanMessage
in interfaceIFloodFilter<SystemRequest>
-
setBanMessage
public void setBanMessage(java.lang.String banMessage)
- Specified by:
setBanMessage
in interfaceIFloodFilter<SystemRequest>
-
-