public interface ValidationPolicyConfig extends Config
This is the common supertype for both connection and subscription validation policies.
Modifier and Type | Interface and Description |
---|---|
static class |
ValidationPolicyConfig.Type
Policy type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAddress(String address)
Add an address.
|
boolean |
addHostName(String hostName)
Add a host name.
|
ValidationPolicyLocaleConfig |
addLocale(String country,
String language)
Adds a Locale to the policy.
|
boolean |
addResolvedName(String resolvedName)
Add a resolved name.
|
List<String> |
getAddresses()
Get list of configured addresses.
|
List<String> |
getHostNames()
Get list of configured host names
|
List<ValidationPolicyLocaleConfig> |
getLocales()
Returns a list of the configured locales.
|
String |
getName()
Gets the policy name.
|
List<String> |
getResolvedNames()
Get list of resolved names.
|
ValidationPolicyConfig.Type |
getType()
Gets the policy type.
|
boolean |
hasHostNames() |
boolean |
hasLocales()
Indicates whether any locales have been defined.
|
boolean |
hasResolvedNames()
Returns true if any resolved names have been defined.
|
boolean |
isAutomatic()
Is automatic option set?
|
boolean |
isConnection()
Is this a
ConnectionValidationPolicyConfig . |
boolean |
isSubscription()
Is this a
SubscriptionValidationPolicyConfig . |
void |
removeAddresses()
Remove all addresses.
|
void |
removeHostNames()
Remove all host names.
|
void |
removeLocales()
Remove all locales from the configuration.
|
void |
removeResolvedNames()
Remove all resolved names.
|
void |
setAutomatic(boolean automatic)
Sets automatic option.
|
void |
setType(ValidationPolicyConfig.Type type)
Sets the policy type.
|
boolean |
validate(String address,
String hostName,
String resolvedName,
Locale locale)
Check to see if the supplied details are valid for this policy.
|
String getName()
boolean isSubscription()
SubscriptionValidationPolicyConfig
.boolean isConnection()
ConnectionValidationPolicyConfig
.void setType(ValidationPolicyConfig.Type type)
The default is ValidationPolicyConfig.Type.BLACKLIST
but this may be used to change it.
type
- the policy typeValidationPolicyConfig.Type getType()
void setAutomatic(boolean automatic)
Policies which are set to automatic are applied by Diffusion and the publishers do not need to perform any checks themselves. If this attribute is set to false, then the policy is not applied unless it is done so manually by the publisher.
By default this is true.
automatic
- false to set manualboolean isAutomatic()
List<String> getAddresses()
Each address is an IP address (or regex) to match against a client.
boolean addAddress(String address)
address
- the addressvoid removeAddresses()
List<String> getHostNames()
Each name is a hostname (or regex) of a client.
boolean addHostName(String hostName)
hostName
- the host nameboolean hasHostNames()
void removeHostNames()
List<String> getResolvedNames()
Each name is the resolved hostname (or regex) of a client, as returned by the WhoIs service.
boolean addResolvedName(String resolvedName)
resolvedName
- the resolved nameboolean hasResolvedNames()
void removeResolvedNames()
ValidationPolicyLocaleConfig addLocale(String country, String language) throws ConfigException
Either a country or a language , or both must be specified.
country
- the country code or null if not to be checkedlanguage
- the language code or null if not to be checkedConfigException
- if unable to add localeList<ValidationPolicyLocaleConfig> getLocales()
boolean hasLocales()
void removeLocales()
boolean validate(String address, String hostName, String resolvedName, Locale locale)
Each parameter supplied is checked against the corresponding details of the policy.
In the case of a blacklist then false would be returned if any supplied information matches any policy information and true if there were no matches.
In the case of a whitelist then true would be returned if any supplied information matches any policy information or false if there were no matches.
address
- the address to check against the policy addresses - if
null then the address will not be checked.hostName
- the host name to check against the policy host names - if
null then the host name will not be checkedresolvedName
- the resolved name to check against the policy
resolved names - if null then the resolved name will no be checkedlocale
- The locale to check against the policy locale, if null then
locale check is not performed.Copyright © 2016 Push Technology Ltd. All Rights Reserved.