/**
 * 
 */
package jp.ac.nii.prl.mape.monitoring.service;

import org.springframework.stereotype.Service;

import jp.ac.nii.prl.mape.monitoring.model.Instance;

@Service("instanceService")
public class InstanceServiceImpl implements InstanceService {

	/* (non-Javadoc)
	 * @see jp.ac.nii.prl.mape.monitoring.service.InstanceService#fromAWS(com.amazonaws.services.ec2.model.Instance)
	 */
	@Override
	public Instance fromAWS(com.amazonaws.services.ec2.model.Instance aws) {
		Instance instance = new Instance();
		instance.setAmi(aws.getImageId());
		instance.setInstID(aws.getInstanceId());
		instance.setInstStatus(0);
		instance.setInstType(aws.getInstanceType());
		instance.setSecurityGroupRef(aws.getSecurityGroups().iterator().next().getGroupId());
		instance.setState(aws.getState().getCode());
		return instance;
	}

}

@@ -49,24 +49,87 @@
 g.service;%0A%0A
+import org.springframework.beans.factory.annotation.Autowired;%0A
 import org.s
@@ -309,16 +309,168 @@
 vice %7B%0A%0A
+%09private final CloudWatchService cwService;%0A%09%0A%09@Autowired%0A%09public InstanceServiceImpl(CloudWatchService cwService) %7B%0A%09%09this.cwService = cwService;%0A%09%7D%0A%09%0A
 %09/* (non
@@ -1012,16 +1012,77 @@
 ode());%0A
+%09%09instance.setLoad(cwService.getLoad(instance.getInstID()));%0A
 %09%09return

Include instance load in instance creation