public MeasuredValueList getMeasuredValueListRest( MeasureDescriptor md, MeasuredValueFilter filter) throws MonitorException { // Find the data to create the URL String url; nodedirectory nd = db.get( nodedirectory.class, md.getMeasurementTypeId().substring(0, md.getMeasurementTypeId().indexOf(".measure"))); VEEReplica rep; if (nd == null || (nd.getTipo() != nodedirectory.TYPE_REPLICA && nd.getTipo() != nodedirectory.TYPE_NIC)) return new MeasuredValueList(md); String path; if (nd.getTipo() == nodedirectory.TYPE_REPLICA) { path = URICreation.getURIVEEReplica(md.getMeasurementTypeId()); rep = db.get(VEEReplica.class, nd.getInternalNodeId()); } else if (nd.getTipo() == nodedirectory.TYPE_NIC) { path = URICreation.getURIHwItem(md.getMeasurementTypeId()); path = translateNetInfrastructureId(path, nd.getFqnString()); rep = db.get( VEEReplica.class, nd.getFqnString().substring(0, md.getMeasurementTypeId().indexOf(".network"))); } else { return new MeasuredValueList(md); } if (rep.getDeployedOn() == null) return new MeasuredValueList(md); else { url = "http://" + rep.getDeployedOn().getHost() + ":" + rep.getDeployedOn().getPort() + path + URICreation.MONITOR + "/" + md.getName() + URICreation.VALUES; // Get the measures return restClient.getReplicaMeasure(url, filter, md); } }
public String[] getElementAndHref( String orgName, String vdcName, List<String> vappNames, String hwItem, String networkName) { String element; String href = ""; if (vappNames != null) { if (networkName != null) element = URICreation.getNetworkFQN(orgName, vdcName, networkName); else { if (hwItem != null) { if (hwItem.contains("networks_")) { element = URICreation.getFQN(orgName, vdcName, vappNames) + "." + URICreation.FQN_SEPARATOR_NET + "." + hwItem.substring(hwItem.indexOf('_') + 1); } else { element = URICreation.getFQN(orgName, vdcName, vappNames, hwItem); } href = URICreation.getURIVEEReplica(element) + "/hw/" + hwItem; } else { element = URICreation.getFQN(orgName, vdcName, vappNames); if (vappNames.size() == 1) { href = URICreation.getURIService(element); } else if (vappNames.size() == 2) { href = URICreation.getURIVapp(element); } else if (vappNames.size() == 3) { href = URICreation.getURIVEEReplica(element); } } } } else { element = URICreation.getFQN(orgName, vdcName); href = URICreation.getURIVDC(element); } return new String[] {element, href}; }