class OpenStackParser {

	public Storage parseImageResponse (String response)
            throws OCCIException {
    	String id, name;
    	int size;
		Storage ret = new Storage();
		Gson gson = new Gson();
		
		log.info("[OpenStackParser] Parsing image response...");
		Image img = gson.fromJson(response, Image.class);
		
		id   = img.getId();
		name = img.getName();
		size = img.getSize();
		
		if (id != null && name != null && size > 0) {
			ret.setName(name);
			ret.setSize(String.valueOf(size));
			ret.setHref(id);
			ret.setType(StorageType.OS);
		} else {
    		OCCIException exception = new OCCIException();
            exception.setMessage(MALFORMEDRESPONSE);
            log.error(MALFORMEDRESPONSE);
            throw exception;
    	}
		log.debug("[OpenStackParser] Image response parsed...");
		
		return ret;
	}

}