private boolean processImportUpload(ActionRequest request, ActionResponse response) throws PortletException {
String type = request.getParameter("importSource");
response.setRenderParameter("importSource", type);
if (!PortletFileUpload.isMultipartContent(request)) {
throw new PortletException("Expected file upload");
}
PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
try {
List items = uploader.parseRequest(request);
for (Iterator i = items.iterator(); i.hasNext();) {
FileItem item = (FileItem) i.next();
if (!item.isFormField()) {
File file = File.createTempFile("geronimo-import", "");
file.deleteOnExit();
log.debug("Writing database pool import file to "+file.getAbsolutePath());
item.write(file);
DatabaseConversionStatus status = processImport(file, type);
request.getPortletSession(true).setAttribute("ImportStatus", new ImportStatus(status));
return true;
} else {
throw new PortletException("Not expecting any form fields");
}
}
} catch(PortletException e) {
throw e;
} catch(Exception e) {
throw new PortletException(e);
}
return false;
}