@Test public void renegotiate() throws Exception { AmqpMessageReceiver receiver = new AmqpMessageReceiver(Configuration.amqpAddress, Configuration.amqpUsername, Configuration.amqpPassword, "APPLICATION.>", true); AmqpListListener listener = new AmqpListListener(); receiver.setMessageConsumer(listener); DeploymentRest deploymentRest = new DeploymentRest(); DeploymentDAO deploymentDAO = mock(DeploymentDAO.class); deploymentRest.deploymentDAO = deploymentDAO; AgreementDAO agreementDAO = mock(AgreementDAO.class); deploymentRest.agreementDAO = agreementDAO; Deployment deployment = new Deployment(); deployment.setSchema(1); deployment.setId(22); when(deploymentDAO.getById(22)).thenReturn(deployment); when(agreementDAO.getAcceptedAgreement(deployment)).thenReturn(null); Response response = deploymentRest.renegotiate("threeTierWebApp", "22"); Thread.sleep(1000l); assertEquals(200, response.getStatus()); assertEquals("No renegotiation possible!", (String) response.getEntity()); assertEquals(2, listener.getTextMessages().size()); assertEquals("APPLICATION.threeTierWebApp.DEPLOYMENT.22.RENEGOTIATING", listener.getTextMessages().get(0).getJMSDestination().toString()); assertEquals("threeTierWebApp", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(0).getText()).getApplicationId()); assertEquals("22", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(0).getText()).getDeploymentId()); assertEquals("RENEGOTIATING", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(0).getText()).getStatus()); assertEquals("APPLICATION.threeTierWebApp.DEPLOYMENT.22.RENEGOTIATED", listener.getTextMessages().get(1).getJMSDestination().toString()); assertEquals("threeTierWebApp", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(1).getText()).getApplicationId()); assertEquals("22", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(1).getText()).getDeploymentId()); assertEquals("RENEGOTIATED", ModelConverter.jsonToApplicationManagerMessage(listener.getTextMessages().get(1).getText()).getStatus()); receiver.close(); }
private Response renegotiate(String applicationName, String deploymentId, SLAApplicationTerms appTerms) { Deployment deployment = deploymentDAO.getById(Integer.parseInt(deploymentId)); if(deployment == null) { return buildResponse(Status.NOT_FOUND, "Deployment not found!"); } AmqpProducer.sendDeploymentRenegotiatingMessage(applicationName, deployment); Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No renegotiation possible!"); } else if(!Configuration.enableSLAM.equals("yes")) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "PaaS SLAM disabled!!!"); } String agreementId = agreement.getSlaAgreementId(); NegotiationWsClient client = new NegotiationWsClient(); SlaTranslator slaTranslator = new SlaTranslatorImplNoOsgi(); client.setSlaTranslator(slaTranslator); agreementId = client.renegotiate(Configuration.slamURL, agreementId); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(deployment.getOvf()); try { SLATemplate[] slats = NegotiationEventHandler.negiotate(agreementId, ovfDefinition, applicationName, deployment.getId(), client, appTerms); if(slats == null || slats.length == 0) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No new agreement possible"); } SLATemplate slat = slats[0]; SLA slaAgreement = client.createAgreement(Configuration.slamURL, slat, slat.getUuid().getValue()); if(slaAgreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "Not possible to reach an agreement"); } agreement.setAccepted(false); agreementDAO.update(agreement); deployment = deploymentDAO.getById(deployment.getId()); deployment.setSlaUUID(slaAgreement.getUuid()); deploymentDAO.update(deployment); Agreement agreement2 = new Agreement(); agreement2.setAccepted(true); agreement2.setDeployment(deployment); SLASOITemplateRenderer rend = new SLASOITemplateRenderer(); String xmlRetSlat = rend.renderSLATemplate(slat); agreement2.setSlaAgreement(xmlRetSlat); agreement2.setNegotiationId(agreementId); agreement2.setSlaAgreementId(slat.getUuid().getValue()); agreement2.setOrderInArray(0); deployment.addAgreement(agreement); deploymentDAO.update(deployment); } catch(Exception ex) { logger.error("Error during the renegotiation process"); logger.error(ex.getMessage()); logger.error(ex.getStackTrace()); } return null; }
DeploymentRest extends AbstractRest { private Response renegotiate(String applicationName, String deploymentId, SLAApplicationTerms appTerms) { Deployment deployment = deploymentDAO.getById(Integer.parseInt(deploymentId)); if(deployment == null) { return buildResponse(Status.NOT_FOUND, "Deployment not found!"); } AmqpProducer.sendDeploymentRenegotiatingMessage(applicationName, deployment); Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No renegotiation possible!"); } else if(!Configuration.enableSLAM.equals("yes")) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "PaaS SLAM disabled!!!"); } String agreementId = agreement.getSlaAgreementId(); NegotiationWsClient client = new NegotiationWsClient(); SlaTranslator slaTranslator = new SlaTranslatorImplNoOsgi(); client.setSlaTranslator(slaTranslator); agreementId = client.renegotiate(Configuration.slamURL, agreementId); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(deployment.getOvf()); try { SLATemplate[] slats = NegotiationEventHandler.negiotate(agreementId, ovfDefinition, applicationName, deployment.getId(), client, appTerms); if(slats == null || slats.length == 0) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No new agreement possible"); } SLATemplate slat = slats[0]; SLA slaAgreement = client.createAgreement(Configuration.slamURL, slat, slat.getUuid().getValue()); if(slaAgreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "Not possible to reach an agreement"); } agreement.setAccepted(false); agreementDAO.update(agreement); deployment = deploymentDAO.getById(deployment.getId()); deployment.setSlaUUID(slaAgreement.getUuid()); deploymentDAO.update(deployment); Agreement agreement2 = new Agreement(); agreement2.setAccepted(true); agreement2.setDeployment(deployment); SLASOITemplateRenderer rend = new SLASOITemplateRenderer(); String xmlRetSlat = rend.renderSLATemplate(slat); agreement2.setSlaAgreement(xmlRetSlat); agreement2.setNegotiationId(agreementId); agreement2.setSlaAgreementId(slat.getUuid().getValue()); agreement2.setOrderInArray(0); deployment.addAgreement(agreement); deploymentDAO.update(deployment); } catch(Exception ex) { logger.error("Error during the renegotiation process"); logger.error(ex.getMessage()); logger.error(ex.getStackTrace()); } return null; } }
DeploymentRest extends AbstractRest { private Response renegotiate(String applicationName, String deploymentId, SLAApplicationTerms appTerms) { Deployment deployment = deploymentDAO.getById(Integer.parseInt(deploymentId)); if(deployment == null) { return buildResponse(Status.NOT_FOUND, "Deployment not found!"); } AmqpProducer.sendDeploymentRenegotiatingMessage(applicationName, deployment); Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No renegotiation possible!"); } else if(!Configuration.enableSLAM.equals("yes")) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "PaaS SLAM disabled!!!"); } String agreementId = agreement.getSlaAgreementId(); NegotiationWsClient client = new NegotiationWsClient(); SlaTranslator slaTranslator = new SlaTranslatorImplNoOsgi(); client.setSlaTranslator(slaTranslator); agreementId = client.renegotiate(Configuration.slamURL, agreementId); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(deployment.getOvf()); try { SLATemplate[] slats = NegotiationEventHandler.negiotate(agreementId, ovfDefinition, applicationName, deployment.getId(), client, appTerms); if(slats == null || slats.length == 0) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No new agreement possible"); } SLATemplate slat = slats[0]; SLA slaAgreement = client.createAgreement(Configuration.slamURL, slat, slat.getUuid().getValue()); if(slaAgreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "Not possible to reach an agreement"); } agreement.setAccepted(false); agreementDAO.update(agreement); deployment = deploymentDAO.getById(deployment.getId()); deployment.setSlaUUID(slaAgreement.getUuid()); deploymentDAO.update(deployment); Agreement agreement2 = new Agreement(); agreement2.setAccepted(true); agreement2.setDeployment(deployment); SLASOITemplateRenderer rend = new SLASOITemplateRenderer(); String xmlRetSlat = rend.renderSLATemplate(slat); agreement2.setSlaAgreement(xmlRetSlat); agreement2.setNegotiationId(agreementId); agreement2.setSlaAgreementId(slat.getUuid().getValue()); agreement2.setOrderInArray(0); deployment.addAgreement(agreement); deploymentDAO.update(deployment); } catch(Exception ex) { logger.error("Error during the renegotiation process"); logger.error(ex.getMessage()); logger.error(ex.getStackTrace()); } return null; }  }
DeploymentRest extends AbstractRest { private Response renegotiate(String applicationName, String deploymentId, SLAApplicationTerms appTerms) { Deployment deployment = deploymentDAO.getById(Integer.parseInt(deploymentId)); if(deployment == null) { return buildResponse(Status.NOT_FOUND, "Deployment not found!"); } AmqpProducer.sendDeploymentRenegotiatingMessage(applicationName, deployment); Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No renegotiation possible!"); } else if(!Configuration.enableSLAM.equals("yes")) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "PaaS SLAM disabled!!!"); } String agreementId = agreement.getSlaAgreementId(); NegotiationWsClient client = new NegotiationWsClient(); SlaTranslator slaTranslator = new SlaTranslatorImplNoOsgi(); client.setSlaTranslator(slaTranslator); agreementId = client.renegotiate(Configuration.slamURL, agreementId); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(deployment.getOvf()); try { SLATemplate[] slats = NegotiationEventHandler.negiotate(agreementId, ovfDefinition, applicationName, deployment.getId(), client, appTerms); if(slats == null || slats.length == 0) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No new agreement possible"); } SLATemplate slat = slats[0]; SLA slaAgreement = client.createAgreement(Configuration.slamURL, slat, slat.getUuid().getValue()); if(slaAgreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "Not possible to reach an agreement"); } agreement.setAccepted(false); agreementDAO.update(agreement); deployment = deploymentDAO.getById(deployment.getId()); deployment.setSlaUUID(slaAgreement.getUuid()); deploymentDAO.update(deployment); Agreement agreement2 = new Agreement(); agreement2.setAccepted(true); agreement2.setDeployment(deployment); SLASOITemplateRenderer rend = new SLASOITemplateRenderer(); String xmlRetSlat = rend.renderSLATemplate(slat); agreement2.setSlaAgreement(xmlRetSlat); agreement2.setNegotiationId(agreementId); agreement2.setSlaAgreementId(slat.getUuid().getValue()); agreement2.setOrderInArray(0); deployment.addAgreement(agreement); deploymentDAO.update(deployment); } catch(Exception ex) { logger.error("Error during the renegotiation process"); logger.error(ex.getMessage()); logger.error(ex.getStackTrace()); } return null; }  @GET @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getDeployments(@PathParam("application_name") String applicationName, @DefaultValue("")@QueryParam("status") String status); @GET @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getDeploymentsJSON(@PathParam("application_name") String applicationName, @DefaultValue("")@QueryParam("status") String status); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postDeployment(@PathParam("application_name") String applicationName, @QueryParam("negotiation") String negotiation,  @QueryParam("schema") String schema, String payload); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_JSON) Response postDeploymentJSON(@PathParam("application_name") String applicationName, @QueryParam("negotiation") String negotiation,  @QueryParam("schema") String schema, String payload); @OPTIONS @Path("{deployment_id}") Response optionsForSpecificDeployment(); @GET @Path("{deployment_id}") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getDeployment(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}") @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getDeploymentJSON(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/agreement") @Produces(MediaType.APPLICATION_XML) Response getDeploymentAgreement(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/ovf") @Produces(MediaType.APPLICATION_XML) Response getDeploymentOvf(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @PUT @Path("{deployment_id}/agreement") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response putDeploymentAgreement(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @DELETE @Path("{deployment_id}") @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) Response deleteDeployment(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/cost-consumption") @Produces(MediaType.APPLICATION_XML) Response getCost(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getEnergyConsumptionXML(@PathParam("application_name") String applicationName, 
										 @PathParam("deployment_id") String deploymentId,
										 @QueryParam("startTime") String startTime,
			                             @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/energy-consumption") @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getEnergyConsumptionJSON(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @QueryParam("startTime") String startTime,
            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/power-consumption") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getPowerConsumptionXML(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("startTime") String startTime,
			                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/power-consumption") @Produces(MediaType.APPLICATION_JSON + ";qs=0,5") Response getPowerConsumptionJSON(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("startTime") String startTime,
			                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
									   @PathParam("deployment_id") String deploymentId,
										@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForEvent(@PathParam("application_name") String applicationName, 
												@PathParam("deployment_id") String deploymentId, 
												@PathParam("event_id") String eventId,
												@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForEvent(@PathParam("application_name") String applicationName, 
											   @PathParam("deployment_id") String deploymentId, 
											   @PathParam("event_id") String eventId,
											   @QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyMeasurementForEvent(@PathParam("application_name") String applicationName, 
												 @PathParam("deployment_id") String deploymentId, 
												 @PathParam("event_id") String eventId,
												 @QueryParam("startTime") String startTime,
					                             @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumptionForEvent(@PathParam("application_name") String applicationName, 
												@PathParam("deployment_id") String deploymentId, 
												@PathParam("event_id") String eventId,
					                            @QueryParam("startTime") String startTime,
					                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/predicted-price-for-next-period") @Produces(MediaType.APPLICATION_XML) Response getPredictedPriceForNextPeriod(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @QueryParam("duration") String duration); @GET @Path("{deployment_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("event_id") String eventId); @GET @Path("{deployment_id}/sla-limits") @Produces(MediaType.APPLICATION_XML) Response getSLALimits(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Path("{deployment_id}/renegotiate") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response renegotiateWithPayload(@PathParam("application_name") String applicationName,@PathParam("deployment_id") String deploymentId, String payload); @GET @Path("{deployment_id}/renegotiate") @Produces(MediaType.APPLICATION_XML) Response renegotiate(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/predict-price-next-hour") @Produces(MediaType.APPLICATION_XML) Response predictPriceNextHour(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); }
DeploymentRest extends AbstractRest { private Response renegotiate(String applicationName, String deploymentId, SLAApplicationTerms appTerms) { Deployment deployment = deploymentDAO.getById(Integer.parseInt(deploymentId)); if(deployment == null) { return buildResponse(Status.NOT_FOUND, "Deployment not found!"); } AmqpProducer.sendDeploymentRenegotiatingMessage(applicationName, deployment); Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No renegotiation possible!"); } else if(!Configuration.enableSLAM.equals("yes")) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "PaaS SLAM disabled!!!"); } String agreementId = agreement.getSlaAgreementId(); NegotiationWsClient client = new NegotiationWsClient(); SlaTranslator slaTranslator = new SlaTranslatorImplNoOsgi(); client.setSlaTranslator(slaTranslator); agreementId = client.renegotiate(Configuration.slamURL, agreementId); OvfDefinition ovfDefinition = OVFUtils.getOvfDefinition(deployment.getOvf()); try { SLATemplate[] slats = NegotiationEventHandler.negiotate(agreementId, ovfDefinition, applicationName, deployment.getId(), client, appTerms); if(slats == null || slats.length == 0) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "No new agreement possible"); } SLATemplate slat = slats[0]; SLA slaAgreement = client.createAgreement(Configuration.slamURL, slat, slat.getUuid().getValue()); if(slaAgreement == null) { AmqpProducer.sendDeploymentRenegotiatedMessage(applicationName, deployment); return buildResponse(Status.OK, "Not possible to reach an agreement"); } agreement.setAccepted(false); agreementDAO.update(agreement); deployment = deploymentDAO.getById(deployment.getId()); deployment.setSlaUUID(slaAgreement.getUuid()); deploymentDAO.update(deployment); Agreement agreement2 = new Agreement(); agreement2.setAccepted(true); agreement2.setDeployment(deployment); SLASOITemplateRenderer rend = new SLASOITemplateRenderer(); String xmlRetSlat = rend.renderSLATemplate(slat); agreement2.setSlaAgreement(xmlRetSlat); agreement2.setNegotiationId(agreementId); agreement2.setSlaAgreementId(slat.getUuid().getValue()); agreement2.setOrderInArray(0); deployment.addAgreement(agreement); deploymentDAO.update(deployment); } catch(Exception ex) { logger.error("Error during the renegotiation process"); logger.error(ex.getMessage()); logger.error(ex.getStackTrace()); } return null; }  @GET @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getDeployments(@PathParam("application_name") String applicationName, @DefaultValue("")@QueryParam("status") String status); @GET @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getDeploymentsJSON(@PathParam("application_name") String applicationName, @DefaultValue("")@QueryParam("status") String status); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postDeployment(@PathParam("application_name") String applicationName, @QueryParam("negotiation") String negotiation,  @QueryParam("schema") String schema, String payload); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_JSON) Response postDeploymentJSON(@PathParam("application_name") String applicationName, @QueryParam("negotiation") String negotiation,  @QueryParam("schema") String schema, String payload); @OPTIONS @Path("{deployment_id}") Response optionsForSpecificDeployment(); @GET @Path("{deployment_id}") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getDeployment(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}") @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getDeploymentJSON(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/agreement") @Produces(MediaType.APPLICATION_XML) Response getDeploymentAgreement(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/ovf") @Produces(MediaType.APPLICATION_XML) Response getDeploymentOvf(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @PUT @Path("{deployment_id}/agreement") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response putDeploymentAgreement(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @DELETE @Path("{deployment_id}") @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) Response deleteDeployment(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/cost-consumption") @Produces(MediaType.APPLICATION_XML) Response getCost(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getEnergyConsumptionXML(@PathParam("application_name") String applicationName, 
										 @PathParam("deployment_id") String deploymentId,
										 @QueryParam("startTime") String startTime,
			                             @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/energy-consumption") @Produces(MediaType.APPLICATION_JSON + ";qs=0.5") Response getEnergyConsumptionJSON(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @QueryParam("startTime") String startTime,
            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/power-consumption") @Produces(MediaType.APPLICATION_XML + ";qs=1") Response getPowerConsumptionXML(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("startTime") String startTime,
			                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/power-consumption") @Produces(MediaType.APPLICATION_JSON + ";qs=0,5") Response getPowerConsumptionJSON(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("startTime") String startTime,
			                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
									   @PathParam("deployment_id") String deploymentId,
										@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForEvent(@PathParam("application_name") String applicationName, 
												@PathParam("deployment_id") String deploymentId, 
												@PathParam("event_id") String eventId,
												@QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForEvent(@PathParam("application_name") String applicationName, 
											   @PathParam("deployment_id") String deploymentId, 
											   @PathParam("event_id") String eventId,
											   @QueryParam("duration") String durationQuery); @GET @Path("{deployment_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyMeasurementForEvent(@PathParam("application_name") String applicationName, 
												 @PathParam("deployment_id") String deploymentId, 
												 @PathParam("event_id") String eventId,
												 @QueryParam("startTime") String startTime,
					                             @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumptionForEvent(@PathParam("application_name") String applicationName, 
												@PathParam("deployment_id") String deploymentId, 
												@PathParam("event_id") String eventId,
					                            @QueryParam("startTime") String startTime,
					                            @QueryParam("endTime") String endTime); @GET @Path("{deployment_id}/predicted-price-for-next-period") @Produces(MediaType.APPLICATION_XML) Response getPredictedPriceForNextPeriod(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @QueryParam("duration") String duration); @GET @Path("{deployment_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("event_id") String eventId); @GET @Path("{deployment_id}/sla-limits") @Produces(MediaType.APPLICATION_XML) Response getSLALimits(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Path("{deployment_id}/renegotiate") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response renegotiateWithPayload(@PathParam("application_name") String applicationName,@PathParam("deployment_id") String deploymentId, String payload); @GET @Path("{deployment_id}/renegotiate") @Produces(MediaType.APPLICATION_XML) Response renegotiate(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @GET @Path("{deployment_id}/predict-price-next-hour") @Produces(MediaType.APPLICATION_XML) Response predictPriceNextHour(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId);  }