B - the builder type parameter.C - the resulting connection configuration type parameter.public abstract static class ConnectionConfiguration.ConnectionConfigurationBuilder<B extends ConnectionConfiguration.ConnectionConfigurationBuilder<B,C>,C extends ConnectionConfiguration>
extends java.lang.Object
This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build instructions from the superclasses followed by build instructions of a sublcass would not be possible, because the superclass build instructions would return the builder of the superclass and not the one of the subclass. You can read more about it a Angelika Langer's Generics FAQ, especially the entry What is the "getThis()" trick?.
| Modifier | Constructor and Description |
|---|---|
protected |
ConnectionConfiguration.ConnectionConfigurationBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract C |
build() |
protected abstract B |
getThis() |
B |
makeAnonymous()
Create a configuration for a anonymous XMPP connection.
|
B |
setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler)
Sets a CallbackHandler to obtain information, such as the password or
principal information during the SASL authentication.
|
B |
setCustomSSLContext(javax.net.ssl.SSLContext context)
Sets a custom SSLContext for creating SSL sockets.
|
B |
setDebuggerEnabled(boolean debuggerEnabled)
Sets if the new connection about to be establish is going to be debugged.
|
B |
setEnabledSSLCiphers(java.lang.String[] enabledSSLCiphers)
Set the enabled SSL/TLS ciphers.
|
B |
setEnabledSSLProtocols(java.lang.String[] enabledSSLProtocols)
Set the enabled SSL/TLS protocols.
|
B |
setHost(java.lang.String host) |
B |
setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
Set the HostnameVerifier used to verify the hostname of SSLSockets used by XMPP connections
created with this ConnectionConfiguration.
|
B |
setKeystorePath(java.lang.String keystorePath)
Sets the path to the keystore file.
|
B |
setKeystoreType(java.lang.String keystoreType)
Sets the keystore type.
|
B |
setLegacySessionDisabled(boolean legacySessionDisabled)
Sets if a
Session will be requested on login if the server supports
it. |
B |
setPKCS11Library(java.lang.String pkcs11Library)
Sets the PKCS11 library file location, needed when the
Keystore type is PKCS11
|
B |
setPort(int port) |
B |
setResource(java.lang.String resource)
Set the resource to use.
|
B |
setRosterLoadedAtLogin(boolean rosterLoadedAtLogin)
Sets if the roster will be loaded from the server when logging in.
|
B |
setRosterStore(RosterStore store)
Set the permanent roster store.
|
B |
setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
Sets the TLS security mode used when making the connection.
|
B |
setSendPresence(boolean sendPresence)
Sets if an initial available presence will be sent to the server.
|
B |
setServiceName(java.lang.String serviceName)
Set the service name of this XMPP service (i.e., the XMPP domain).
|
B |
setSocketFactory(javax.net.SocketFactory socketFactory)
Sets the socket factory used to create new xmppConnection sockets.
|
B |
setUsernameAndPassword(java.lang.String username,
java.lang.String password)
Set the XMPP entities username and password.
|
protected ConnectionConfiguration.ConnectionConfigurationBuilder()
public B setUsernameAndPassword(java.lang.String username, java.lang.String password)
The username is the localpart of the entities JID, e.g. localpart@example.org. In order to
create an anonymous connection, call makeAnonymous() instead.
username - password - public B makeAnonymous()
Anonyous connections don't provide a username or other authentification credentials like a password. Instead the XMPP server, if supporting anonymous connections, will assign a username to the client.
public B setServiceName(java.lang.String serviceName)
serviceName - the service namepublic B setResource(java.lang.String resource)
If resource is null, then the server will automatically create a resource for the
client. Default resource is "Smack".
resource - the resource to use.public B setHost(java.lang.String host)
public B setPort(int port)
public B setCallbackHandler(javax.security.auth.callback.CallbackHandler callbackHandler)
callbackHandler - to obtain information, such as the password or
principal information during the SASL authentication.public B setSecurityMode(ConnectionConfiguration.SecurityMode securityMode)
ConnectionConfiguration.SecurityMode.enabled.securityMode - the security mode.public B setKeystorePath(java.lang.String keystorePath)
keystorePath - the path to the keystore file.public B setKeystoreType(java.lang.String keystoreType)
keystoreType - the keystore type.public B setPKCS11Library(java.lang.String pkcs11Library)
pkcs11Library - the path to the PKCS11 library file.public B setCustomSSLContext(javax.net.ssl.SSLContext context)
For more information on how to create a SSLContext see Java Secure Socket Extension (JSEE) Reference Guide: Creating Your Own X509TrustManager
context - the custom SSLContext for new sockets.public B setEnabledSSLProtocols(java.lang.String[] enabledSSLProtocols)
enabledSSLProtocols - public B setEnabledSSLCiphers(java.lang.String[] enabledSSLCiphers)
enabledSSLCiphers - the enabled SSL/TLS cipherspublic B setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
verifier - public B setLegacySessionDisabled(boolean legacySessionDisabled)
Session will be requested on login if the server supports
it. Although this was mandatory on RFC 3921, RFC 6120/6121 don't even
mention this part of the protocol.legacySessionDisabled - if a session has to be requested when logging in.public B setRosterLoadedAtLogin(boolean rosterLoadedAtLogin)
rosterLoadedAtLogin - if the roster will be loaded from the server when logging in.public B setSendPresence(boolean sendPresence)
sendPresence - true if an initial available presence will be sent while logging in.public B setRosterStore(RosterStore store)
public B setDebuggerEnabled(boolean debuggerEnabled)
SmackConfiguration.DEBUG_ENABLED is used.debuggerEnabled - if the new connection about to be establish is going to be debugged.public B setSocketFactory(javax.net.SocketFactory socketFactory)
socketFactory - used to create new sockets.public abstract C build()
protected abstract B getThis()