Commit 74c0d766 authored by guus's avatar guus

* Updating 'userImportExport' plugin to make use of SLF4J instead of custom logging (OF-53).

* Applied java generics.
* Replaced StringPrep with LibIDN (OF-78).

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11447 b35dd754-fafc-0310-a699-88a17e54d16e
parent 975108b0
......@@ -148,6 +148,14 @@ hr {
</div>
<div id="pageBody">
<p><b>2.3.0</b> -- December 2, 2009</p>
<ul>
<li>Now requires Openfire 3.6.5.</li>
<li>Applied Java generics.</li>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-53'>OF-53</a>] - Replace custom logging implementation with a third party library.</li>
<li>[<a href='http://www.igniterealtime.org/issues/browse/OF-78'>OF-78</a>] - Replaced custom Stringprep with LibIDN.</li>
</ul>
<p><b>2.2.0</b> -- April 12, 2007</p>
<ul>
<li>Now requires Openfire 3.3.0.</li>
......
......@@ -6,9 +6,9 @@
<name>User Import Export</name>
<description>Enables import and export of user data</description>
<author>Ryan Graham</author>
<version>2.2.1</version>
<date>4/12/2007</date>
<minServerVersion>3.5.0</minServerVersion>
<version>2.3.0</version>
<date>12/2/2009</date>
<minServerVersion>3.6.5</minServerVersion>
<adminconsole>
<tab id="tab-users">
......
......@@ -31,7 +31,8 @@ import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.user.UserProvider;
import org.jivesoftware.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;
/**
......@@ -44,6 +45,9 @@ import org.xmpp.packet.JID;
* @author <a href="mailto:ryan@version2software.com">Ryan Graham</a>
*/
public class ImportExportPlugin implements Plugin {
private static final Logger Log = LoggerFactory.getLogger(ImportExportPlugin.class);
private UserManager userManager;
private UserProvider provider;
private String serverName;
......@@ -102,7 +106,7 @@ public class ImportExportPlugin implements Plugin {
writer = new XMLWriter(stringWriter, OutputFormat.createPrettyPrint());
writer.write(exportUsers());
} catch (IOException ioe) {
Log.error(ioe);
Log.error(ioe.getMessage(), ioe);
throw ioe;
} finally {
if (writer != null) {
......@@ -144,7 +148,7 @@ public class ImportExportPlugin implements Plugin {
return new UserSchemaValidator(file, "wildfire-user-schema.xsd.xml").validate();
}
catch (Exception e) {
Log.error(e);
Log.error(e.getMessage(), e);
return false;
}
}
......@@ -209,9 +213,9 @@ public class ImportExportPlugin implements Plugin {
Element users = document.getRootElement();
Iterator usersIter = users.elementIterator("User");
Iterator<Element> usersIter = users.elementIterator("User");
while (usersIter.hasNext()) {
Element user = (Element) usersIter.next();
Element user = usersIter.next();
String userName = null;
String password = null;
......@@ -219,9 +223,9 @@ public class ImportExportPlugin implements Plugin {
String name = null;
List<RosterItem> rosterItems = new ArrayList<RosterItem>();
Iterator userElements = user.elementIterator();
Iterator<Element> userElements = user.elementIterator();
while (userElements.hasNext()) {
Element userElement = (Element) userElements.next();
Element userElement = userElements.next();
String nameElement = userElement.getName();
if ("Username".equals(nameElement)) {
......@@ -237,10 +241,10 @@ public class ImportExportPlugin implements Plugin {
email = userElement.getText();
}
else if ("Roster".equals(nameElement)) {
Iterator rosterIter = userElement.elementIterator("Item");
Iterator<Element> rosterIter = userElement.elementIterator("Item");
while (rosterIter.hasNext()) {
Element rosterElement = (Element) rosterIter.next();
Element rosterElement = rosterIter.next();
String jid = rosterElement.attributeValue("jid");
String askstatus = rosterElement.attributeValue("askstatus");
......@@ -249,9 +253,9 @@ public class ImportExportPlugin implements Plugin {
String nickname = rosterElement.attributeValue("name");
List<String> groups = new ArrayList<String>();
Iterator groupIter = rosterElement.elementIterator("Group");
Iterator<Element> groupIter = rosterElement.elementIterator("Group");
while (groupIter.hasNext()) {
Element group = (Element) groupIter.next();
Element group = groupIter.next();
groups.add(group.getText());
}
......
package org.jivesoftware.openfire.plugin;
import com.sun.msv.reader.util.GrammarLoader;
import com.sun.msv.reader.util.IgnoreController;
import com.sun.msv.verifier.DocumentDeclaration;
import com.sun.msv.verifier.Verifier;
import java.io.IOException;
import java.net.URL;
import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.fileupload.FileItem;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import org.dom4j.io.SAXWriter;
import org.jivesoftware.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.ContentHandler;
import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
import java.io.IOException;
import java.net.URL;
import javax.xml.parsers.SAXParserFactory;
import com.sun.msv.reader.util.GrammarLoader;
import com.sun.msv.reader.util.IgnoreController;
import com.sun.msv.verifier.DocumentDeclaration;
import com.sun.msv.verifier.Verifier;
public class UserSchemaValidator {
private static final Logger Log = LoggerFactory.getLogger(UserSchemaValidator.class);
private Document doc;
private String schema;
......@@ -63,7 +67,7 @@ public class UserSchemaValidator {
return false;
}
} catch (Exception e) {
Log.error(e);
Log.error(e.getMessage(), e);
return false;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment