Package com.alibaba.druid.wall
Class WallProvider
- java.lang.Object
-
- com.alibaba.druid.wall.WallProvider
-
- Direct Known Subclasses:
CKWallProvider,DB2WallProvider,MySqlWallProvider,OracleWallProvider,PGWallProvider,SQLiteWallProvider,SQLServerWallProvider
public abstract class WallProvider extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWallProvider.WallCommentHandler
-
Field Summary
Fields Modifier and Type Field Description static intBLACK_SQL_MAX_SIZEprotected AtomicLongblackListHitCountprotected AtomicLongcheckCountWallDenyStatcommentDeniedStatprotected WallConfigconfigprotected DbTypedbTypeprotected AtomicLonghardCheckCountprotected AtomicLongsyntaxErrorCountprotected AtomicLongviolationCountprotected AtomicLongviolationEffectRowCountprotected AtomicLongwhiteListHitCount
-
Constructor Summary
Constructors Constructor Description WallProvider(WallConfig config)WallProvider(WallConfig config, DbType dbType)WallProvider(WallConfig config, String dbType)
-
Method Summary
-
-
-
Field Detail
-
BLACK_SQL_MAX_SIZE
public static final int BLACK_SQL_MAX_SIZE
- See Also:
- Constant Field Values
-
config
protected final WallConfig config
-
commentDeniedStat
public final WallDenyStat commentDeniedStat
-
dbType
protected DbType dbType
-
checkCount
protected final AtomicLong checkCount
-
hardCheckCount
protected final AtomicLong hardCheckCount
-
whiteListHitCount
protected final AtomicLong whiteListHitCount
-
blackListHitCount
protected final AtomicLong blackListHitCount
-
syntaxErrorCount
protected final AtomicLong syntaxErrorCount
-
violationCount
protected final AtomicLong violationCount
-
violationEffectRowCount
protected final AtomicLong violationEffectRowCount
-
-
Constructor Detail
-
WallProvider
public WallProvider(WallConfig config)
-
WallProvider
public WallProvider(WallConfig config, String dbType)
-
WallProvider
public WallProvider(WallConfig config, DbType dbType)
-
-
Method Detail
-
getName
public String getName()
-
setName
public void setName(String name)
-
reset
public void reset()
-
getTableStats
public ConcurrentMap<String,WallTableStat> getTableStats()
-
getFunctionStats
public ConcurrentMap<String,WallFunctionStat> getFunctionStats()
-
getSqlStat
public WallSqlStat getSqlStat(String sql)
-
getTableStat
public WallTableStat getTableStat(String tableName)
-
addUpdateCount
public void addUpdateCount(WallSqlStat sqlStat, long updateCount)
-
addFetchRowCount
public void addFetchRowCount(WallSqlStat sqlStat, long fetchRowCount)
-
getTableStatWithLowerName
public WallTableStat getTableStatWithLowerName(String lowerCaseName)
-
getFunctionStat
public WallFunctionStat getFunctionStat(String functionName)
-
getFunctionStatWithLowerName
public WallFunctionStat getFunctionStatWithLowerName(String lowerCaseName)
-
getConfig
public WallConfig getConfig()
-
addWhiteSql
public WallSqlStat addWhiteSql(String sql, Map<String,WallSqlTableStat> tableStats, Map<String,WallSqlFunctionStat> functionStats, boolean syntaxError)
-
addBlackSql
public WallSqlStat addBlackSql(String sql, Map<String,WallSqlTableStat> tableStats, Map<String,WallSqlFunctionStat> functionStats, List<Violation> violations, boolean syntaxError)
-
clearCache
public void clearCache()
-
clearWhiteList
public void clearWhiteList()
-
clearBlackList
public void clearBlackList()
-
getWhiteSql
public WallSqlStat getWhiteSql(String sql)
-
getBlackSql
public WallSqlStat getBlackSql(String sql)
-
whiteContains
public boolean whiteContains(String sql)
-
createParser
public abstract SQLStatementParser createParser(String sql)
-
createWallVisitor
public abstract WallVisitor createWallVisitor()
-
createExportParameterVisitor
public abstract ExportParameterVisitor createExportParameterVisitor()
-
checkValid
public boolean checkValid(String sql)
-
incrementCommentDeniedCount
public void incrementCommentDeniedCount()
-
checkDenyFunction
public boolean checkDenyFunction(String functionName)
-
checkDenySchema
public boolean checkDenySchema(String schemaName)
-
checkDenyTable
public boolean checkDenyTable(String tableName)
-
checkReadOnlyTable
public boolean checkReadOnlyTable(String tableName)
-
getCommentDenyStat
public WallDenyStat getCommentDenyStat()
-
check
public WallCheckResult check(String sql)
-
ispPrivileged
public static boolean ispPrivileged()
-
doPrivileged
public static <T> T doPrivileged(PrivilegedAction<T> action)
-
setTenantValue
public static void setTenantValue(Object value)
-
getTenantValue
public static Object getTenantValue()
-
getWhiteListHitCount
public long getWhiteListHitCount()
-
getBlackListHitCount
public long getBlackListHitCount()
-
getSyntaxErrorCount
public long getSyntaxErrorCount()
-
getCheckCount
public long getCheckCount()
-
getViolationCount
public long getViolationCount()
-
getHardCheckCount
public long getHardCheckCount()
-
getViolationEffectRowCount
public long getViolationEffectRowCount()
-
addViolationEffectRowCount
public void addViolationEffectRowCount(long rowCount)
-
getStatValue
public WallProviderStatValue getStatValue(boolean reset)
-
isWhiteListEnable
public boolean isWhiteListEnable()
-
setWhiteListEnable
public void setWhiteListEnable(boolean whiteListEnable)
-
isBlackListEnable
public boolean isBlackListEnable()
-
setBlackListEnable
public void setBlackListEnable(boolean blackListEnable)
-
-