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.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)
ConnectorcreateSessionLogic in interface ConnectormodulesManager - module managerwriter - writerprotected void fireOnConnected(SessionObject sessionObject) throws JaxmppException
JaxmppExceptionprotected void fireOnError(int responseCode,
String responseData,
Element response,
Throwable caught,
SessionObject sessionObject)
throws JaxmppException
JaxmppExceptionprotected void fireOnStanzaReceived(int responseCode,
String responseData,
Element response,
SessionObject sessionObject)
throws JaxmppException
JaxmppExceptionprotected void fireOnTerminate(int responseCode,
String responseData,
Element response,
SessionObject sessionObject)
throws JaxmppException
JaxmppExceptionprotected String getSid()
public Connector.State getState()
Connectorpublic boolean isCompressed()
ConnectorisCompressed in interface Connectortrue> if XML Stream is compressed.public boolean isSecure()
Connectorpublic void keepalive()
throws JaxmppException
Connectorkeepalive in interface ConnectorJaxmppExceptionprotected Long nextRid()
protected void onError(BoshRequest request, int responseCode, String responseData, Element response, Throwable caught) throws JaxmppException
JaxmppExceptionprotected void onResponse(BoshRequest request, int responseCode, String responseData, Element response) throws JaxmppException
JaxmppExceptionprotected void onTerminate(BoshRequest request, int responseCode, String responseData, Element response) throws JaxmppException
JaxmppExceptionprotected Element prepareBody(byte[] payload) throws XMLException
XMLExceptionprotected Element prepareBody(Element payload) throws XMLException
XMLExceptionprotected Element prepareRetartBody() throws XMLException
XMLExceptionprotected Element prepareStartBody() throws XMLException
XMLExceptionprotected Element prepareTerminateBody(Element payload) throws XMLException
XMLExceptionprotected abstract void processSendData(Element element) throws XMLException, JaxmppException
XMLExceptionJaxmppExceptionprotected void removeFromRequests(BoshRequest ack)
public void restartStream()
throws XMLException,
JaxmppException
ConnectorrestartStream in interface ConnectorXMLExceptionJaxmppExceptionpublic void send(byte[] buffer)
throws JaxmppException
JaxmppExceptionpublic void send(Element stanza) throws XMLException, JaxmppException
Connectorsend in interface Connectorstanza - XML element to send.XMLExceptionJaxmppExceptionprotected void setSid(String sid)
protected void setStage(Connector.State state) throws JaxmppException
JaxmppExceptionpublic void start()
throws XMLException,
JaxmppException
Connectorstart in interface ConnectorXMLExceptionJaxmppExceptionpublic void stop()
throws XMLException,
JaxmppException
Connectorstop in interface ConnectorXMLExceptionJaxmppExceptionpublic void stop(boolean terminate)
throws XMLException,
JaxmppException
Connectorstop in interface Connectorterminate - if true then connection will be terminated
immediatelly and connector will be stopped.XMLExceptionJaxmppExceptionprotected void terminateAllWorkers()
Copyright © 2006–2016 Tigase. All rights reserved.