mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
"not connected" is now a checked Exception thrown by sendPacket()
There is a unsolveable race condition between the connection state and sendPacket(), i.e. the connection could go down, right after the method calling sendPacket is called, but before sendPacket() is invoked. Before this change, sendPacket() has thrown an unchecked IllegalStateException, which could be ignored by the Smack user, who would also not notice the race condition. We have decided to throw a checked Exception in this case now, to make the Smack user aware of this situation. SMACK-426
This commit is contained in:
parent
d8c656270e
commit
fcc8414a92
101 changed files with 845 additions and 382 deletions
|
@ -20,6 +20,7 @@ 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.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -35,7 +36,7 @@ public class Agent {
|
|||
private XMPPConnection connection;
|
||||
private String workgroupJID;
|
||||
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException {
|
||||
public static Collection<String> getWorkgroups(String serviceJID, String agentJID, XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
AgentWorkgroups request = new AgentWorkgroups(agentJID);
|
||||
request.setTo(serviceJID);
|
||||
AgentWorkgroups response = (AgentWorkgroups) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
|
@ -65,8 +66,9 @@ public class Agent {
|
|||
* @return - the agents name.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public String getName() throws NoResponseException, XMPPErrorException {
|
||||
public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
AgentInfo agentInfo = new AgentInfo();
|
||||
agentInfo.setType(IQ.Type.GET);
|
||||
agentInfo.setTo(workgroupJID);
|
||||
|
@ -84,8 +86,9 @@ public class Agent {
|
|||
* @param newName the new name of the agent.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void setName(String newName) throws NoResponseException, XMPPErrorException {
|
||||
public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
AgentInfo agentInfo = new AgentInfo();
|
||||
agentInfo.setType(IQ.Type.SET);
|
||||
agentInfo.setTo(workgroupJID);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jivesoftware.smackx.workgroup.agent;
|
|||
import org.jivesoftware.smackx.workgroup.packet.AgentStatus;
|
||||
import org.jivesoftware.smackx.workgroup.packet.AgentStatusRequest;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
|
@ -62,8 +63,9 @@ public class AgentRoster {
|
|||
* Constructs a new AgentRoster.
|
||||
*
|
||||
* @param connection an XMPP connection.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
AgentRoster(XMPPConnection connection, String workgroupJID) {
|
||||
AgentRoster(XMPPConnection connection, String workgroupJID) throws NotConnectedException {
|
||||
this.connection = connection;
|
||||
this.workgroupJID = workgroupJID;
|
||||
entries = new ArrayList<String>();
|
||||
|
@ -86,8 +88,9 @@ public class AgentRoster {
|
|||
* Reloads the entire roster from the server. This is an asynchronous operation,
|
||||
* which means the method will return immediately, and the roster will be
|
||||
* reloaded at a later point when the server responds to the reload request.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void reload() {
|
||||
public void reload() throws NotConnectedException {
|
||||
AgentStatusRequest request = new AgentStatusRequest();
|
||||
request.setTo(workgroupJID);
|
||||
connection.sendPacket(request);
|
||||
|
|
|
@ -35,6 +35,7 @@ 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.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.*;
|
||||
import org.jivesoftware.smack.packet.*;
|
||||
|
@ -143,8 +144,9 @@ public class AgentSession {
|
|||
* Returns the agent roster for the workgroup, which contains
|
||||
*
|
||||
* @return the AgentRoster
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public AgentRoster getAgentRoster() {
|
||||
public AgentRoster getAgentRoster() throws NotConnectedException {
|
||||
if (agentRoster == null) {
|
||||
agentRoster = new AgentRoster(connection, workgroupJID);
|
||||
}
|
||||
|
@ -340,10 +342,11 @@ public class AgentSession {
|
|||
* @param status sets the status message of the presence update.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws IllegalStateException if the agent is not online with the workgroup.
|
||||
*/
|
||||
public void setStatus(Presence.Mode presenceMode, int maxChats, String status)
|
||||
throws NoResponseException, XMPPErrorException {
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
if (!online) {
|
||||
throw new IllegalStateException("Cannot set status when the agent is not online.");
|
||||
}
|
||||
|
@ -392,9 +395,10 @@ public class AgentSession {
|
|||
* @param status sets the status message of the presence update.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
* @throws IllegalStateException if the agent is not online with the workgroup.
|
||||
*/
|
||||
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException {
|
||||
public void setStatus(Presence.Mode presenceMode, String status) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
if (!online) {
|
||||
throw new IllegalStateException("Cannot set status when the agent is not online.");
|
||||
}
|
||||
|
@ -429,8 +433,9 @@ public class AgentSession {
|
|||
*
|
||||
* @param userID the ID of the user to remove.
|
||||
* @throws XMPPException if an exception occurs.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void dequeueUser(String userID) throws XMPPException {
|
||||
public void dequeueUser(String userID) throws XMPPException, NotConnectedException {
|
||||
// todo: this method simply won't work right now.
|
||||
DepartQueuePacket departPacket = new DepartQueuePacket(this.workgroupJID);
|
||||
|
||||
|
@ -500,8 +505,9 @@ public class AgentSession {
|
|||
* @return information about the occupants of the specified room.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException {
|
||||
public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
OccupantsInfo request = new OccupantsInfo(roomID);
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -658,7 +664,7 @@ public class AgentSession {
|
|||
|
||||
// PacketListener Implementation.
|
||||
|
||||
private void handlePacket(Packet packet) {
|
||||
private void handlePacket(Packet packet) throws NotConnectedException {
|
||||
if (packet instanceof OfferRequestProvider.OfferRequestPacket) {
|
||||
// Acknowledge the IQ set.
|
||||
IQ reply = new IQ() {
|
||||
|
@ -777,8 +783,9 @@ public class AgentSession {
|
|||
* @param note the chat note to add.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException {
|
||||
public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
note = ChatNotes.replace(note, "\n", "\\n");
|
||||
note = StringUtils.escapeForXML(note);
|
||||
|
||||
|
@ -797,8 +804,9 @@ public class AgentSession {
|
|||
* @return the <code>ChatNote</code> associated with a given chat session.
|
||||
* @throws XMPPErrorException if an error occurs while retrieving the ChatNote.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException {
|
||||
public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
ChatNotes request = new ChatNotes();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -815,8 +823,9 @@ public class AgentSession {
|
|||
* @param maxSessions the max number of sessions to retrieve.
|
||||
* @return the chat history associated with a given jid.
|
||||
* @throws XMPPException if an error occurs while retrieving the AgentChatHistory.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public AgentChatHistory getAgentHistory(String jid, int maxSessions, Date startDate) throws XMPPException {
|
||||
public AgentChatHistory getAgentHistory(String jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException {
|
||||
AgentChatHistory request;
|
||||
if (startDate != null) {
|
||||
request = new AgentChatHistory(jid, maxSessions, startDate);
|
||||
|
@ -840,8 +849,9 @@ public class AgentSession {
|
|||
* @return SearchSettings the search settings for this workgroup.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException {
|
||||
public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
SearchSettings request = new SearchSettings();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -857,8 +867,9 @@ public class AgentSession {
|
|||
* @return MacroGroup the root macro group.
|
||||
* @throws XMPPErrorException if an error occurs while getting information from the server.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException {
|
||||
public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Macros request = new Macros();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -874,8 +885,9 @@ public class AgentSession {
|
|||
* @param group the macro group to save.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException {
|
||||
public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Macros request = new Macros();
|
||||
request.setType(IQ.Type.SET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -891,8 +903,9 @@ public class AgentSession {
|
|||
* @param sessionID the sessionID to query for.
|
||||
* @return Map a map of all metadata associated with the sessionID.
|
||||
* @throws XMPPException if an error occurs while getting information from the server.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException {
|
||||
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException {
|
||||
ChatMetadata request = new ChatMetadata();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -929,8 +942,9 @@ public class AgentSession {
|
|||
* @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
|
||||
* the request.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException
|
||||
public void sendRoomInvitation(RoomInvitation.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
{
|
||||
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
|
||||
IQ iq = new IQ() {
|
||||
|
@ -970,8 +984,9 @@ public class AgentSession {
|
|||
* @throws XMPPErrorException if the sender of the invitation is not an agent or the service failed to process
|
||||
* the request.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException
|
||||
public void sendRoomTransfer(RoomTransfer.Type type, String invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
{
|
||||
final RoomTransfer transfer = new RoomTransfer(type, invitee, sessionID, reason);
|
||||
IQ iq = new IQ() {
|
||||
|
@ -995,8 +1010,9 @@ public class AgentSession {
|
|||
* @return the settings for the workgroup.
|
||||
* @throws XMPPErrorException if an error occurs while sending the request to the server.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException {
|
||||
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
GenericSettings setting = new GenericSettings();
|
||||
setting.setType(IQ.Type.GET);
|
||||
setting.setTo(workgroupJID);
|
||||
|
@ -1006,7 +1022,7 @@ public class AgentSession {
|
|||
return response;
|
||||
}
|
||||
|
||||
public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException {
|
||||
public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -1015,7 +1031,7 @@ public class AgentSession {
|
|||
return response.isMonitor();
|
||||
}
|
||||
|
||||
public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException {
|
||||
public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
MonitorPacket request = new MonitorPacket();
|
||||
request.setType(IQ.Type.SET);
|
||||
request.setTo(workgroupJID);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
@ -79,8 +80,9 @@ public class Offer {
|
|||
|
||||
/**
|
||||
* Accepts the offer.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void accept() {
|
||||
public void accept() throws NotConnectedException {
|
||||
Packet acceptPacket = new AcceptPacket(this.session.getWorkgroupJID());
|
||||
connection.sendPacket(acceptPacket);
|
||||
// TODO: listen for a reply.
|
||||
|
@ -89,8 +91,9 @@ public class Offer {
|
|||
|
||||
/**
|
||||
* Rejects the offer.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void reject() {
|
||||
public void reject() throws NotConnectedException {
|
||||
RejectPacket rejectPacket = new RejectPacket(this.session.getWorkgroupJID());
|
||||
connection.sendPacket(rejectPacket);
|
||||
// TODO: listen for a reply.
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.workgroup.agent;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
@ -44,7 +45,7 @@ public class OfferConfirmation extends IQ {
|
|||
}
|
||||
|
||||
|
||||
public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) {
|
||||
public void notifyService(XMPPConnection con, String workgroup, String createdRoomName) throws NotConnectedException {
|
||||
NotifyServicePacket packet = new NotifyServicePacket(workgroup, createdRoomName);
|
||||
con.sendPacket(packet);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ 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.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
|
||||
|
@ -45,8 +46,9 @@ public class TranscriptManager {
|
|||
* @return the full conversation transcript of a given session.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public Transcript getTranscript(String workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException {
|
||||
public Transcript getTranscript(String workgroupJID, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Transcript request = new Transcript(sessionID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcript response = (Transcript) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
|
@ -62,8 +64,9 @@ public class TranscriptManager {
|
|||
* @return the transcripts of a given user.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public Transcripts getTranscripts(String workgroupJID, String userID) throws NoResponseException, XMPPErrorException {
|
||||
public Transcripts getTranscripts(String workgroupJID, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Transcripts request = new Transcripts(userID);
|
||||
request.setTo(workgroupJID);
|
||||
Transcripts response = (Transcripts) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
|
|
|
@ -21,6 +21,7 @@ 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.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -48,8 +49,9 @@ public class TranscriptSearchManager {
|
|||
* @return the Form to use for searching transcripts.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException {
|
||||
public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
TranscriptSearch search = new TranscriptSearch();
|
||||
search.setType(IQ.Type.GET);
|
||||
search.setTo(serviceJID);
|
||||
|
@ -69,8 +71,9 @@ public class TranscriptSearchManager {
|
|||
* @return the result of the transcript search.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException {
|
||||
public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
TranscriptSearch search = new TranscriptSearch();
|
||||
search.setType(IQ.Type.GET);
|
||||
search.setTo(serviceJID);
|
||||
|
|
|
@ -30,6 +30,7 @@ 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.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.*;
|
||||
import org.jivesoftware.smack.packet.*;
|
||||
|
@ -157,8 +158,9 @@ public class Workgroup {
|
|||
* @return true if the workgroup is available for receiving new requests.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public boolean isAvailable() throws NoResponseException, XMPPErrorException {
|
||||
public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
Presence directedPresence = new Presence(Presence.Type.available);
|
||||
directedPresence.setTo(workgroupJID);
|
||||
PacketFilter typeFilter = new PacketTypeFilter(Presence.class);
|
||||
|
@ -310,8 +312,9 @@ public class Workgroup {
|
|||
* that a connection failure occured or that the server explicitly rejected the
|
||||
* request to join the queue.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void joinQueue(Form answerForm, String userID) throws NoResponseException, XMPPErrorException {
|
||||
public void joinQueue(Form answerForm, String userID) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
// If already in the queue ignore the join request.
|
||||
if (inQueue) {
|
||||
throw new IllegalStateException("Already in queue " + workgroupJID);
|
||||
|
@ -393,8 +396,9 @@ public class Workgroup {
|
|||
* @throws XMPPErrorException if an error occured trying to send the depart queue
|
||||
* request to the server.
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void departQueue() throws NoResponseException, XMPPErrorException {
|
||||
public void departQueue() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
// If not in the queue ignore the depart request.
|
||||
if (!inQueue) {
|
||||
return;
|
||||
|
@ -634,8 +638,9 @@ public class Workgroup {
|
|||
* @return key specify a key to retrieve only that settings. Otherwise for all settings, key should be null.
|
||||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException if an error occurs while getting information from the server.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException {
|
||||
private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
ChatSettings request = new ChatSettings();
|
||||
if (key != null) {
|
||||
request.setKey(key);
|
||||
|
@ -677,8 +682,9 @@ public class Workgroup {
|
|||
* @return offlineSettings the offline settings for this workgroup.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException {
|
||||
public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
OfflineSettings request = new OfflineSettings();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -694,8 +700,9 @@ public class Workgroup {
|
|||
* @return soundSettings the sound settings for the specified workgroup.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException {
|
||||
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
SoundSettings request = new SoundSettings();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -710,8 +717,9 @@ public class Workgroup {
|
|||
* @return the WorkgroupProperties for the specified workgroup.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException {
|
||||
public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
WorkgroupProperties request = new WorkgroupProperties();
|
||||
request.setType(IQ.Type.GET);
|
||||
request.setTo(workgroupJID);
|
||||
|
@ -728,8 +736,9 @@ public class Workgroup {
|
|||
* @return the WorkgroupProperties for the specified workgroup.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException {
|
||||
public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
WorkgroupProperties request = new WorkgroupProperties();
|
||||
request.setJid(jid);
|
||||
request.setType(IQ.Type.GET);
|
||||
|
@ -749,8 +758,9 @@ public class Workgroup {
|
|||
* @return the Form to use for searching transcripts.
|
||||
* @throws XMPPErrorException
|
||||
* @throws NoResponseException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException {
|
||||
public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
WorkgroupForm workgroupForm = new WorkgroupForm();
|
||||
workgroupForm.setType(IQ.Type.GET);
|
||||
workgroupForm.setTo(workgroupJID);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.jivesoftware.smack.PacketListener;
|
|||
import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.RosterEntry;
|
||||
import org.jivesoftware.smack.RosterGroup;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
@ -114,8 +115,9 @@ public class RosterExchangeManager {
|
|||
*
|
||||
* @param roster the roster to send
|
||||
* @param targetUserID the user that will receive the roster entries
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void send(Roster roster, String targetUserID) {
|
||||
public void send(Roster roster, String targetUserID) throws NotConnectedException {
|
||||
// Create a new message to send the roster
|
||||
Message msg = new Message(targetUserID);
|
||||
// Create a RosterExchange Package and add it to the message
|
||||
|
@ -132,8 +134,9 @@ public class RosterExchangeManager {
|
|||
*
|
||||
* @param rosterEntry the roster entry to send
|
||||
* @param targetUserID the user that will receive the roster entries
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void send(RosterEntry rosterEntry, String targetUserID) {
|
||||
public void send(RosterEntry rosterEntry, String targetUserID) throws NotConnectedException {
|
||||
// Create a new message to send the roster
|
||||
Message msg = new Message(targetUserID);
|
||||
// Create a RosterExchange Package and add it to the message
|
||||
|
@ -152,8 +155,9 @@ public class RosterExchangeManager {
|
|||
*
|
||||
* @param rosterGroup the roster group to send
|
||||
* @param targetUserID the user that will receive the roster entries
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void send(RosterGroup rosterGroup, String targetUserID) {
|
||||
public void send(RosterGroup rosterGroup, String targetUserID) throws NotConnectedException {
|
||||
// Create a new message to send the roster
|
||||
Message msg = new Message(targetUserID);
|
||||
// Create a RosterExchange Package and add it to the message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue