public AddressSnmpConfigVisitor(final InetAddress addr, final String location) { m_address = addr; m_location = LocationUtils.getEffectiveLocationName(location); }
private void handleMatch() { if (LocationUtils.isDefaultLocationName(m_currentLocation)) { m_matchedDefinitionAtDefaultLocation = m_currentDefinition; } if (m_location.equals(m_currentLocation)) { m_matchedDefinitionAtGivenLocation = m_currentDefinition; } }
public Key(String location, InetAddress ipAddress) { // Use the default location when location is null this.location = LocationUtils.getEffectiveLocationName(location); this.ipAddress = Objects.requireNonNull(ipAddress); }
private boolean shouldTryToMatch() { if (LocationUtils.isDefaultLocationName(m_currentLocation)) { // We're currently processing a definition at the default location, // try to match if we don't already have a definition here return m_matchedDefinitionAtDefaultLocation == null; } else if (m_location.equals(m_currentLocation)) { // We're currently processing a definition at the target location, // try to match if we don't already have a definition here return m_matchedDefinitionAtGivenLocation == null; } else { // We're not interested in definitions at this location return false; } }
/** * Returns <b>true</b> if the given location name is <b>null</b>, an empty string, * or the system default. * * @param locationName * @return */ public static boolean isDefaultLocationName(String locationName) { return DEFAULT_LOCATION_NAME.equals(getEffectiveLocationName(locationName)); }
@Override public void visitDefinition(final Definition definition) { //LOG.debug("visitDefinition: {}", definition); m_currentDefinition = definition; m_currentLocation = LocationUtils.getEffectiveLocationName(definition.getLocation()); }