当前位置: 首页>>代码示例>>Java>>正文


Java IPLike.matches方法代码示例

本文整理汇总了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;
}
 
开发者ID:OpenNMS,项目名称:opennms-provisioning-integration-server,代码行数:12,代码来源:InterfaceUtils.java

示例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;
}
 
开发者ID:OpenNMS,项目名称:opennms-provisioning-integration-server,代码行数:12,代码来源:InterfaceUtils.java

示例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);
    }
}
 
开发者ID:OpenNMS,项目名称:opennms-provisioning-integration-server,代码行数:10,代码来源:InterfaceUtils.java

示例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);
    }
}
 
开发者ID:OpenNMS,项目名称:opennms-provisioning-integration-server,代码行数:10,代码来源:InterfaceUtils.java

示例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;  
  }
    
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:LoopResponse.java

示例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;
    }
    
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:16,代码来源:LoopPlugin.java

示例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();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:60,代码来源:NSClientPeerFactory.java

示例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();
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:55,代码来源:AmiPeerFactory.java


注:本文中的org.opennms.core.utils.IPLike.matches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。