1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-11 18:19:38 +02:00
This commit is contained in:
vanitasvitae 2017-06-10 15:09:30 +02:00
parent 38f54b140c
commit 4728aa4452
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
13 changed files with 300 additions and 173 deletions

View file

@ -16,20 +16,12 @@
*/
package org.jivesoftware.smackx.jingle;
import java.io.IOException;
import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.bytestreams.BytestreamListener;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.jingle.element.Jingle;
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jxmpp.jid.FullJid;
/**
* This class defines the shape that JingleTransportManager must be of.
@ -46,18 +38,11 @@ public abstract class AbstractJingleTransportManager<D extends JingleContentTran
protected abstract JingleContentTransportProvider<D> createJingleContentTransportProvider();
public abstract JingleTransportHandler<D> createJingleTransportHandler(JingleSessionHandler sessionHandler);
public abstract D createJingleContentTransport(JingleManager.FullJidAndSessionId target) throws Exception;
public abstract D createJingleContentTransport(Jingle remotesRequest) throws Exception;
public abstract String getNamespace();
public Jingle createSessionInitiate(FullJid targetJID, JingleContentDescription application) throws XMPPException, IOException, InterruptedException, SmackException {
return createSessionInitiate(targetJID, application, JingleTransportManager.generateRandomId());
}
public abstract Jingle createSessionInitiate(FullJid targetJID, JingleContentDescription application, String sessionId) throws XMPPException, IOException, InterruptedException, SmackException;
public abstract Jingle createSessionAccept(Jingle request) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException;
public abstract BytestreamSession outgoingInitiatedSession(Jingle jingle) throws Exception;
public abstract void setIncomingRespondedSessionListener(Jingle jingle, BytestreamListener listener);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.jingle;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.jingle.element.Jingle;
@ -23,4 +24,6 @@ public interface JingleSessionHandler {
IQ handleJingleSessionRequest(Jingle jingle, String sessionId);
XMPPConnection getConnection();
}

View file

@ -0,0 +1,13 @@
package org.jivesoftware.smackx.jingle;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.jingle.exception.JingleTransportFailureException;
/**
* Created by vanitas on 10.06.17.
*/
public interface JingleTransportEstablishedCallback {
void onSessionEstablished(BytestreamSession bytestreamSession);
void onSessionFailure(JingleTransportFailureException reason);
}

View file

@ -0,0 +1,16 @@
package org.jivesoftware.smackx.jingle;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
/**
* Handler for JingleTransports
*/
public interface JingleTransportHandler<D extends JingleContentTransport> {
void establishOutgoingSession(JingleManager.FullJidAndSessionId target, JingleContentTransport transport, JingleTransportEstablishedCallback callback);
void establishIncomingSession(JingleManager.FullJidAndSessionId target, JingleContentTransport transport, JingleTransportEstablishedCallback callback);
XMPPConnection getConnection();
}

View file

@ -0,0 +1,11 @@
package org.jivesoftware.smackx.jingle.exception;
/**
* Created by vanitas on 10.06.17.
*/
public class JingleTransportFailureException extends Exception {
public JingleTransportFailureException(Throwable wrapped) {
super(wrapped);
}
}