java.util.*, org.dom4j.DocumentException, org.apache.commons.fileupload.DiskFileUpload, org.apache.commons.fileupload.FileItem, org.jivesoftware.wildfire.plugin.ImportExportPlugin, org.jivesoftware.wildfire.XMPPServer, org.jivesoftware.util.ParamUtils" %> boolean importUsers = request.getParameter("importUsers") != null; boolean success = request.getParameter("success") != null; ImportExportPlugin plugin = (ImportExportPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("userimportexport"); List duplicateUsers = new ArrayList(); Map errors = new HashMap(); if (importUsers) { DiskFileUpload dfu = new DiskFileUpload(); List fileItems = dfu.parseRequest(request); Iterator i = fileItems.iterator(); FileItem fi = (FileItem) i.next(); FileItem pd = (FileItem) i.next(); String previousDomain = pd.getString(); if (plugin.validateImportFile(fi)) { try { if (isEmpty(previousDomain)) { duplicateUsers.addAll(plugin.importUserData(fi, null)); } else if (!isEmpty(previousDomain)) { duplicateUsers.addAll(plugin.importUserData(fi, previousDomain)); } else { errors.put("missingDomain", "missingDomain"); } if (duplicateUsers.size() == 0) { response.sendRedirect("import-user-data.jsp?success=true"); return; } errors.put("userAlreadyExists", "userAlreadyExists"); } catch (MalformedURLException e) { errors.put("IOException", "IOException"); } catch (DocumentException e) { errors.put("DocumentException", "DocumentException"); } } else { errors.put("invalidUserFile", "invalidUserFile"); } } %> Import User Data 0) { %> You must supply both a existing and new domain name. Missing or bad file name. Import failed. The import file does not match the user schema. The following users are already exist in the system and were not loaded: Iterator iter = duplicateUsers.iterator(); while (iter.hasNext()) { String username = (String) iter.next(); %> if (iter.hasNext()) { %>, } else { %>. } } } %> All users added successfully. Use the form below to import a user data XML file. Import Choose a file to import: Optional - Use the field below to replace the domain name of user roster entries with the current hostname. See the migration section of the readme for details. Replace Domain: public boolean isEmpty(String s) { if (s == null) { return true; } if (s.trim().length() == 0) { return true; } return false; } %>