Example usage for java.net URISyntaxException printStackTrace

List of usage examples for java.net URISyntaxException printStackTrace

Introduction

In this page you can find the example usage for java.net URISyntaxException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the number of CPUs of a node.
 *
 * @param nodeId Physical node identifier.
 *//*w ww. ja v a2s .c o m*/
public String getCPUNumber(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("cpunumber");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the performance of a single CPU at 100% of CPU utilisation.
 *
 * @param nodeId Physical node identifier.
 *///w  w w . j  a  va2  s .c om
public String getCPUPerformance(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("cpuperformance");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the performance of the node at 100% of CPU utilization.
 *
 * @param nodeId Physical node identifier.
 *///www.  ja va  2  s  . c  o  m
public String getMaxPerformance(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("performance");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the number of used CPUs in the node.
 *
 * @param nodeId Physical node identifier.
 *//*from w  w w.j  av a 2 s  .co  m*/
public String getNodeUsedCPUs(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("usedcpus");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the node minimum power.//from  ww w  .  j  a va2 s . co  m
 *
 * @param nodeId Physical node identifier.
 */
public String getPidle(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("pidle");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the node maximum power.// www.j a v  a 2 s.c o m
 *
 * @param nodeId Physical node identifier.
 */
public String getPMax(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("pmax");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the incremental power per CPU.
 *
 * @param nodeId Physical node identifier.
 *//*from   ww  w  .j av a 2 s  .  com*/
public String getPIncr(String nodeId) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path(nodeId).path("pincr");
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Returns the current eco-efficiency of an IP infrastructure
 *
 * @param type Type of eco-efficiency assessment: energy (energy?) or
 * ecological (ecological?) efficiency./*w  w  w. j a va 2  s .  c  o m*/
 * @return Eco-efficiency assessment of the IP.
 */
public String assessIPEcoEfficiency(String type) {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure")
                .path("assessecoefficiency");
        if (type != null) {
            resource = resource.queryParam("type", type);
        }
        ret = resource.type("text/plain").get(String.class);
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Assesses the eco-efficiency of a node. The IP is implicit, since it is
 * the one which owns the node and executes this method.
 *
 * @param nodeId Physical node identifier.
 * @param type Type of eco-efficiency assessment: energy (energy?) or
 * ecological (ecological?) efficiency.// www . ja  v a  2  s. co  m
 * @return Eco-efficiency evaluation of the node.
 */
public String assessNodeEcoEfficiency(String nodeId, String type) {
    String ret = null;
    try {
        if (nodeId != null) {
            WebResource resource = client.resource(this.getAddress()).path("infrastructure").path(nodeId)
                    .path("assessecoefficiency");
            if (type != null) {
                resource = resource.queryParam("type", type);
            }
            ret = resource.type("text/plain").get(String.class);
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}

From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientIP.java

/**
 * Evaluates the current eco-efficiency of a service.
 *
 * @param serviceId Evaluates the current eco-efficiency of a service.
 * @param type Type of eco-efficiency assessment: energy (energy?) or
 * ecological (ecological?) efficiency./*from   www .  j  a  v a2s.c om*/
 * @return Eco-efficiency evaluation of the service.
 */
public String assessServiceEcoEfficiency(String serviceId, String type) {
    String ret = null;
    try {
        if (serviceId != null) {
            WebResource resource = client.resource(this.getAddress()).path("service").path(serviceId)
                    .path("assessecoefficiency");
            if (type != null) {
                resource = resource.queryParam("type", type);
            }
            ret = resource.type(MediaType.TEXT_PLAIN).accept(MediaType.TEXT_PLAIN).get(String.class);
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ret;
}