private void describeInstances( HttpServletRequest request, HttpServletResponse response )
throws ADBException, XMLStreamException, IOException
{
EC2DescribeInstances EC2request = new EC2DescribeInstances();
// -> 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] );
}
}
// -> are there any filters with this request?
EC2Filter[] filterSet = extractFilters( request );
if (null != filterSet)
{
EC2InstanceFilterSet ifs = new EC2InstanceFilterSet();
for( int i=0; i < filterSet.length; i++ ) ifs.addFilter( filterSet[i] );
EC2request.setFilterSet( ifs );
}
// -> execute the request
EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
DescribeInstancesResponse EC2response = EC2SoapServiceImpl.toDescribeInstancesResponse( engine.describeInstances( EC2request ), engine);