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