當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。