Class XmppSessionConfiguration.Builder
- java.lang.Object
-
- rocks.xmpp.core.session.XmppSessionConfiguration.Builder
-
- Enclosing class:
- XmppSessionConfiguration
public static final class XmppSessionConfiguration.Builder extends Object
A builder to create anXmppSessionConfiguration
instance.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmppSessionConfiguration.Builder
authenticationMechanisms(String... authenticationMechanisms)
Sets the preferred mechanisms used for this XMPP session.XmppSessionConfiguration
build()
Builds the configuration.XmppSessionConfiguration.Builder
cacheDirectory(Path path)
Sets the caching directory for directory-based caches used for: XEP-0084: User Avatar XEP-0115: Entity Capabilities XEP-0153: vCard-Based Avatars If you want to disable the use of directory caching, pass null.XmppSessionConfiguration.Builder
closeOnShutdown(boolean closeOnShutdown)
Indicates whether the XMPP session is closed, when the JVM is shut down.XmppSessionConfiguration.Builder
debugger(Class<? extends XmppDebugger> xmppDebugger)
Sets the debugger.XmppSessionConfiguration.Builder
defaultResponseTimeout(Duration defaultResponseTimeout)
Sets the default response timeout for synchronous calls, usually IQ calls.XmppSessionConfiguration.Builder
executor(Executor executor)
Sets the executor, which processes inbound stanzas.XmppSessionConfiguration.Builder
extensions(Extension... extensions)
Adds extensions to the session.XmppSessionConfiguration.Builder
initialPresence(Supplier<Presence> presenceSupplier)
Sets a supplier for initial presence which is sent during login.XmppSessionConfiguration.Builder
language(Locale language)
Sets the preferred or default language for any human-readable XML character data to be sent over the stream.XmppSessionConfiguration.Builder
nameServer(String nameServer)
Sets the name server used for resolving DNS SRV and TXT records during connecting.XmppSessionConfiguration.Builder
reconnectionStrategy(ReconnectionStrategy reconnectionStrategy)
Sets the reconnection strategy, which determined when to reconnect after a disconnection.XmppSessionConfiguration.Builder
threadFactory(ThreadFactory threadFactory)
Sets a custom thread factory.
-
-
-
Method Detail
-
debugger
public final XmppSessionConfiguration.Builder debugger(Class<? extends XmppDebugger> xmppDebugger)
Sets the debugger.- Parameters:
xmppDebugger
- The debugger or null, if you don't want to use a debugger.- Returns:
- The debugger.
-
extensions
public final XmppSessionConfiguration.Builder extensions(Extension... extensions)
Adds extensions to the session.- Parameters:
extensions
- The extensions.- Returns:
- The builder.
-
defaultResponseTimeout
public final XmppSessionConfiguration.Builder defaultResponseTimeout(Duration defaultResponseTimeout)
Sets the default response timeout for synchronous calls, usually IQ calls.- Parameters:
defaultResponseTimeout
- The default response timeout.- Returns:
- The builder.
-
authenticationMechanisms
public final XmppSessionConfiguration.Builder authenticationMechanisms(String... authenticationMechanisms)
Sets the preferred mechanisms used for this XMPP session.Any entity that will act as a SASL client or a SASL server MUST maintain an ordered list of its preferred SASL mechanisms according to the client or server, where the list is ordered according to local policy or user configuration (which SHOULD be in order of perceived strength to enable the strongest authentication possible). The initiating entity MUST maintain its own preference order independent of the preference order of the receiving entity. A client MUST try SASL mechanisms in its preference order. For example, if the server offers the ordered list "PLAIN SCRAM-SHA-1 GSSAPI" or "SCRAM-SHA-1 GSSAPI PLAIN" but the client's ordered list is "GSSAPI SCRAM-SHA-1", the client MUST try GSSAPI first and then SCRAM-SHA-1 but MUST NOT try PLAIN (since PLAIN is not on its list).
- Parameters:
authenticationMechanisms
- The preferred mechanisms.- Returns:
- The builder.
-
cacheDirectory
public final XmppSessionConfiguration.Builder cacheDirectory(Path path)
Sets the caching directory for directory-based caches used for: If you want to disable the use of directory caching, pass null.- Parameters:
path
- The directory.- Returns:
- The builder.
- See Also:
XmppSessionConfiguration.getCacheDirectory()
-
initialPresence
public final XmppSessionConfiguration.Builder initialPresence(Supplier<Presence> presenceSupplier)
Sets a supplier for initial presence which is sent during login. If the supplier is null or returns null, no initial presence is sent.- Parameters:
presenceSupplier
- The presence supplier.- Returns:
- The builder.
- See Also:
- 4.2. Initial Presence
-
language
public final XmppSessionConfiguration.Builder language(Locale language)
Sets the preferred or default language for any human-readable XML character data to be sent over the stream.- Parameters:
language
- The language.- Returns:
- The builder.
- See Also:
- 4.7.4. xml:lang
-
reconnectionStrategy
public final XmppSessionConfiguration.Builder reconnectionStrategy(ReconnectionStrategy reconnectionStrategy)
Sets the reconnection strategy, which determined when to reconnect after a disconnection.- Parameters:
reconnectionStrategy
- The reconnection strategy.- Returns:
- The builder.
- See Also:
- 3.3. Reconnection
-
nameServer
public final XmppSessionConfiguration.Builder nameServer(String nameServer)
Sets the name server used for resolving DNS SRV and TXT records during connecting.For Oracle JDK, you could use one of
sun.net.dns.ResolverConfiguration.open().nameservers()
.If no name server is set, Google DNS Server (8.8.8.8) is used.
- Parameters:
nameServer
- The name server.- Returns:
- The builder.
-
threadFactory
public final XmppSessionConfiguration.Builder threadFactory(ThreadFactory threadFactory)
Sets a custom thread factory.This is useful in managed environments where the thread creation should be managed by a container, e.g.
javax.enterprise.concurrent.ManagedThreadFactory
- Parameters:
threadFactory
- The thread factory.- Returns:
- The builder.
-
closeOnShutdown
public final XmppSessionConfiguration.Builder closeOnShutdown(boolean closeOnShutdown)
Indicates whether the XMPP session is closed, when the JVM is shut down.If
true
(default), a shutdown hook is added to the runtime, which will gracefully close the session on shutdown.If
false
, no shutdown hook will be added to the runtime.- Parameters:
closeOnShutdown
- true, if a shutdown hook shall be added to the runtime.- Returns:
- The builder.
-
executor
public final XmppSessionConfiguration.Builder executor(Executor executor)
Sets the executor, which processes inbound stanzas.- Parameters:
executor
- The executor.- Returns:
- The builder.
-
build
public final XmppSessionConfiguration build()
Builds the configuration.- Returns:
- The configuration.
-
-