public String getUrl() throws MalformedURLException { final Map<String, Object> propertiesMap = new HashMap<>(); if (ipAddress != null) { // Create map to substitute url propertiesMap.put("ipaddr", InetAddressUtils.toUrlIpAddress(getIpAddress())); final String theUrl = PropertiesUtils.substitute(url, propertiesMap); return theUrl; } return url; }
public String getUrl() throws MalformedURLException { final Map<String, Object> propertiesMap = new HashMap<>(); if (ipAddress != null) { // Create map to substitute url propertiesMap.put("ipaddr", InetAddressUtils.toUrlIpAddress(getIpAddress())); final String theUrl = PropertiesUtils.substitute(url, propertiesMap); return theUrl; } return url; }
public boolean isLocalConnection() throws MalformedURLException { Objects.requireNonNull(getIpAddress()); Objects.requireNonNull(getPort()); // If we're trying to create a connection to a localhost address... if (getIpAddress().isLoopbackAddress()) { final String jmxPort = System.getProperty(JMX_PORT_SYSTEM_PROPERTY); // returns null if REMOTE JMX is enabled // ... and if the port matches the port of the current JVM... if (getPort().equals(jmxPort) || // ... or if remote JMX RMI is disabled and we're attempting to connect // to the default OpenNMS JMX port... (jmxPort == null && DEFAULT_OPENNMS_JMX_PORT.equals(getPort()))) { return true; } } return false; }
public boolean isLocalConnection() throws MalformedURLException { Objects.requireNonNull(getIpAddress()); Objects.requireNonNull(getPort()); // If we're trying to create a connection to a localhost address... if (getIpAddress().isLoopbackAddress()) { final String jmxPort = System.getProperty(JMX_PORT_SYSTEM_PROPERTY); // returns null if REMOTE JMX is enabled // ... and if the port matches the port of the current JVM... if (getPort().equals(jmxPort) || // ... or if remote JMX RMI is disabled and we're attempting to connect // to the default OpenNMS JMX port... (jmxPort == null && DEFAULT_OPENNMS_JMX_PORT.equals(getPort()))) { return true; } } return false; }