public abstract class AbstractBoshConnector extends Object implements Connector
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractBoshConnector.BoshPacketReceivedHandler
Implemented by handlers of BoshPacketReceivedEvent.
|
static interface |
AbstractBoshConnector.BoshPacketSendingHandler
Implemented by handlers of BoshPacketSendingEvent.
|
Connector.ConnectedHandler, Connector.DisconnectedHandler, Connector.EncryptionEstablishedHandler, Connector.ErrorHandler, Connector.StanzaReceivedHandler, Connector.StanzaSendingHandler, Connector.State, Connector.StateChangedHandler, Connector.StreamRestartedHandler, Connector.StreamTerminatedHandler
Modifier and Type | Field and Description |
---|---|
static String |
BOSH_SERVICE_URL_KEY
Name of property that specify BOSH service URL.
Type: String. |
protected Context |
context |
protected Logger |
log |
protected Set<BoshRequest> |
requests |
static String |
RID_KEY
Type: Long.
|
static String |
SID_KEY
Name of property that specify BOSH Session ID.
Type: String. |
COMPRESSED_KEY, CONNECTOR_STAGE_KEY, CONNECTOR_STAGE_TIMESTAMP_KEY, DISABLE_KEEPALIVE_KEY, ENCRYPTED_KEY, EXTERNAL_KEEPALIVE_KEY, PROXY_HOST, PROXY_PORT, PROXY_TYPE, RECONNECTING_KEY, SEE_OTHER_HOST_KEY, TRUST_MANAGERS_KEY
Constructor and Description |
---|
AbstractBoshConnector(Context context) |
Modifier and Type | Method and Description |
---|---|
protected void |
addToRequests(BoshRequest worker) |
protected int |
countActiveRequests() |
XmppSessionLogic |
createSessionLogic(XmppModulesManager modulesManager,
PacketWriter writer)
Returns instance of XmppSessionLogic to work with this
connector.
|
protected void |
fireOnConnected(SessionObject sessionObject) |
protected void |
fireOnError(int responseCode,
String responseData,
Element response,
Throwable caught,
SessionObject sessionObject) |
protected void |
fireOnStanzaReceived(int responseCode,
String responseData,
Element response,
SessionObject sessionObject) |
protected void |
fireOnTerminate(int responseCode,
String responseData,
Element response,
SessionObject sessionObject) |
protected String |
getSid() |
Connector.State |
getState()
Returns current State of connector.
|
boolean |
isCompressed()
Returns XML Stream compression state.
|
boolean |
isSecure()
Returns connection security state.
|
void |
keepalive()
Whitespace ping.
|
protected Long |
nextRid() |
protected void |
onError(BoshRequest request,
int responseCode,
String responseData,
Element response,
Throwable caught) |
protected void |
onResponse(BoshRequest request,
int responseCode,
String responseData,
Element response) |
protected void |
onTerminate(BoshRequest request,
int responseCode,
String responseData,
Element response) |
protected Element |
prepareBody(byte[] payload) |
protected Element |
prepareBody(Element payload) |
protected Element |
prepareRetartBody() |
protected Element |
prepareStartBody() |
protected Element |
prepareTerminateBody(Element payload) |
protected abstract void |
processSendData(Element element) |
protected void |
removeFromRequests(BoshRequest ack) |
void |
restartStream()
Sends new XML Stream header.
|
void |
send(byte[] buffer) |
void |
send(Element stanza)
Sends given XML Element to server.
|
protected void |
setSid(String sid) |
protected void |
setStage(Connector.State state) |
void |
start()
Starts connector.
|
void |
stop()
Stops connector and closes connections.
|
void |
stop(boolean terminate)
Stops connector.
|
protected void |
terminateAllWorkers() |
public static final String BOSH_SERVICE_URL_KEY
public static final String RID_KEY
public static final String SID_KEY
protected final Context context
protected final Logger log
protected final Set<BoshRequest> requests
public AbstractBoshConnector(Context context)
protected void addToRequests(BoshRequest worker)
protected int countActiveRequests()
public XmppSessionLogic createSessionLogic(XmppModulesManager modulesManager, PacketWriter writer)
Connector
createSessionLogic
in interface Connector
modulesManager
- module managerwriter
- writerprotected void fireOnConnected(SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnError(int responseCode, String responseData, Element response, Throwable caught, SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnStanzaReceived(int responseCode, String responseData, Element response, SessionObject sessionObject) throws JaxmppException
JaxmppException
protected void fireOnTerminate(int responseCode, String responseData, Element response, SessionObject sessionObject) throws JaxmppException
JaxmppException
protected String getSid()
protected void setSid(String sid)
public Connector.State getState()
Connector
public boolean isCompressed()
Connector
isCompressed
in interface Connector
true> if XML Stream is compressed.
public boolean isSecure()
Connector
public void keepalive() throws JaxmppException
Connector
keepalive
in interface Connector
JaxmppException
protected Long nextRid()
protected void onError(BoshRequest request, int responseCode, String responseData, Element response, Throwable caught) throws JaxmppException
JaxmppException
protected void onResponse(BoshRequest request, int responseCode, String responseData, Element response) throws JaxmppException
JaxmppException
protected void onTerminate(BoshRequest request, int responseCode, String responseData, Element response) throws JaxmppException
JaxmppException
protected Element prepareBody(byte[] payload) throws XMLException
XMLException
protected Element prepareBody(Element payload) throws XMLException
XMLException
protected Element prepareRetartBody() throws XMLException
XMLException
protected Element prepareStartBody() throws XMLException
XMLException
protected Element prepareTerminateBody(Element payload) throws XMLException
XMLException
protected abstract void processSendData(Element element) throws JaxmppException
JaxmppException
protected void removeFromRequests(BoshRequest ack)
public void restartStream() throws JaxmppException
Connector
restartStream
in interface Connector
JaxmppException
public void send(byte[] buffer) throws JaxmppException
JaxmppException
public void send(Element stanza) throws JaxmppException
Connector
send
in interface Connector
stanza
- XML element to send.JaxmppException
protected void setStage(Connector.State state) throws JaxmppException
JaxmppException
public void start() throws JaxmppException
Connector
start
in interface Connector
JaxmppException
public void stop() throws JaxmppException
Connector
stop
in interface Connector
JaxmppException
public void stop(boolean terminate) throws JaxmppException
Connector
stop
in interface Connector
terminate
- if true then connection will be terminated immediatelly and connector will be
stopped.
JaxmppException
protected void terminateAllWorkers()
Copyright © 2006–2023 Tigase. All rights reserved.