package jp.ac.nii.prl.mape.monitoring.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.amazonaws.services.ec2.model.Instance;
import com.amazonaws.services.ec2.model.SecurityGroup;

import jp.ac.nii.prl.mape.monitoring.model.Model;
import jp.ac.nii.prl.mape.monitoring.properties.InstanceTypeProperties;
import jp.ac.nii.prl.mape.monitoring.service.EC2Service;
import jp.ac.nii.prl.mape.monitoring.service.ModelService;

@RestController
@RequestMapping("/monitor")
@Component
public class MonitoringController {

	@Autowired
	private EC2Service ec2Service;
	
	@Autowired
	private ModelService modelService;
	
	@Autowired
	private InstanceTypeProperties instanceTypeProperties;
	
	@RequestMapping(value="/instances", method=RequestMethod.GET)
	public List<Instance> getInstances() {
		return ec2Service.getInstances();
	}
	
	@RequestMapping(value="/securityGroups", method=RequestMethod.GET)
	public List<SecurityGroup> getSecurityGroups() {
		return ec2Service.getSecurityGroups();
	}
	
	@RequestMapping(method=RequestMethod.GET)
	public Model getModel() {
		return modelService.createModel(ec2Service.getInstances(), 
				ec2Service.getSecurityGroups(),
				instanceTypeProperties);
	}
}

@@ -68,16 +68,73 @@
 .List;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A
 import o
@@ -861,16 +861,109 @@
 roller %7B
+%0A%09%0A%09private static final Logger logger = LoggerFactory.getLogger(MonitoringController.class);
 %0A%0A%09@Auto
@@ -1502,22 +1502,75 @@
 l() %7B%0A%09%09
-return
+logger.info(%22Building model from AWS API%22);%0A%09%09Model model =
  modelSe
@@ -1680,13 +1680,63 @@
 rties);%0A
+%09%09logger.info(%22Model completed%22);%0A%09%09return model;%0A
 %09%7D%0A%7D%0A

Use SLF4J for logging