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

/**
 * Starts the automatic eco-assessment of a service.
 *
 * @param serviceId Service identifier./*  w  w  w. j  av a  2  s .  c  o m*/
 * @param timeout Timeout between successive eco-efficiency automatic
 * assessments. A default timeout value will be used if this parameter is
 * not specified.
 */
public void startServiceAssessment(String serviceId, Long timeout) {
    try {
        if (serviceId != null) {
            WebResource resource = client.resource(this.getAddress()).path("service").path(serviceId);
            if (timeout != null) {
                resource = resource.queryParam("timeout", timeout.toString());
            }
            resource.post();
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

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

/**
 * Specifies the minimum eco-efficiency thresholds at infrastructure level.
 * If any of them are surpassed, a proactive notification will be generated.
 * Note that setting a value of -1.0 to any of the thresholds will disable
 * them (separately)./*from  ww w  . j a v a2s.  c om*/
 * @param energyEfficiencyTH Energy efficiency threshold.
 * @param ecologicalEfficiencyTH Ecological efficiency threshold.
 */
public void setInfrastructureEcoThreshold(Double energyEfficiencyTH, Double ecologicalEfficiencyTH) {
    try {
        WebResource resource = client.resource(this.getAddress()).path("proactive/infrastructure/setth");
        if (energyEfficiencyTH != null) {
            resource = resource.queryParam("enEffTH", energyEfficiencyTH.toString());
        }
        if (ecologicalEfficiencyTH != null) {
            resource = resource.queryParam("ecoEffTH", ecologicalEfficiencyTH.toString());
        }
        resource.post();
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

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

/**
 * Specifies the minimum eco-efficiency thresholds at node level.
 * If any of them are surpassed, a proactive notification will be generated.
 * Note that setting a value of -1.0 to any of the thresholds will disable
 * them (separately)./*from ww w .  jav  a 2s .  com*/
 * @param nodeId Node identifier.
 * @param energyEfficiencyTH Energy efficiency threshold.
 * @param ecologicalEfficiencyTH Ecological efficiency threshold.
 */
public void setNodeEcoThreshold(String nodeId, Double energyEfficiencyTH, Double ecologicalEfficiencyTH) {
    try {
        if (nodeId != null) {
            WebResource resource = client.resource(this.getAddress()).path("proactive/node").path(nodeId)
                    .path("setth");
            if (energyEfficiencyTH != null) {
                resource = resource.queryParam("enEffTH", energyEfficiencyTH.toString());
            }
            if (ecologicalEfficiencyTH != null) {
                resource = resource.queryParam("ecoEffTH", ecologicalEfficiencyTH.toString());
            }
            resource.post();
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

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

/**
 * Specifies the minimum eco-efficiency thresholds at service level.
 * If any of them are surpassed, a proactive notification will be generated.
 * Note that setting a value of -1.0 to any of the thresholds will disable
 * them (separately)./* ww  w . ja  va 2s. c o m*/
 * @param serviceId Service identifier.
 * @param energyEfficiencyTH Energy efficiency threshold.
 * @param ecologicalEfficiencyTH Ecological efficiency threshold.
 */
public void setServiceEcoThreshold(String serviceId, Double energyEfficiencyTH, Double ecologicalEfficiencyTH) {
    try {
        if (serviceId != null) {
            WebResource resource = client.resource(this.getAddress()).path("proactive/service").path(serviceId)
                    .path("setth");
            if (energyEfficiencyTH != null) {
                resource = resource.queryParam("enEffTH", energyEfficiencyTH.toString());
            }
            if (ecologicalEfficiencyTH != null) {
                resource = resource.queryParam("ecoEffTH", ecologicalEfficiencyTH.toString());
            }
            resource.post();
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

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

/**
 * Specifies the minimum eco-efficiency thresholds at VM level.
 * If any of them are surpassed, a proactive notification will be generated.
 * Note that setting a value of -1.0 to any of the thresholds will disable
 * them (separately).//from   w  w  w .j a  va  2s  . c o  m
 *
 * @param vmId VM identifier.
 * @param energyEfficiencyTH Energy efficiency threshold.
 * @param ecologicalEfficiencyTH Ecological efficiency threshold.
 */
public void setVMEcoThreshold(String vmId, Double energyEfficiencyTH, Double ecologicalEfficiencyTH) {
    try {
        if (vmId != null) {
            WebResource resource = client.resource(this.getAddress()).path("proactive/vm").path(vmId)
                    .path("setth");
            if (energyEfficiencyTH != null) {
                resource = resource.queryParam("enEffTH", energyEfficiencyTH.toString());
            }
            if (ecologicalEfficiencyTH != null) {
                resource = resource.queryParam("ecoEffTH", ecologicalEfficiencyTH.toString());
            }
            resource.post();
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

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

/**
 * Stops the assessment of a given IP (infrastructure)
 *//*from w w w  .ja v  a 2s.com*/
public void stopAssessment() {
    try {
        WebResource resource = client.resource(this.getAddress());
        resource.path("infrastructure").delete();
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

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

/**
 * Stops the automatic eco-assessment of a service.
 *
 * @param serviceId Service identifier.//from  ww  w .  jav  a 2 s . co  m
 */
public void stopServiceAssessment(String serviceId) {
    try {
        if (serviceId != null) {
            WebResource resource = client.resource(this.getAddress());
            resource.path("service").path(serviceId).delete();
        }
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

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

/**
 * Returns the last service deployment messages.
 */// ww  w . ja v  a  2  s .  c  o m
public String getAllDeploymentMessages() {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("service").path("alldeploymentmessages");
        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

/**
 * Starts the assessment of the IP at infrastructure level.
 *
 * @param timeout Timeout between successive ecoefficiency automatic
 * assessments. A default timeout value will be used if this parameter is
 * not specified./*from   w  w w  . ja  v  a2 s .c  o m*/
 */
public void startAssessment(Long timeout) {
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure");
        if (timeout != null) {
            resource = resource.queryParam("timeout", timeout.toString());
        }
        resource.post();
    } catch (UniformInterfaceException ex) {
        ClientResponse cr = ex.getResponse();
        log.error(cr.getStatus());
        ex.printStackTrace();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

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

/**
 * Returns the mean performance of a single CPU at 100% of CPU utilisation,
 * considering all the CPUs in the datacenter.
 *///from   www .  j  a v  a2s.c  o m
public String getCPUMeanPerformance() {
    String ret = null;
    try {
        WebResource resource = client.resource(this.getAddress()).path("infrastructure").path("metrics")
                .path("cpumeanperformance");
        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;
}