Constructor and Description |
---|
JdbcFilterDao() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
afterPropertiesSet
|
void |
destroy() |
void |
flushActiveIpAddressListCache() |
protected InetAddress |
getActiveIPAddress(String rule,
String address) |
List<InetAddress> |
getActiveIPAddressList(String rule)
Get the (non-deleted) IP addresses that match the specified rule.
|
DatabaseSchemaConfig |
getDatabaseSchemaConfigFactory()
getDatabaseSchemaConfigFactory
|
DataSource |
getDataSource()
getDataSource
|
String |
getInterfaceWithServiceStatement(String rule)
getInterfaceWithServiceStatement
|
List<InetAddress> |
getIPAddressList(String rule)
Get the IP addresses (including deleted) that match the specified rule.
|
Map<InetAddress,Set<String>> |
getIPAddressServiceMap(String rule)
getIPServiceMap
|
String |
getIPServiceMappingStatement(String rule)
getIPServiceMappingStatement
|
SortedMap<Integer,String> |
getNodeMap(String rule)
This method returns a map of all node IDs and node labels that match
the rule that is passed in, sorted by node ID.
|
String |
getNodeMappingStatement(String rule)
getNodeMappingStatement
|
protected String |
getSQLStatement(String rule)
This method parses a rule and returns the SQL select statement equivalent
of the rule.
|
protected String |
getSQLStatement(String rule,
long nodeId,
String ipaddr,
String service)
This method should be called if you want to put constraints on the node,
interface or service that is returned in the rule.
|
boolean |
isRuleMatching(String rule)
Does this rule match anything in the database? In particular, does it
return at least one record from the database?
|
boolean |
isValid(String addr,
String rule)
isValid
|
void |
setDatabaseSchemaConfigFactory(DatabaseSchemaConfig factory)
setDatabaseSchemaConfigFactory
|
void |
setDataSource(DataSource dataSource)
setDataSource
|
void |
validateRule(String rule)
validateRule
|
public void setDataSource(DataSource dataSource)
setDataSource
dataSource
- a DataSource
object.public DataSource getDataSource()
getDataSource
DataSource
object.public void setDatabaseSchemaConfigFactory(DatabaseSchemaConfig factory)
setDatabaseSchemaConfigFactory
factory
- a DatabaseSchemaConfigFactory
object.public DatabaseSchemaConfig getDatabaseSchemaConfigFactory()
getDatabaseSchemaConfigFactory
DatabaseSchemaConfigFactory
object.public void afterPropertiesSet()
afterPropertiesSet
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
@PreDestroy @Transactional(propagation=NOT_SUPPORTED) public void destroy() throws Exception
Exception
public SortedMap<Integer,String> getNodeMap(String rule) throws FilterParseException
getNodeMap
in interface FilterDao
rule
- an expression rule to be parsed and executed.FilterParseException
- if a rule is syntactically incorrect or failed in
executing the SQL statementpublic Map<InetAddress,Set<String>> getIPAddressServiceMap(String rule) throws FilterParseException
getIPServiceMap
getIPAddressServiceMap
in interface FilterDao
rule
- a String
object.Map
object.FilterParseException
- if any.@CacheEvict(value="activeIpAddressList", allEntries=true) public void flushActiveIpAddressListCache()
flushActiveIpAddressListCache
in interface FilterDao
@Cacheable(value="activeIpAddressList") public List<InetAddress> getActiveIPAddressList(String rule) throws FilterParseException
getActiveIPAddressList
in interface FilterDao
rule
- the filter ruleList
of IP addresses.FilterParseException
- if a rule is syntactically incorrect or failed in executing the SQL statement.protected InetAddress getActiveIPAddress(String rule, String address)
public List<InetAddress> getIPAddressList(String rule) throws FilterParseException
getIPAddressList
in interface FilterDao
rule
- the filter ruleList
of IP addresses.FilterParseException
- if a rule is syntactically incorrect or failed in executing the SQL statement.public boolean isValid(String addr, String rule) throws FilterParseException
isValid
This method verifies if an ip address adheres to a given rule.isValid
in interface FilterDao
addr
- a String
object.rule
- a String
object.FilterParseException
- if a rule is syntactically incorrect or failed in
executing the SQL statement.public boolean isRuleMatching(String rule) throws FilterParseException
isRuleMatching
in interface FilterDao
rule
- rule to match onFilterParseException
- if any.public void validateRule(String rule) throws FilterParseException
validateRule
validateRule
in interface FilterDao
rule
- a String
object.FilterParseException
- if any.public String getNodeMappingStatement(String rule) throws FilterParseException
getNodeMappingStatement
rule
- a String
object.String
object.FilterParseException
- if any.public String getIPServiceMappingStatement(String rule) throws FilterParseException
getIPServiceMappingStatement
rule
- a String
object.String
object.FilterParseException
- if any.public String getInterfaceWithServiceStatement(String rule) throws FilterParseException
getInterfaceWithServiceStatement
rule
- a String
object.String
object.FilterParseException
- if any.protected String getSQLStatement(String rule) throws FilterParseException
rule
- a String
object.FilterParseException
- if any.protected String getSQLStatement(String rule, long nodeId, String ipaddr, String service) throws FilterParseException
nodeId
- a node id to constrain againstipaddr
- an ipaddress to constrain againstservice
- a service name to constrain againstrule
- a String
object.String
object.FilterParseException
- if any.Copyright © 2020. All rights reserved.