class OpenStackParser {

    public StorageCollection parseImageCollectionResponse (String response)
                                                         throws OCCIException {
        StorageCollection ret = new StorageCollection();
        Gson gson = new Gson();
        Link link;
        
        log.info("[OpenStackParser] Parsing image collection response...");
        ImageCollection col = gson.fromJson(response, ImageCollection.class);
        
        for (Image img : col.getImages()) {
        	link = new Link();
        	link.setHref(img.getId().toString());
        	link.setName(img.getName());
        	
        	if (img.getId() != null && img.getName() != null) {
        		ret.getStorage().add(link);
        	} else {
        		OCCIException exception = new OCCIException();
                exception.setMessage(MALFORMEDRESPONSE);
                log.error(MALFORMEDRESPONSE);
                throw exception;
        	}
        }
        log.debug("[OpenStackParser] Image collection response parsed...");
        
        return ret;
    }

}