use of org.opennms.netmgt.provision.support.DetectRequestImpl in project opennms by OpenNMS.
the class GenericJMXDetectorFactory method buildRequest.
@Override
public DetectRequest buildRequest(String location, InetAddress address, Integer port, Map<String, String> attributes) {
// in case port is null, but url is provided, the port is extracted from the url
if (port == null && attributes.containsKey("url")) {
try {
final JmxConnectionConfig config = JmxConnectionConfigBuilder.buildFrom(address, attributes).build();
port = new JMXServiceURL(config.getUrl()).getPort();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("url is not valid", e);
}
}
return new DetectRequestImpl(address, port, getRuntimeAttributes(address, port));
}
Aggregations