本文整理汇总了Java中org.opennms.core.utils.IPLike.matches方法的典型用法代码示例。如果您正苦于以下问题:Java IPLike.matches方法的具体用法?Java IPLike.matches怎么用?Java IPLike.matches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.core.utils.IPLike
的用法示例。
在下文中一共展示了IPLike.matches方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isIpBlackListed
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
public Boolean isIpBlackListed(String ipAddress) {
for (String blackedIp : ipBlackList) {
if (IPLike.matches(ipAddress, blackedIp)) {
LOGGER.debug("IpAddress Black: {} \t vs \t {} \t OK", ipAddress, blackedIp);
return true;
} else {
LOGGER.debug("IpAddress Black: {} \t vs \t {} \t no", ipAddress, blackedIp);
}
}
return false;
}
示例2: isIpWhiteListed
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
public Boolean isIpWhiteListed(String ipAddress) {
for (String whiteIp : ipWhiteList) {
if (IPLike.matches(ipAddress, whiteIp)) {
LOGGER.debug("IpAddress White: {} \t vs \t {} \t OK", ipAddress, whiteIp);
return true;
} else {
LOGGER.debug("IpAddress White: {} \t vs \t {} \t no", ipAddress, whiteIp);
}
}
return false;
}
示例3: addIpWhite
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
public void addIpWhite(String ip) {
try {
//This check forces valid IPLike syntax
IPLike.matches("1.1.1.1", ip);
ipWhiteList.add(ip);
} catch (Exception ex) {
LOGGER.error("WhiteList rejected illegal entry {}", ip, ex);
}
}
示例4: addIpBlack
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
public void addIpBlack(String ip) {
try {
//This check forces valid IPLike syntax
IPLike.matches("1.1.1.1", ip);
ipBlackList.add(ip);
} catch (Exception ex) {
LOGGER.error("BlackList rejected illegal entry {}", ip, ex);
}
}
示例5: validateIPMatch
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
/**
* <p>validateIPMatch</p>
*
* @param ip a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean validateIPMatch(String ip){
if(IPLike.matches(m_address, ip)){
return m_isSupported;
}else{
return false;
}
}
示例6: isProtocolSupported
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean isProtocolSupported(InetAddress address, Map<String, Object> qualifiers) {
if (qualifiers == null) {
return false;
}
String ipMatch = getIpMatch(qualifiers);
if (IPLike.matches(InetAddressUtils.str(address), ipMatch)) {
return isSupported(qualifiers);
} else {
return false;
}
}
示例7: getAgentConfig
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
/**
* <p>getAgentConfig</p>
*
* @param agentInetAddress a {@link java.net.InetAddress} object.
* @return a {@link org.opennms.protocols.nsclient.NSClientAgentConfig} object.
*/
public NSClientAgentConfig getAgentConfig(final InetAddress agentInetAddress) {
getReadLock().lock();
try {
if (m_config == null) {
return new NSClientAgentConfig(agentInetAddress);
}
final NSClientAgentConfig agentConfig = new NSClientAgentConfig(agentInetAddress);
//Now set the defaults from the m_config
setNSClientAgentConfig(agentConfig, new Definition());
// Attempt to locate the node
DEFLOOP: for (final Definition def : m_config.getDefinitionCollection()) {
// check the specifics first
for (final String saddr : def.getSpecificCollection()) {
final InetAddress addr = InetAddressUtils.addr(saddr);
if (addr.equals(agentConfig.getAddress())) {
setNSClientAgentConfig(agentConfig, def);
break DEFLOOP;
}
}
// check the ranges
//
for (final Range rng : def.getRangeCollection()) {
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress()), rng.getBegin(), rng.getEnd())) {
setNSClientAgentConfig(agentConfig, def);
break DEFLOOP;
}
}
// check the matching IP expressions
for (final String ipMatch : def.getIpMatchCollection()) {
if (IPLike.matches(InetAddressUtils.str(agentInetAddress), ipMatch)) {
setNSClientAgentConfig(agentConfig, def);
break DEFLOOP;
}
}
} // end DEFLOOP
if (agentConfig == null) {
setNSClientAgentConfig(agentConfig, new Definition());
}
return agentConfig;
} finally {
getReadLock().unlock();
}
}
示例8: getAgentConfig
import org.opennms.core.utils.IPLike; //导入方法依赖的package包/类
/**
* <p>getAgentConfig</p>
*
* @param agentInetAddress a {@link java.net.InetAddress} object.
* @return a {@link org.opennms.protocols.ami.AmiAgentConfig} object.
*/
public AmiAgentConfig getAgentConfig(final InetAddress agentInetAddress) {
getReadLock().lock();
try {
if (m_config == null) return new AmiAgentConfig(agentInetAddress);
final AmiAgentConfig agentConfig = new AmiAgentConfig(agentInetAddress);
//Now set the defaults from the m_config
setAmiAgentConfig(agentConfig, new Definition());
// Attempt to locate the node
DEFLOOP: for (final Definition def : m_config.getDefinitionCollection()) {
// check the specifics first
for (String saddr : def.getSpecificCollection()) {
saddr = saddr.trim();
final InetAddress addr = InetAddressUtils.addr(saddr);
if (addr.equals(agentConfig.getAddress())) {
setAmiAgentConfig(agentConfig, def);
break DEFLOOP;
}
}
// check the ranges
for (final Range rng : def.getRangeCollection()) {
if (InetAddressUtils.isInetAddressInRange(InetAddressUtils.str(agentConfig.getAddress()), rng.getBegin(), rng.getEnd())) {
setAmiAgentConfig(agentConfig, def );
break DEFLOOP;
}
}
// check the matching IP expressions
for (final String ipMatch : def.getIpMatchCollection()) {
if (IPLike.matches(InetAddressUtils.str(agentInetAddress), ipMatch)) {
setAmiAgentConfig(agentConfig, def);
break DEFLOOP;
}
}
} // end DEFLOOP
if (agentConfig == null) setAmiAgentConfig(agentConfig, new Definition());
return agentConfig;
} finally {
getReadLock().unlock();
}
}