Commit bbe16a58 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Added generics and removed unused thrown exceptions.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1695 b35dd754-fafc-0310-a699-88a17e54d16e
parent d5f35db6
......@@ -11,8 +11,8 @@
package org.jivesoftware.messenger.disco;
import org.dom4j.Element;
import org.jivesoftware.messenger.forms.spi.XDataFormImpl;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.xmpp.packet.JID;
import java.util.Iterator;
......@@ -39,7 +39,7 @@ public interface DiscoInfoProvider {
* @param senderJID the XMPPAddress of user that sent the disco info request.
* @return an Iterator (of Element) with the target entity's identities.
*/
public abstract Iterator getIdentities(String name, String node, JID senderJID);
public abstract Iterator<Element> getIdentities(String name, String node, JID senderJID);
/**
* Returns an Iterator (of String) with the supported features. The features to include are the
......@@ -51,7 +51,7 @@ public interface DiscoInfoProvider {
* @param senderJID the XMPPAddress of user that sent the disco info request.
* @return an Iterator (of String) with the supported features.
*/
public abstract Iterator getFeatures(String name, String node, JID senderJID);
public abstract Iterator<String> getFeatures(String name, String node, JID senderJID);
/**
* Returns an XDataForm with the extended information about the entity or null if none. Each bit
......@@ -74,8 +74,6 @@ public interface DiscoInfoProvider {
* @param node the requested disco node.
* @param senderJID the XMPPAddress of user that sent the disco info request.
* @return true if we can provide information related to the requested name and node.
* @throws UnauthorizedException if the senderJID is not authorized to discover information.
*/
public abstract boolean hasInfo(String name, String node, JID senderJID)
throws UnauthorizedException;
public abstract boolean hasInfo(String name, String node, JID senderJID);
}
......@@ -11,9 +11,8 @@
package org.jivesoftware.messenger.disco;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.xmpp.packet.JID;
import org.dom4j.Element;
import org.xmpp.packet.JID;
import java.util.Iterator;
......@@ -40,9 +39,7 @@ public interface DiscoItemsProvider {
* @param node the requested disco node.
* @param senderJID the XMPPAddress of user that sent the disco items request.
* @return an Iterator (of Element) with the target entity's items or null if none.
* @throws UnauthorizedException if the senderJID is not authorized to discover items.
*/
public abstract Iterator<Element> getItems(String name, String node, JID senderJID)
throws UnauthorizedException;
public abstract Iterator<Element> getItems(String name, String node, JID senderJID);
}
......@@ -36,5 +36,5 @@ public interface ServerFeaturesProvider {
*
* @return an Iterator (of String) with the supported features by the server.
*/
public abstract Iterator getFeatures();
public abstract Iterator<String> getFeatures();
}
......@@ -808,9 +808,8 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
return items.iterator();
}
public Iterator getIdentities(String name, String node, JID senderJID) {
// TODO Improve performance by not creating objects each time
ArrayList identities = new ArrayList();
public Iterator<Element> getIdentities(String name, String node, JID senderJID) {
ArrayList<Element> identities = new ArrayList<Element>();
if (name == null && node == null) {
// Answer the identity of the MUC service
Element identity = DocumentHelper.createElement("identity");
......@@ -850,8 +849,8 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
return identities.iterator();
}
public Iterator getFeatures(String name, String node, JID senderJID) {
ArrayList features = new ArrayList();
public Iterator<String> getFeatures(String name, String node, JID senderJID) {
ArrayList<String> features = new ArrayList<String>();
if (name == null && node == null) {
// Answer the features of the MUC service
features.add("http://jabber.org/protocol/muc");
......@@ -945,8 +944,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
return null;
}
public boolean hasInfo(String name, String node, JID senderJID)
throws UnauthorizedException {
public boolean hasInfo(String name, String node, JID senderJID) {
if (name == null && node == node) {
// We always have info about the MUC service
return true;
......@@ -962,8 +960,7 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
return false;
}
public Iterator<Element> getItems(String name, String node, JID senderJID)
throws UnauthorizedException {
public Iterator<Element> getItems(String name, String node, JID senderJID) {
List<Element> answer = new ArrayList<Element>();
if (name == null && node == null) {
Element item;
......
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