Package io.toro.martini.jabber.model
Class JabberConnection
java.lang.Object
org.jivesoftware.smack.AbstractXMPPConnection
org.jivesoftware.smack.tcp.XMPPTCPConnection
io.toro.martini.jabber.model.JabberConnection
- All Implemented Interfaces:
AutoCloseable,XMPPConnection
- Direct Known Subclasses:
XmppConnection
- Author:
- jerrickpua
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jivesoftware.smack.tcp.XMPPTCPConnection
XMPPTCPConnection.PacketReader, XMPPTCPConnection.PacketWriterNested classes/interfaces inherited from class org.jivesoftware.smack.AbstractXMPPConnection
AbstractXMPPConnection.InterceptorWrapper, AbstractXMPPConnection.ListenerWrapperNested classes/interfaces inherited from interface org.jivesoftware.smack.XMPPConnection
XMPPConnection.FromMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class org.jivesoftware.smack.tcp.XMPPTCPConnection
packetReader, packetWriterFields inherited from class org.jivesoftware.smack.AbstractXMPPConnection
authenticated, compressionHandler, connected, connectionCounterValue, connectionListeners, connectionLock, debugger, host, hostAddresses, lastFeaturesReceived, port, reader, saslAuthentication, saslFeatureReceived, streamFeatures, streamId, user, wasAuthenticated, writer -
Constructor Summary
ConstructorsConstructorDescriptionJabberConnection(String name, CharSequence jid, String password, boolean allowReconnection, Integer pingInterval) JabberConnection(String name, CharSequence username, String password, String serviceName, boolean allowReconnection, Integer pingInterval) JabberConnection(String name, Map configuration) JabberConnection(String name, XMPPTCPConnectionConfiguration config, boolean allowReconnection, long pingInterval) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChatListener(ChatManagerListener listener) buildConfiguration(Map configuration) Creates a jabber based on the configuration map provided Properties for configuring jabber connection NOTE THIS IS FOR ENDPOINT ONLY{ Key: replyServiceResponse, Type:- Set to true if service response will return its object to the sender.Boolean}voidclose()connect()protected voidvoidgetName()getUsers()voidbooleanvoidlogin()voidlogin(CharSequence username, String password) voidlogin(CharSequence username, String password, String resource) voidsendMessage(String jid, String message) voidsendMessage(String jid, Message message) voidsetName(io.toro.martini.endpoint.Endpoint endpoint) voidMethods inherited from class org.jivesoftware.smack.tcp.XMPPTCPConnection
addRequestAckPredicate, addStanzaAcknowledgedListener, addStanzaIdAcknowledgedListener, afterFeaturesReceived, afterSuccessfulLogin, getMaxSmResumptionTime, isDisconnectedButSmResumptionPossible, isSecureConnection, isSmAvailable, isSmEnabled, isSmResumptionPossible, isSocketClosed, isUsingCompression, loginAnonymously, loginNonAnonymously, removeAllRequestAckPredicates, removeAllStanzaAcknowledgedListeners, removeAllStanzaIdAcknowledgedListeners, removeRequestAckPredicate, removeStanzaAcknowledgedListener, removeStanzaIdAcknowledgedListener, requestSmAcknowledgement, send, sendSmAcknowledgement, sendStanzaInternal, setBundleandDeferCallback, setDefaultBundleAndDeferCallback, setPreferredResumptionTime, setUseStreamManagement, setUseStreamManagementDefault, setUseStreamManagementResumptiodDefault, setUseStreamManagementResumption, setUseStreamManagementResumptionDefault, setWriter, shutdown, streamWasResumed, throwAlreadyConnectedExceptionIfAppropriate, throwAlreadyLoggedInExceptionIfAppropriate, throwNotConnectedExceptionIfAppropriateMethods inherited from class org.jivesoftware.smack.AbstractXMPPConnection
addAsyncStanzaListener, addConnectionListener, addOneTimeSyncCallback, addPacketInterceptor, addPacketListener, addPacketSendingListener, addSyncStanzaListener, asyncGo, bindResourceAndEstablishSession, callConnectionAuthenticatedListener, callConnectionClosedOnErrorListener, callConnectionConnectedListener, createPacketCollector, createPacketCollector, createPacketCollectorAndSend, createPacketCollectorAndSend, disconnect, finalize, firePacketSendingListeners, getConfiguration, getConnectionCounter, getConnectionCreationListeners, getConnectionLock, getFeature, getFromMode, getHost, getLastStanzaReceived, getPacketReplyTimeout, getParsingExceptionCallback, getPort, getSASLAuthentication, getServiceName, getStreamId, getUser, hasFeature, initDebugger, invokePacketCollectorsAndNotifyRecvListeners, isAnonymous, isAuthenticated, isConnected, notifyReconnection, parseAndProcessStanza, parseFeatures, populateHostAddresses, processPacket, registerIQRequestHandler, removeAsyncStanzaListener, removeConnectionListener, removePacketCollector, removePacketInterceptor, removePacketListener, removePacketSendingListener, removeSyncStanzaListener, schedule, sendIqWithResponseCallback, sendIqWithResponseCallback, sendIqWithResponseCallback, sendPacket, sendStanza, sendStanzaWithResponseCallback, sendStanzaWithResponseCallback, sendStanzaWithResponseCallback, setFromMode, setPacketReplyTimeout, setParsingExceptionCallback, setReplyToUnknownIq, setReplyToUnknownIqDefault, setWasAuthenticated, throwNotConnectedExceptionIfAppropriate, unregisterIQRequestHandler, unregisterIQRequestHandler
-
Field Details
-
DEFAULT_PING_INTERVAL
public static final int DEFAULT_PING_INTERVAL- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT- See Also:
-
DEFAULT_PACKET_REPLY_TIMEOUT
public static final int DEFAULT_PACKET_REPLY_TIMEOUT- See Also:
-
-
Constructor Details
-
JabberConnection
-
JabberConnection
public JabberConnection(String name, CharSequence username, String password, String serviceName, boolean allowReconnection, Integer pingInterval) -
JabberConnection
public JabberConnection(String name, XMPPTCPConnectionConfiguration config, boolean allowReconnection, long pingInterval) -
JabberConnection
public JabberConnection(String name, CharSequence jid, String password, boolean allowReconnection, Integer pingInterval)
-
-
Method Details
-
buildConfiguration
Creates a jabber based on the configuration map provided Properties for configuring jabber connection NOTE THIS IS FOR ENDPOINT ONLY{ Key: replyServiceResponse, Type:- Set to true if service response will return its object to the sender. Only String and Gstring will be returned. if you want to return marshalled object make sure to set useObjectConverter configuration to trueBoolean}{ Key: useObjectConverter, Type:- If service response is set to true. Objects will return as jsonBoolean}
- Parameters:
configuration-{ Key: callbackHandler, Type:- SeeCallbackHandler}ConnectionConfiguration.Builder.setCallbackHandler(CallbackHandler){ compressionEnabled, Type:- SeeBoolean}XMPPTCPConnectionConfiguration.Builder.setCompressionEnabled(boolean){ connectTimeout, Type:- SeeIntegerDEFAULT 50seconds }XMPPTCPConnectionConfiguration.Builder.setConnectTimeout(int){ sslContext, Type:- SeeSSLContext}ConnectionConfiguration.Builder.setCustomSSLContext(SSLContext){ debuggerEnabled, Type:- SeeBoolean}ConnectionConfiguration.Builder.setDebuggerEnabled(boolean){ enabledSSLCiphers, Type:- SeeStringorList<String>}ConnectionConfiguration.Builder.setEnabledSSLCiphers(String[]){ enabledSSLProtocols, Type:- SeeStringorList<String>}ConnectionConfiguration.Builder.setEnabledSSLProtocols(String[]){ host, Type:- SeeString}ConnectionConfiguration.Builder.setHost(String){ hostnameVerifier, Type:- SeeHostnameVerifier}ConnectionConfiguration.Builder.setHostnameVerifier(HostnameVerifier){ keystorePath, Type:- SeeString}ConnectionConfiguration.Builder.setKeystorePath(String){ keystoreType, Type:- SeeString}ConnectionConfiguration.Builder.setKeystoreType(String){ legacySessionDisabled, Type:- SeeBoolean}ConnectionConfiguration.Builder.setLegacySessionDisabled(boolean){ pkcs11Library, Type:- SeeString}ConnectionConfiguration.Builder.setPKCS11Library(String){ port, Type:- SeeInteger}ConnectionConfiguration.Builder.setPort(int){ proxyInfo, Type:- SeeProxyInfo}ConnectionConfiguration.Builder.setProxyInfo(ProxyInfo){ resource, Type:- SeeString}ConnectionConfiguration.Builder.setResource(String){ securityMode, Type:- SeeConnectionConfiguration.SecurityModeorString}ConnectionConfiguration.Builder.setSecurityMode(SecurityMode){ sendPresence, Type:- SeeBoolean}ConnectionConfiguration.Builder.setSendPresence(boolean){ serviceName, Type:- SeeString}ConnectionConfiguration.Builder.setServiceName(String){ socketFactory, Type:- SeeSocketFactory}ConnectionConfiguration.Builder.setSocketFactory(SocketFactory){ username, Type:- Username of your jabber accountString}{ password, Type:- password of jabber accountBoolean}{ packetReplyTimeout, Type:- SeeLongDEFAULT 10seconds }AbstractXMPPConnection.setPacketReplyTimeout(long){ pingInterval, Type:- SeeIntegerDEFAULT 20seconds }PingManager.setPingInterval(int){ allowEmptyOrNullUsernames, Type:- SeeBoolean}ConnectionConfiguration.Builder.allowEmptyOrNullUsernames(){ allowReconnection, Type:- EnablesBooleanDEFAULT: true }ReconnectionManager
name- Jabber connection name
-
connect
- Overrides:
connectin classAbstractXMPPConnection- Throws:
SmackExceptionIOExceptionXMPPException
-
connectInternal
- Overrides:
connectInternalin classXMPPTCPConnection- Throws:
SmackExceptionIOExceptionXMPPException
-
login
- Overrides:
loginin classAbstractXMPPConnection- Throws:
XMPPExceptionSmackExceptionIOException
-
login
public void login(CharSequence username, String password) throws XMPPException, SmackException, IOException - Overrides:
loginin classAbstractXMPPConnection- Throws:
XMPPExceptionSmackExceptionIOException
-
login
public void login(CharSequence username, String password, String resource) throws XMPPException, SmackException, IOException - Overrides:
loginin classAbstractXMPPConnection- Throws:
XMPPExceptionSmackExceptionIOException
-
getName
-
setName
public void setName(io.toro.martini.endpoint.Endpoint endpoint) -
setName
-
isAllowReconnection
public boolean isAllowReconnection() -
getPingInterval
-
getUsers
-
sendMessage
-
sendMessage
-
addChatListener
-
disconnect
public void disconnect()- Overrides:
disconnectin classAbstractXMPPConnection
-
instantShutdown
public void instantShutdown()- Overrides:
instantShutdownin classXMPPTCPConnection
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-