1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-27 14:32:06 +01:00

Add more javadoc

This commit is contained in:
vanitasvitae 2017-07-12 10:39:51 +02:00
parent e11a4ea9c5
commit b08e03af8d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -43,15 +43,16 @@ public class JingleUtil {
} }
/** /**
* Initiate a Jingle session.
* XEP-0166 Example 10. * XEP-0166 Example 10.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId
* @param contentCreator * @param contentCreator creator of the content.
* @param contentName * @param contentName name of the content.
* @param contentSenders * @param contentSenders sender of the content.
* @param description * @param description description of the content.
* @param transport * @param transport used transport.
* @return * @return session-initiate stanza.
*/ */
public Jingle createSessionInitiate(FullJid recipient, public Jingle createSessionInitiate(FullJid recipient,
String sessionId, String sessionId,
@ -81,14 +82,15 @@ public class JingleUtil {
} }
/** /**
* Initiate a file transfer session.
* XEP-0234 Example 1. * XEP-0234 Example 1.
* @param recipient * @param recipient recipient of the file transfer.
* @param sessionId * @param sessionId sessionId.
* @param contentCreator * @param contentCreator creator of the content.
* @param contentName * @param contentName name of the content.
* @param description * @param description description of the content.
* @param transport * @param transport used transport.
* @return * @return session-initiate stanza.
*/ */
public Jingle createSessionInitiateFileOffer(FullJid recipient, public Jingle createSessionInitiateFileOffer(FullJid recipient,
String sessionId, String sessionId,
@ -130,15 +132,16 @@ public class JingleUtil {
} }
/** /**
* Accept a session.
* XEP-0166 Example 17. * XEP-0166 Example 17.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @param contentCreator * @param contentCreator creator of the content.
* @param contentName * @param contentName name of the content.
* @param contentSenders * @param contentSenders sender of the content.
* @param description * @param description description of the content.
* @param transport * @param transport proposed transport.
* @return * @return session-accept stanza.
*/ */
public Jingle createSessionAccept(FullJid recipient, public Jingle createSessionAccept(FullJid recipient,
String sessionId, String sessionId,
@ -184,11 +187,12 @@ public class JingleUtil {
} }
/** /**
* Create a session-terminate stanza.
* XEP-0166 §6.7. * XEP-0166 §6.7.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @param reason * @param reason reason of termination.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) { public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason reason) {
Jingle.Builder jb = Jingle.getBuilder(); Jingle.Builder jb = Jingle.getBuilder();
@ -203,6 +207,14 @@ public class JingleUtil {
return jingle; return jingle;
} }
/**
* Create a session-terminate stanza.
* XEP-0166 §6.7.
* @param recipient recipient of the stanza.
* @param sessionId sessionId.
* @param reason reason of termination.
* @return session-terminate stanza.
*/
public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason.Reason reason) { public Jingle createSessionTerminate(FullJid recipient, String sessionId, JingleReason.Reason reason) {
return createSessionTerminate(recipient, sessionId, new JingleReason(reason)); return createSessionTerminate(recipient, sessionId, new JingleReason(reason));
} }
@ -224,10 +236,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session by declining.
* XEP-0166 Example 21. * XEP-0166 Example 21.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateDecline(FullJid recipient, String sessionId) { public Jingle createSessionTerminateDecline(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.decline); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.decline);
@ -242,10 +255,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to success.
* XEP-0166 Example 19. * XEP-0166 Example 19.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateSuccess(FullJid recipient, String sessionId) { public Jingle createSessionTerminateSuccess(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.success); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.success);
@ -260,10 +274,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to being busy.
* XEP-0166 Example 20. * XEP-0166 Example 20.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateBusy(FullJid recipient, String sessionId) { public Jingle createSessionTerminateBusy(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.busy); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.busy);
@ -278,11 +293,12 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to the existence of an alternative session.
* XEP-0166 Example 22. * XEP-0166 Example 22.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @param altSessionId * @param altSessionId id of the alternative session.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateAlternativeSession(FullJid recipient, String sessionId, String altSessionId) { public Jingle createSessionTerminateAlternativeSession(FullJid recipient, String sessionId, String altSessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.AlternativeSession(altSessionId)); return createSessionTerminate(recipient, sessionId, JingleReason.AlternativeSession(altSessionId));
@ -297,11 +313,11 @@ public class JingleUtil {
} }
/** /**
* XEP-0234 Example 9.
* Cancel all active transfers of the session. * Cancel all active transfers of the session.
* @param recipient * XEP-0234 Example 9.
* @param sessionId * @param recipient recipient of the stanza.
* @return * @param sessionId sessionId.
* @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateCancel(FullJid recipient, String sessionId) { public Jingle createSessionTerminateCancel(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.cancel); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.cancel);
@ -317,13 +333,13 @@ public class JingleUtil {
} }
/** /**
* Cancel a single contents transfer.
* XEP-0234 Example 10. * XEP-0234 Example 10.
* Cancel a single transfer. * @param recipient recipient of the stanza.
* @param recipient * @param sessionId sessionId.
* @param sessionId * @param contentCreator creator of the content.
* @param contentCreator * @param contentName name of the content.
* @param contentName * @return session-terminate stanza.
* @return
*/ */
public Jingle createSessionTerminateContentCancel(FullJid recipient, String sessionId, public Jingle createSessionTerminateContentCancel(FullJid recipient, String sessionId,
JingleContent.Creator contentCreator, String contentName) { JingleContent.Creator contentCreator, String contentName) {
@ -350,10 +366,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to unsupported transport methods.
* XEP-0166 Example 23. * XEP-0166 Example 23.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateUnsupportedTransports(FullJid recipient, String sessionId) { public Jingle createSessionTerminateUnsupportedTransports(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_transports); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_transports);
@ -367,10 +384,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to failed transports.
* XEP-0166 Example 24. * XEP-0166 Example 24.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateFailedTransport(FullJid recipient, String sessionId) { public Jingle createSessionTerminateFailedTransport(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_transport); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_transport);
@ -384,10 +402,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to unsupported applications.
* XEP-0166 Example 25. * XEP-0166 Example 25.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateUnsupportedApplications(FullJid recipient, String sessionId) { public Jingle createSessionTerminateUnsupportedApplications(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_applications); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.unsupported_applications);
@ -401,10 +420,11 @@ public class JingleUtil {
} }
/** /**
* Terminate the session due to failed application.
* XEP-0166 Example 26. * XEP-0166 Example 26.
* @param recipient * @param recipient recipient of the stanza.
* @param sessionId * @param sessionId sessionId.
* @return * @return session-terminate stanza.
*/ */
public Jingle createSessionTerminateFailedApplication(FullJid recipient, String sessionId) { public Jingle createSessionTerminateFailedApplication(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_application); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.failed_application);
@ -418,10 +438,11 @@ public class JingleUtil {
} }
/** /**
* Terminate session due to incompatible parameters.
* XEP-0166 Example 27. * XEP-0166 Example 27.
* @param recipient * @param recipient recipient of the stanza
* @param sessionId * @param sessionId sessionId
* @return * @return session-terminate stanza
*/ */
public Jingle createSessionTerminateIncompatibleParameters(FullJid recipient, String sessionId) { public Jingle createSessionTerminateIncompatibleParameters(FullJid recipient, String sessionId) {
return createSessionTerminate(recipient, sessionId, JingleReason.Reason.incompatible_parameters); return createSessionTerminate(recipient, sessionId, JingleReason.Reason.incompatible_parameters);
@ -439,10 +460,11 @@ public class JingleUtil {
} }
/** /**
* Create a session ping stanza.
* XEP-0166 Example 32. * XEP-0166 Example 32.
* @param recipient * @param recipient recipient of the stanza
* @param sessionId * @param sessionId id of the session
* @return * @return ping stanza
*/ */
public Jingle createSessionPing(FullJid recipient, String sessionId) { public Jingle createSessionPing(FullJid recipient, String sessionId) {
Jingle.Builder jb = Jingle.getBuilder(); Jingle.Builder jb = Jingle.getBuilder();
@ -464,9 +486,10 @@ public class JingleUtil {
} }
/** /**
* Acknowledge the receipt of a stanza.
* XEP-0166 Example 5. * XEP-0166 Example 5.
* @param jingle * @param jingle stanza that was received
* @return * @return acknowledgement
*/ */
public IQ createAck(Jingle jingle) { public IQ createAck(Jingle jingle) {
return IQ.createResultIQ(jingle); return IQ.createResultIQ(jingle);
@ -477,14 +500,15 @@ public class JingleUtil {
} }
/** /**
* Replace a transport with another one.
* XEP-0260 Example 15. * XEP-0260 Example 15.
* @param recipient * @param recipient recipient of the stanza
* @param initiator * @param initiator initiator of the session
* @param sessionId * @param sessionId sessionId
* @param contentCreator * @param contentCreator creator of the content
* @param contentName * @param contentName name of the content
* @param transport * @param transport proposed transport
* @return * @return transport-replace stanza
*/ */
public Jingle createTransportReplace(FullJid recipient, FullJid initiator, String sessionId, public Jingle createTransportReplace(FullJid recipient, FullJid initiator, String sessionId,
JingleContent.Creator contentCreator, String contentName, JingleContent.Creator contentCreator, String contentName,
@ -514,14 +538,15 @@ public class JingleUtil {
} }
/** /**
* Accept a transport.
* XEP-0260 Example 17. * XEP-0260 Example 17.
* @param recipient * @param recipient recipient of the stanza
* @param initiator * @param initiator initiator of the session
* @param sessionId * @param sessionId sessionId
* @param contentCreator * @param contentCreator creator of the content
* @param contentName * @param contentName name of the content
* @param transport * @param transport transport to accept
* @return * @return transport-accept stanza
*/ */
public Jingle createTransportAccept(FullJid recipient, FullJid initiator, String sessionId, public Jingle createTransportAccept(FullJid recipient, FullJid initiator, String sessionId,
JingleContent.Creator contentCreator, String contentName, JingleContent.Creator contentCreator, String contentName,
@ -551,14 +576,15 @@ public class JingleUtil {
} }
/** /**
* Reject a transport.
* XEP-0166 §7.2.14. * XEP-0166 §7.2.14.
* @param recipient * @param recipient recipient of the stanza
* @param initiator * @param initiator initiator of the session
* @param sessionId * @param sessionId sessionId
* @param contentCreator * @param contentCreator creator of the content
* @param contentName * @param contentName name of the content
* @param transport * @param transport transport to reject
* @return * @return transport-reject stanza
*/ */
public Jingle createTransportReject(FullJid recipient, FullJid initiator, String sessionId, public Jingle createTransportReject(FullJid recipient, FullJid initiator, String sessionId,
JingleContent.Creator contentCreator, String contentName, JingleContent.Creator contentCreator, String contentName,
@ -592,6 +618,7 @@ public class JingleUtil {
*/ */
/** /**
* Create an error response to a request with an unknown session id.
* XEP-0166 Example 29. * XEP-0166 Example 29.
* @param request request with unknown sessionId. * @param request request with unknown sessionId.
* @return error stanza. * @return error stanza.
@ -609,6 +636,7 @@ public class JingleUtil {
} }
/** /**
* Create an error response to a request coming from a unknown initiator.
* XEP-0166 Example 12. * XEP-0166 Example 12.
* @param request request from unknown initiator. * @param request request from unknown initiator.
* @return error stanza. * @return error stanza.
@ -624,6 +652,7 @@ public class JingleUtil {
} }
/** /**
* Create an error response to a request with an unsupported info.
* XEP-0166 Example 31. * XEP-0166 Example 31.
* @param request request with unsupported info. * @param request request with unsupported info.
* @return error stanza. * @return error stanza.
@ -641,6 +670,7 @@ public class JingleUtil {
} }
/** /**
* Create an error response to a tie-breaking request.
* XEP-0166 Example 34. * XEP-0166 Example 34.
* @param request tie-breaking request * @param request tie-breaking request
* @return error stanza * @return error stanza
@ -657,6 +687,12 @@ public class JingleUtil {
connection.sendStanza(createErrorTieBreak(request)); connection.sendStanza(createErrorTieBreak(request));
} }
/**
* Create an error response to a request that was out of order.
* TODO: Find example.
* @param request request out of order.
* @return error stanza.
*/
public IQ createErrorOutOfOrder(Jingle request) { public IQ createErrorOutOfOrder(Jingle request) {
XMPPError.Builder error = XMPPError.getBuilder(); XMPPError.Builder error = XMPPError.getBuilder();
error.setCondition(XMPPError.Condition.unexpected_request) error.setCondition(XMPPError.Condition.unexpected_request)
@ -670,9 +706,10 @@ public class JingleUtil {
} }
/** /**
* Create an error response to a malformed request.
* XEP-0166 Ex. 16 * XEP-0166 Ex. 16
* @param request * @param request malformed request
* @return * @return error stanza.
*/ */
public IQ createErrorMalformedRequest(Jingle request) { public IQ createErrorMalformedRequest(Jingle request) {
XMPPError.Builder error = XMPPError.getBuilder(); XMPPError.Builder error = XMPPError.getBuilder();