1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 01:29:38 +02:00

Introduce SmackException

SmackException (and it's subclasses) is for all errors/exceptions not
defined by any XMPP specification. XMPPException is now an abstract
class for all errors defined by the XMPP specifications.

Methods that involve an IQ exchange now either return the result, which
is obtained by IQ response, or they throw an XMPPErrorException if an IQ
error was the result of the IQ set/get. If there was no response from
the server within the default packet timeout, a NoResponseException will
be thrown.

XMPP SASL errors are now also reported accordingly.

SMACK-426
This commit is contained in:
Florian Schmaus 2014-03-12 11:50:05 +01:00
parent 4b6f09f962
commit 4b56446e40
109 changed files with 2040 additions and 1599 deletions

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.workgroup.agent;
import org.jivesoftware.smackx.workgroup.packet.AgentInfo;
import org.jivesoftware.smackx.workgroup.packet.AgentWorkgroups;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
import java.util.Collection;
@ -34,7 +35,7 @@ public class Agent {
private XMPPConnection connection;
private String workgroupJID;
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws XMPPException {
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException {
AgentWorkgroups request = new AgentWorkgroups(agentJID);
request.setTo(serviceJID);
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -62,8 +63,10 @@ public class Agent {
* Return the agents name.
*
* @return - the agents name.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public String getName() throws XMPPException {
public String getName() throws NoResponseException, XMPPErrorException {
AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.GET);
agentInfo.setTo(workgroupJID);
@ -79,10 +82,10 @@ public class Agent {
* error code.
*
* @param newName the new name of the agent.
* @throws XMPPException if the agent is not allowed to change his name or no response was
* obtained from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public void setName(String newName) throws XMPPException {
public void setName(String newName) throws NoResponseException, XMPPErrorException {
AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.SET);
agentInfo.setTo(workgroupJID);

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.workgroup.agent;
import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.jivesoftware.smackx.search.ReportedData;
import org.jivesoftware.smackx.workgroup.MetaData;
@ -33,6 +34,8 @@ import org.jivesoftware.smackx.workgroup.settings.GenericSettings;
import org.jivesoftware.smackx.workgroup.settings.SearchSettings;
import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.util.StringUtils;
@ -198,8 +201,9 @@ public class AgentSession {
* @param key the meta data key
* @param val the non-null meta data value
* @throws XMPPException if an exception occurs.
* @throws SmackException
*/
public void setMetaData(String key, String val) throws XMPPException {
public void setMetaData(String key, String val) throws XMPPException, SmackException {
synchronized (this.metaData) {
List<String> oldVals = metaData.get(key);
@ -217,8 +221,9 @@ public class AgentSession {
*
* @param key the meta data key.
* @throws XMPPException if an exception occurs.
* @throws SmackException
*/
public void removeMetaData(String key) throws XMPPException {
public void removeMetaData(String key) throws XMPPException, SmackException {
synchronized (this.metaData) {
List<String> oldVal = metaData.remove(key);
@ -246,8 +251,10 @@ public class AgentSession {
*
* @param online true to set the agent as online with the workgroup.
* @throws XMPPException if an error occurs setting the online status.
* @throws SmackException assertEquals(SmackException.Type.NO_RESPONSE_FROM_SERVER, e.getType());
return;
*/
public void setOnline(boolean online) throws XMPPException {
public void setOnline(boolean online) throws XMPPException, SmackException {
// If the online status hasn't changed, do nothing.
if (this.online == online) {
return;
@ -305,9 +312,10 @@ public class AgentSession {
* @param presenceMode the presence mode of the agent.
* @param maxChats the maximum number of chats the agent is willing to accept.
* @throws XMPPException if an error occurs setting the agent status.
* @throws SmackException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException {
public void setStatus(Presence.Mode presenceMode, int maxChats) throws XMPPException, SmackException {
setStatus(presenceMode, maxChats, null);
}
@ -330,11 +338,12 @@ public class AgentSession {
* @param presenceMode the presence mode of the agent.
* @param maxChats the maximum number of chats the agent is willing to accept.
* @param status sets the status message of the presence update.
* @throws XMPPException if an error occurs setting the agent status.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, int maxChats, String status)
throws XMPPException {
throws NoResponseException, XMPPErrorException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
@ -354,12 +363,14 @@ public class AgentSession {
}
// Send information about max chats and current chats as a packet extension.
DefaultPacketExtension agentStatus = new DefaultPacketExtension(AgentStatus.ELEMENT_NAME,
AgentStatus.NAMESPACE);
AgentStatus.NAMESPACE);
agentStatus.setValue("max-chats", "" + maxChats);
presence.addExtension(agentStatus);
presence.addExtension(new MetaData(this.metaData));
PacketCollector collector = this.connection.createPacketCollector(new AndFilter(new PacketTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)));
PacketCollector collector = this.connection.createPacketCollector(new AndFilter(
new PacketTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)));
this.connection.sendPacket(presence);
@ -379,10 +390,11 @@ public class AgentSession {
*
* @param presenceMode the presence mode of the agent.
* @param status sets the status message of the presence update.
* @throws XMPPException if an error occurs setting the agent status.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws IllegalStateException if the agent is not online with the workgroup.
*/
public void setStatus(Presence.Mode presenceMode, String status) throws XMPPException {
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
@ -433,8 +445,9 @@ public class AgentSession {
* @param userID the id of the user to get his conversations.
* @return the transcripts of a given user.
* @throws XMPPException if an error occurs while getting the information.
* @throws SmackException
*/
public Transcripts getTranscripts(String userID) throws XMPPException {
public Transcripts getTranscripts(String userID) throws XMPPException, SmackException {
return transcriptManager.getTranscripts(workgroupJID, userID);
}
@ -444,8 +457,9 @@ public class AgentSession {
* @param sessionID the id of the session to get the full transcript.
* @return the full conversation transcript of a given session.
* @throws XMPPException if an error occurs while getting the information.
* @throws SmackException
*/
public Transcript getTranscript(String sessionID) throws XMPPException {
public Transcript getTranscript(String sessionID) throws XMPPException, SmackException {
return transcriptManager.getTranscript(workgroupJID, sessionID);
}
@ -456,8 +470,9 @@ public class AgentSession {
*
* @return the Form to use for searching transcripts.
* @throws XMPPException if an error occurs while sending the request to the server.
* @throws SmackException
*/
public Form getTranscriptSearchForm() throws XMPPException {
public Form getTranscriptSearchForm() throws XMPPException, SmackException {
return transcriptSearchManager.getSearchForm(StringUtils.parseServer(workgroupJID));
}
@ -468,9 +483,10 @@ public class AgentSession {
*
* @param completedForm the filled out search form.
* @return the result of the transcript search.
* @throws XMPPException if an error occurs while submiting the search to the server.
* @throws SmackException
* @throws XMPPException
*/
public ReportedData searchTranscripts(Form completedForm) throws XMPPException {
public ReportedData searchTranscripts(Form completedForm) throws XMPPException, SmackException {
return transcriptSearchManager.submitSearch(StringUtils.parseServer(workgroupJID),
completedForm);
}
@ -482,9 +498,10 @@ public class AgentSession {
*
* @param roomID the room to get information about its occupants.
* @return information about the occupants of the specified room.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public OccupantsInfo getOccupantsInfo(String roomID) throws XMPPException {
public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException {
OccupantsInfo request = new OccupantsInfo(roomID);
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -758,9 +775,10 @@ public class AgentSession {
*
* @param sessionID the session id of a Chat Session.
* @param note the chat note to add.
* @throws XMPPException is thrown if an error occurs while adding the note.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public void setNote(String sessionID, String note) throws XMPPException {
public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException {
note = ChatNotes.replace(note, "\n", "\\n");
note = StringUtils.escapeForXML(note);
@ -777,9 +795,10 @@ public class AgentSession {
*
* @param sessionID the sessionID of the chat session.
* @return the <code>ChatNote</code> associated with a given chat session.
* @throws XMPPException if an error occurs while retrieving the ChatNote.
* @throws XMPPErrorException if an error occurs while retrieving the ChatNote.
* @throws NoResponseException
*/
public ChatNotes getNote(String sessionID) throws XMPPException {
public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException {
ChatNotes request = new ChatNotes();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -819,9 +838,10 @@ public class AgentSession {
* Asks the workgroup for it's Search Settings.
*
* @return SearchSettings the search settings for this workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public SearchSettings getSearchSettings() throws XMPPException {
public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException {
SearchSettings request = new SearchSettings();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -835,9 +855,10 @@ public class AgentSession {
*
* @param global true to retrieve global macros, otherwise false for personal macros.
* @return MacroGroup the root macro group.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException if an error occurs while getting information from the server.
* @throws NoResponseException
*/
public MacroGroup getMacros(boolean global) throws XMPPException {
public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException {
Macros request = new Macros();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -851,9 +872,10 @@ public class AgentSession {
* Persists the Personal Macro for an agent.
*
* @param group the macro group to save.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public void saveMacros(MacroGroup group) throws XMPPException {
public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException {
Macros request = new Macros();
request.setType(IQ.Type.SET);
request.setTo(workgroupJID);
@ -904,11 +926,12 @@ public class AgentSession {
* @param invitee JID of entity that will get the invitation.
* @param sessionID ID of the support session that the invitee is being invited.
* @param reason the reason of the invitation.
* @throws XMPPException if the sender of the invitation is not an agent or the service failed to process
* @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
* the request.
* @throws NoResponseException
*/
public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason)
throws XMPPException {
public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException
{
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new IQ() {
@ -944,11 +967,12 @@ public class AgentSession {
* @param invitee JID of entity that will get the invitation.
* @param sessionID ID of the support session that the invitee is being invited.
* @param reason the reason of the invitation.
* @throws XMPPException if the sender of the invitation is not an agent or the service failed to process
* @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
* the request.
* @throws NoResponseException
*/
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason)
throws XMPPException {
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException
{
final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason);
IQ iq = new IQ() {
@ -968,10 +992,11 @@ public class AgentSession {
*
* @param con the XMPPConnection to use.
* @param query an optional query object used to tell the server what metadata to retrieve. This can be null.
* @throws XMPPException if an error occurs while sending the request to the server.
* @return the settings for the workgroup.
* @throws XMPPErrorException if an error occurs while sending the request to the server.
* @throws NoResponseException
*/
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws XMPPException {
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException {
GenericSettings setting = new GenericSettings();
setting.setType(IQ.Type.GET);
setting.setTo(workgroupJID);
@ -981,7 +1006,7 @@ public class AgentSession {
return response;
}
public boolean hasMonitorPrivileges(XMPPConnection con) throws XMPPException {
public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException {
MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -990,7 +1015,7 @@ public class AgentSession {
return response.isMonitor();
}
public void makeRoomOwner(XMPPConnection con, String sessionID) throws XMPPException {
public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException {
MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.SET);
request.setTo(workgroupJID);

View file

@ -19,8 +19,9 @@ package org.jivesoftware.smackx.workgroup.agent;
import org.jivesoftware.smackx.workgroup.packet.Transcript;
import org.jivesoftware.smackx.workgroup.packet.Transcripts;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
/**
* A TranscriptManager helps to retrieve the full conversation transcript of a given session
@ -42,9 +43,10 @@ public class TranscriptManager {
* @param sessionID the id of the session to get the full transcript.
* @param workgroupJID the JID of the workgroup that will process the request.
* @return the full conversation transcript of a given session.
* @throws XMPPException if an error occurs while getting the information.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public Transcript getTranscript(String workgroupJID, String sessionID) throws XMPPException {
public Transcript getTranscript(String workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException {
Transcript request = new Transcript(sessionID);
request.setTo(workgroupJID);
Transcript response = (Transcript) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -58,9 +60,10 @@ public class TranscriptManager {
* @param userID the id of the user to get his conversations.
* @param workgroupJID the JID of the workgroup that will process the request.
* @return the transcripts of a given user.
* @throws XMPPException if an error occurs while getting the information.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public Transcripts getTranscripts(String workgroupJID, String userID) throws XMPPException {
public Transcripts getTranscripts(String workgroupJID, String userID) throws NoResponseException, XMPPErrorException {
Transcripts request = new Transcripts(userID);
request.setTo(workgroupJID);
Transcripts response = (Transcripts) connection.createPacketCollectorAndSend(request).nextResultOrThrow();

View file

@ -20,8 +20,9 @@ package org.jivesoftware.smackx.workgroup.agent;
import org.jivesoftware.smackx.search.ReportedData;
import org.jivesoftware.smackx.workgroup.packet.TranscriptSearch;
import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ;
/**
@ -45,9 +46,10 @@ public class TranscriptSearchManager {
*
* @param serviceJID the address of the workgroup service.
* @return the Form to use for searching transcripts.
* @throws XMPPException if an error occurs while sending the request to the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public Form getSearchForm(String serviceJID) throws XMPPException {
public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException {
TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.GET);
search.setTo(serviceJID);
@ -65,9 +67,10 @@ public class TranscriptSearchManager {
* @param serviceJID the address of the workgroup service.
* @param completedForm the filled out search form.
* @return the result of the transcript search.
* @throws XMPPException if an error occurs while submiting the search to the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public ReportedData submitSearch(String serviceJID, Form completedForm) throws XMPPException {
public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException {
TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.GET);
search.setTo(serviceJID);

View file

@ -29,6 +29,8 @@ import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.util.StringUtils;
@ -153,9 +155,10 @@ public class Workgroup {
* available only when agents are available for this workgroup.
*
* @return true if the workgroup is available for receiving new requests.
* @throws XMPPException
* @throws XMPPErrorException
* @throws NoResponseException
*/
public boolean isAvailable() throws XMPPException {
public boolean isAvailable() throws NoResponseException, XMPPErrorException {
Presence directedPresence = new Presence(Presence.Type.available);
directedPresence.setTo(workgroupJID);
PacketFilter typeFilter = new PacketTypeFilter(Presence.class);
@ -230,8 +233,9 @@ public class Workgroup {
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
*/
public void joinQueue() throws XMPPException {
public void joinQueue() throws XMPPException, SmackException {
joinQueue(null);
}
@ -267,8 +271,9 @@ public class Workgroup {
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
*/
public void joinQueue(Form answerForm) throws XMPPException {
public void joinQueue(Form answerForm) throws XMPPException, SmackException {
joinQueue(answerForm, null);
}
@ -301,11 +306,12 @@ public class Workgroup {
* @param answerForm the completed form associated with the join reqest.
* @param userID String that represents the ID of the user when using anonymous sessions
* or <tt>null</tt> if a userID should not be used.
* @throws XMPPException if an error occured joining the queue. An error may indicate
* @throws XMPPErrorException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws NoResponseException
*/
public void joinQueue(Form answerForm, String userID) throws XMPPException {
public void joinQueue(Form answerForm, String userID) throws NoResponseException, XMPPErrorException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
@ -350,8 +356,9 @@ public class Workgroup {
* @throws XMPPException if an error occured joining the queue. An error may indicate
* that a connection failure occured or that the server explicitly rejected the
* request to join the queue.
* @throws SmackException
*/
public void joinQueue(Map<String,Object> metadata, String userID) throws XMPPException {
public void joinQueue(Map<String,Object> metadata, String userID) throws XMPPException, SmackException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
@ -383,10 +390,11 @@ public class Workgroup {
* under certain circumstances -- for example, if they no longer wish to be routed
* to an agent because they've been waiting too long.
*
* @throws XMPPException if an error occured trying to send the depart queue
* @throws XMPPErrorException if an error occured trying to send the depart queue
* request to the server.
* @throws NoResponseException
*/
public void departQueue() throws XMPPException {
public void departQueue() throws NoResponseException, XMPPErrorException {
// If not in the queue ignore the depart request.
if (!inQueue) {
return;
@ -589,8 +597,9 @@ public class Workgroup {
* @param key the key to find.
* @return the ChatSetting if found, otherwise false.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
*/
public ChatSetting getChatSetting(String key) throws XMPPException {
public ChatSetting getChatSetting(String key) throws XMPPException, SmackException {
ChatSettings chatSettings = getChatSettings(key, -1);
return chatSettings.getFirstEntry();
}
@ -601,8 +610,9 @@ public class Workgroup {
* @param type the type of ChatSettings to return.
* @return the ChatSettings of given type, otherwise null.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
*/
public ChatSettings getChatSettings(int type) throws XMPPException {
public ChatSettings getChatSettings(int type) throws XMPPException, SmackException {
return getChatSettings(null, type);
}
@ -611,8 +621,9 @@ public class Workgroup {
*
* @return all ChatSettings of a given workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws SmackException
*/
public ChatSettings getChatSettings() throws XMPPException {
public ChatSettings getChatSettings() throws XMPPException, SmackException {
return getChatSettings(null, -1);
}
@ -621,9 +632,10 @@ public class Workgroup {
* Asks the workgroup for it's Chat Settings.
*
* @return key specify a key to retrieve only that settings. Otherwise for all settings, key should be null.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws NoResponseException
* @throws XMPPErrorException if an error occurs while getting information from the server.
*/
private ChatSettings getChatSettings(String key, int type) throws XMPPException {
private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException {
ChatSettings request = new ChatSettings();
if (key != null) {
request.setKey(key);
@ -644,8 +656,9 @@ public class Workgroup {
* to see if the email service has been configured and is available.
*
* @return true if the email service is available, otherwise return false.
* @throws SmackException
*/
public boolean isEmailAvailable() {
public boolean isEmailAvailable() throws SmackException {
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);
try {
@ -662,9 +675,10 @@ public class Workgroup {
* Asks the workgroup for it's Offline Settings.
*
* @return offlineSettings the offline settings for this workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public OfflineSettings getOfflineSettings() throws XMPPException {
public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException {
OfflineSettings request = new OfflineSettings();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -678,9 +692,10 @@ public class Workgroup {
* Asks the workgroup for it's Sound Settings.
*
* @return soundSettings the sound settings for the specified workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public SoundSettings getSoundSettings() throws XMPPException {
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException {
SoundSettings request = new SoundSettings();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -693,9 +708,10 @@ public class Workgroup {
* Asks the workgroup for it's Properties
*
* @return the WorkgroupProperties for the specified workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public WorkgroupProperties getWorkgroupProperties() throws XMPPException {
public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException {
WorkgroupProperties request = new WorkgroupProperties();
request.setType(IQ.Type.GET);
request.setTo(workgroupJID);
@ -710,9 +726,10 @@ public class Workgroup {
*
* @param jid the jid of the user who's information you would like the workgroup to retreive.
* @return the WorkgroupProperties for the specified workgroup.
* @throws XMPPException if an error occurs while getting information from the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public WorkgroupProperties getWorkgroupProperties(String jid) throws XMPPException {
public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException {
WorkgroupProperties request = new WorkgroupProperties();
request.setJid(jid);
request.setType(IQ.Type.GET);
@ -730,9 +747,10 @@ public class Workgroup {
* for future submissions.
*
* @return the Form to use for searching transcripts.
* @throws XMPPException if an error occurs while sending the request to the server.
* @throws XMPPErrorException
* @throws NoResponseException
*/
public Form getWorkgroupForm() throws XMPPException {
public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException {
WorkgroupForm workgroupForm = new WorkgroupForm();
workgroupForm.setType(IQ.Type.GET);
workgroupForm.setTo(workgroupJID);