public abstract class StreamNegotiator extends Manager
Modifier and Type | Field and Description |
---|---|
protected static EventManger<String,IQ,SmackException.NotConnectedException> |
initationSetEvents
A event manager for stream initiation requests send to us.
|
Modifier | Constructor and Description |
---|---|
protected |
StreamNegotiator(XMPPConnection connection) |
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
createIncomingStream(StreamInitiation initiation)
This method handles the file stream download negotiation process.
|
protected static StreamInitiation |
createInitiationAccept(StreamInitiation streamInitiationOffer,
String[] namespaces)
Creates the initiation acceptance stanza to forward to the stream
initiator.
|
abstract OutputStream |
createOutgoingStream(String streamID,
org.jxmpp.jid.Jid initiator,
org.jxmpp.jid.Jid target)
This method handles the file upload stream negotiation process.
|
abstract String[] |
getNamespaces()
Returns the XMPP namespace reserved for this particular type of file
transfer.
|
protected IQ |
initiateIncomingStream(XMPPConnection connection,
StreamInitiation initiation) |
protected abstract void |
newStreamInitiation(org.jxmpp.jid.Jid from,
String streamID)
Signal that a new stream initiation arrived.
|
static void |
signal(String eventKey,
IQ eventValue) |
connection, getAuthenticatedConnectionOrThrow, schedule
protected static final EventManger<String,IQ,SmackException.NotConnectedException> initationSetEvents
Those are typical XEP-45 Open or XEP-65 Bytestream IQ requests. The even key is in the format "initiationFrom + '\t' + streamId"
protected StreamNegotiator(XMPPConnection connection)
protected static StreamInitiation createInitiationAccept(StreamInitiation streamInitiationOffer, String[] namespaces)
streamInitiationOffer
- The offer from the stream initiator to connect for a stream.namespaces
- The namespace that relates to the accepted means of transfer.protected final IQ initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
protected abstract void newStreamInitiation(org.jxmpp.jid.Jid from, String streamID)
from
- The initiator of the file transfer.streamID
- The stream ID related to the transfer.public abstract InputStream createIncomingStream(StreamInitiation initiation) throws XMPPException.XMPPErrorException, InterruptedException, SmackException
initiation
- The initiation that triggered this download.XMPPException.XMPPErrorException
- If an error occurs during this process an XMPPException is
thrown.InterruptedException
- If thread is interrupted.SmackException
public abstract OutputStream createOutgoingStream(String streamID, org.jxmpp.jid.Jid initiator, org.jxmpp.jid.Jid target) throws SmackException, XMPPException, InterruptedException
streamID
- The streamID that uniquely identifies the file transfer.initiator
- The fully-qualified JID of the initiator of the file transfer.target
- The fully-qualified JID of the target or receiver of the file
transfer.SmackException
XMPPException
InterruptedException
public abstract String[] getNamespaces()