StartInstancesResponse EC2response = EC2SoapServiceImpl.toStartInstancesResponse(ServiceProvider.getInstance().getEC2Engine().startInstances(EC2request));
serializeResponse(response, EC2response);
}
private void stopInstances(HttpServletRequest request, HttpServletResponse response) throws ADBException, XMLStreamException, IOException {
EC2StopInstances EC2request = new EC2StopInstances();
int count = 0;
// -> load in all the "InstanceId.n" parameters if any
Enumeration<?> names = request.getParameterNames();
while (names.hasMoreElements()) {
String key = (String)names.nextElement();
if (key.startsWith("InstanceId")) {
String[] value = request.getParameterValues(key);
if (null != value && 0 < value.length) {
EC2request.addInstanceId(value[0]);
count++;
}
}
}
if (0 == count) {
throw new EC2ServiceException(ClientError.MissingParamter, "Missing required parameter - InstanceId");
}
String[] force = request.getParameterValues("Force");
if (force != null) {
EC2request.setForce(Boolean.parseBoolean(force[0]));
}
// -> execute the request
StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse(ServiceProvider.getInstance().getEC2Engine().stopInstances(EC2request));
serializeResponse(response, EC2response);