/*
 * ARISTOTLE UNIVERSITY OF THESSALONIKI
 * Copyright (C) 2015
 * Aristotle University of Thessaloniki
 * Department of Electrical & Computer Engineering
 * Division of Electronics & Computer Engineering
 * Intelligent Systems & Software Engineering Lab
 *
 * Project             : eticsbte
 * WorkFile            : 
 * Compiler            : 
 * File Description    : 
 * Document Description: 
* Related Documents	   : 
* Note				   : 
* Programmer		   : RESTful MDE Engine created by Christoforos Zolotas
* Contact			   : christopherzolotas@issel.ee.auth.gr
*/


package eu.fp7.scase.eticsbte.optimize;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.QueryParam; 



/*
 * JavaAlgooptimizeController class is responsible to handle incoming HTTP requests for the optimize resource. More specifically
 * this resource controller handles client requests that are delegated to an external server, which is executed at
 * http://localhost:8080/eticsbte/api/AlgosearchVirtualMachine
*/
@Path("/Algooptimize")
public class JavaAlgooptimizeController{

    @Context
    private UriInfo oApplicationUri;

	/* 
	 * This function is the WEB API of resource optimize and accepts http  POST  requests,   
     * which it delegates to the underlying Handler PostoptimizeHandler. 
     * It returns any response formatted as stated in the @Produces JAX-RS annotation below.
    */
	@Path("/")
	@POST
	@Produces("application/JSON")
	@Consumes("application/JSON")
    public JavaOptimizeOutputModel postoptimize(@QueryParam("searchVirtualMachineCpuPower") String searchVirtualMachineCpuPower, @QueryParam("searchVirtualMachineHdDimension") String searchVirtualMachineHdDimension, @QueryParam("searchKeyword") String searchKeyword, @QueryParam("searchVirtualEnvironmentType") String searchVirtualEnvironmentType, JavaAlgooptimizeModel oJavaAlgooptimizeModel){

		//create a new PostoptimizeHandler
		PostoptimizeHandler oPostoptimizeHandler = new PostoptimizeHandler(searchVirtualMachineCpuPower,  searchVirtualMachineHdDimension,  searchKeyword,  searchVirtualEnvironmentType, oJavaAlgooptimizeModel, oApplicationUri);
		return oPostoptimizeHandler.postoptimize();
    }
}

