protected List discoverServices(ConfigResponse config) throws PluginException { List<ServiceResource> services = new ArrayList<ServiceResource>(); try { String proto = config.getValue("protocol"); String hostname = config.getValue("hostname"); int port = Integer.parseInt(config.getValue("port")); String path = DEFAULT_BMX_PATH + QUERY_BMX + VHOST_QUERY + "*"; URL bmxUrl = new URL(proto, hostname, port, path); BmxQuery query = new BmxQuery(bmxUrl); BmxResult result = query.getResult(); List<String> names = result.parseForNames(); for (Iterator<String> it = names.iterator(); it.hasNext(); ) { String name = it.next(); String type = getTypeInfo().getName() + " " + VHOST_SERVICE_TYPE; ServiceResource service = new ServiceResource(); String[] ent = name.split(","); if (ent[0].equals("Type=since-start")) { String host = ent[1].split("=")[1]; String servicePort = ent[2].split("=")[1]; path = DEFAULT_BMX_PATH + QUERY_BMX + VHOST_QUERY + name; ConfigResponse cprops = new ConfigResponse(); cprops.setValue("protocol", proto); cprops.setValue("hostname", hostname); cprops.setValue("port", port); cprops.setValue("path", path); service.setProductConfig(cprops); service.setMeasurementConfig(); service.setType(type); service.setServiceName(host + ":" + servicePort); services.add(service); } } } catch (Exception e) { _log.debug("Exception" + e, e); return null; } return services; }