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 { ...@@ -148,6 +148,14 @@ hr {
</div> </div>
<div id="pageBody"> <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> <p><b>2.2.0</b> -- April 12, 2007</p>
<ul> <ul>
<li>Now requires Openfire 3.3.0.</li> <li>Now requires Openfire 3.3.0.</li>
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<name>User Import Export</name> <name>User Import Export</name>
<description>Enables import and export of user data</description> <description>Enables import and export of user data</description>
<author>Ryan Graham</author> <author>Ryan Graham</author>
<version>2.2.1</version> <version>2.3.0</version>
<date>4/12/2007</date> <date>12/2/2009</date>
<minServerVersion>3.5.0</minServerVersion> <minServerVersion>3.6.5</minServerVersion>
<adminconsole> <adminconsole>
<tab id="tab-users"> <tab id="tab-users">
......
...@@ -31,7 +31,8 @@ import org.jivesoftware.openfire.user.UserAlreadyExistsException; ...@@ -31,7 +31,8 @@ import org.jivesoftware.openfire.user.UserAlreadyExistsException;
import org.jivesoftware.openfire.user.UserManager; import org.jivesoftware.openfire.user.UserManager;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.user.UserProvider; import org.jivesoftware.openfire.user.UserProvider;
import org.jivesoftware.util.Log; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
/** /**
...@@ -44,6 +45,9 @@ import org.xmpp.packet.JID; ...@@ -44,6 +45,9 @@ import org.xmpp.packet.JID;
* @author <a href="mailto:ryan@version2software.com">Ryan Graham</a> * @author <a href="mailto:ryan@version2software.com">Ryan Graham</a>
*/ */
public class ImportExportPlugin implements Plugin { public class ImportExportPlugin implements Plugin {
private static final Logger Log = LoggerFactory.getLogger(ImportExportPlugin.class);
private UserManager userManager; private UserManager userManager;
private UserProvider provider; private UserProvider provider;
private String serverName; private String serverName;
...@@ -102,7 +106,7 @@ public class ImportExportPlugin implements Plugin { ...@@ -102,7 +106,7 @@ public class ImportExportPlugin implements Plugin {
writer = new XMLWriter(stringWriter, OutputFormat.createPrettyPrint()); writer = new XMLWriter(stringWriter, OutputFormat.createPrettyPrint());
writer.write(exportUsers()); writer.write(exportUsers());
} catch (IOException ioe) { } catch (IOException ioe) {
Log.error(ioe); Log.error(ioe.getMessage(), ioe);
throw ioe; throw ioe;
} finally { } finally {
if (writer != null) { if (writer != null) {
...@@ -144,7 +148,7 @@ public class ImportExportPlugin implements Plugin { ...@@ -144,7 +148,7 @@ public class ImportExportPlugin implements Plugin {
return new UserSchemaValidator(file, "wildfire-user-schema.xsd.xml").validate(); return new UserSchemaValidator(file, "wildfire-user-schema.xsd.xml").validate();
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
return false; return false;
} }
} }
...@@ -209,9 +213,9 @@ public class ImportExportPlugin implements Plugin { ...@@ -209,9 +213,9 @@ public class ImportExportPlugin implements Plugin {
Element users = document.getRootElement(); Element users = document.getRootElement();
Iterator usersIter = users.elementIterator("User"); Iterator<Element> usersIter = users.elementIterator("User");
while (usersIter.hasNext()) { while (usersIter.hasNext()) {
Element user = (Element) usersIter.next(); Element user = usersIter.next();
String userName = null; String userName = null;
String password = null; String password = null;
...@@ -219,9 +223,9 @@ public class ImportExportPlugin implements Plugin { ...@@ -219,9 +223,9 @@ public class ImportExportPlugin implements Plugin {
String name = null; String name = null;
List<RosterItem> rosterItems = new ArrayList<RosterItem>(); List<RosterItem> rosterItems = new ArrayList<RosterItem>();
Iterator userElements = user.elementIterator(); Iterator<Element> userElements = user.elementIterator();
while (userElements.hasNext()) { while (userElements.hasNext()) {
Element userElement = (Element) userElements.next(); Element userElement = userElements.next();
String nameElement = userElement.getName(); String nameElement = userElement.getName();
if ("Username".equals(nameElement)) { if ("Username".equals(nameElement)) {
...@@ -237,10 +241,10 @@ public class ImportExportPlugin implements Plugin { ...@@ -237,10 +241,10 @@ public class ImportExportPlugin implements Plugin {
email = userElement.getText(); email = userElement.getText();
} }
else if ("Roster".equals(nameElement)) { else if ("Roster".equals(nameElement)) {
Iterator rosterIter = userElement.elementIterator("Item"); Iterator<Element> rosterIter = userElement.elementIterator("Item");
while (rosterIter.hasNext()) { while (rosterIter.hasNext()) {
Element rosterElement = (Element) rosterIter.next(); Element rosterElement = rosterIter.next();
String jid = rosterElement.attributeValue("jid"); String jid = rosterElement.attributeValue("jid");
String askstatus = rosterElement.attributeValue("askstatus"); String askstatus = rosterElement.attributeValue("askstatus");
...@@ -249,9 +253,9 @@ public class ImportExportPlugin implements Plugin { ...@@ -249,9 +253,9 @@ public class ImportExportPlugin implements Plugin {
String nickname = rosterElement.attributeValue("name"); String nickname = rosterElement.attributeValue("name");
List<String> groups = new ArrayList<String>(); List<String> groups = new ArrayList<String>();
Iterator groupIter = rosterElement.elementIterator("Group"); Iterator<Element> groupIter = rosterElement.elementIterator("Group");
while (groupIter.hasNext()) { while (groupIter.hasNext()) {
Element group = (Element) groupIter.next(); Element group = groupIter.next();
groups.add(group.getText()); groups.add(group.getText());
} }
......
package org.jivesoftware.openfire.plugin; package org.jivesoftware.openfire.plugin;
import com.sun.msv.reader.util.GrammarLoader; import java.io.IOException;
import com.sun.msv.reader.util.IgnoreController; import java.net.URL;
import com.sun.msv.verifier.DocumentDeclaration;
import com.sun.msv.verifier.Verifier; import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItem;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.dom4j.io.SAXWriter; 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.ContentHandler;
import org.xml.sax.ErrorHandler; import org.xml.sax.ErrorHandler;
import org.xml.sax.Locator; import org.xml.sax.Locator;
import org.xml.sax.SAXParseException; import org.xml.sax.SAXParseException;
import java.io.IOException; import com.sun.msv.reader.util.GrammarLoader;
import java.net.URL; import com.sun.msv.reader.util.IgnoreController;
import com.sun.msv.verifier.DocumentDeclaration;
import javax.xml.parsers.SAXParserFactory; import com.sun.msv.verifier.Verifier;
public class UserSchemaValidator { public class UserSchemaValidator {
private static final Logger Log = LoggerFactory.getLogger(UserSchemaValidator.class);
private Document doc; private Document doc;
private String schema; private String schema;
...@@ -63,7 +67,7 @@ public class UserSchemaValidator { ...@@ -63,7 +67,7 @@ public class UserSchemaValidator {
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
Log.error(e); Log.error(e.getMessage(), e);
return false; 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