Package rocks.xmpp.core.session
Class XmppSessionConfiguration
- java.lang.Object
-
- rocks.xmpp.core.session.XmppSessionConfiguration
-
public final class XmppSessionConfiguration extends Object
A configuration for anXmppSession
.Most importantly it allows you to introduce custom extensions to your
XmppSession
, simply by passing your JAXB annotated classes to the builder of this class and then use this configuration for the session.Since creating the JAXB context is quite expensive, this class allows you to create the context once and reuse it by multiple sessions. You can also set an application-wide default configuration (used by all XMPP sessions).
Use the
builder()
to create instances of this class:XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() .extensions(Extension.of(MyClass1.class), Extension.of(MyClass2.class)) .debugger(ConsoleDebugger.class) .build();
This class is immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmppSessionConfiguration.Builder
A builder to create anXmppSessionConfiguration
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static XmppSessionConfiguration.Builder
builder()
Creates a builder for this class.List<String>
getAuthenticationMechanisms()
Gets the preferred authentication (SASL) mechanisms.Path
getCacheDirectory()
Gets the caching directory for directory-based caches used for: XEP-0084: User Avatar XEP-0115: Entity Capabilities XEP-0153: vCard-Based Avatars By default this directory is calledxmpp.rocks
and is located in the operating system's application data folder:Class<? extends XmppDebugger>
getDebugger()
Gets the current debugger for this session.static XmppSessionConfiguration
getDefault()
Gets the default configuration.Duration
getDefaultResponseTimeout()
Gets the response timeout.Executor
getExecutor()
Gets the executor, which processes inbound stanzas.Supplier<Presence>
getInitialPresence()
Gets a supplier for initial presence which is sent during login.Locale
getLanguage()
Gets the preferred or default language for any human-readable XML character data to be sent over the stream.String
getNameServer()
Gets the name server used for resolving DNS SRV and TXT records during connecting.ReconnectionStrategy
getReconnectionStrategy()
Gets the reconnection strategy.ThreadFactory
getThreadFactory(String name)
Gets the thread factory for the session.XMLInputFactory
getXmlInputFactory()
Gets the XML input factory.XMLOutputFactory
getXmlOutputFactory()
Gets the XML output factory.boolean
isCloseOnShutdown()
Indicates, if the session is gracefully closed on shutdown of the runtime (JVM).static void
setDefault(XmppSessionConfiguration configuration)
Sets the default configuration.
-
-
-
Method Detail
-
getDefault
public static XmppSessionConfiguration getDefault()
Gets the default configuration.- Returns:
- The default configuration.
-
setDefault
public static void setDefault(XmppSessionConfiguration configuration)
Sets the default configuration.- Parameters:
configuration
- The default configuration.
-
builder
public static XmppSessionConfiguration.Builder builder()
Creates a builder for this class.- Returns:
- The builder.
-
getDebugger
public final Class<? extends XmppDebugger> getDebugger()
Gets the current debugger for this session. If no debugger was set, the default debugger is theConsoleDebugger
.- Returns:
- The debugger.
-
getDefaultResponseTimeout
public final Duration getDefaultResponseTimeout()
Gets the response timeout.- Returns:
- The response timeout.
-
getAuthenticationMechanisms
public final List<String> getAuthenticationMechanisms()
Gets the preferred authentication (SASL) mechanisms.- Returns:
- The mechanisms.
- See Also:
XmppSessionConfiguration.Builder.authenticationMechanisms(String...)
-
getCacheDirectory
public final Path getCacheDirectory()
Gets the caching directory for directory-based caches used for: By default this directory is calledxmpp.rocks
and is located in the operating system's application data folder:
For Windows it is
%APPDATA%
, which usually isC:\Users\{USERNAME}\AppData\Roaming
For Mac it is~/Library/Application Support
Else it is the user's home directory.- Returns:
- The directory.
-
getInitialPresence
public final Supplier<Presence> getInitialPresence()
Gets a supplier for initial presence which is sent during login.- Returns:
- The initial presence supplier.
- See Also:
- 4.2. Initial Presence
-
getLanguage
public final Locale getLanguage()
Gets the preferred or default language for any human-readable XML character data to be sent over the stream.- Returns:
- The language.
- See Also:
- 4.7.4. xml:lang
-
getReconnectionStrategy
public final ReconnectionStrategy getReconnectionStrategy()
Gets the reconnection strategy.- Returns:
- The reconnection strategy.
-
getNameServer
public final String getNameServer()
Gets the name server used for resolving DNS SRV and TXT records during connecting.- Returns:
- The name server.
-
getThreadFactory
public final ThreadFactory getThreadFactory(String name)
Gets the thread factory for the session.- Parameters:
name
- The default thread name.- Returns:
- The thread factory. Never null.
-
getExecutor
public Executor getExecutor()
Gets the executor, which processes inbound stanzas.- Returns:
- The executor.
-
isCloseOnShutdown
public final boolean isCloseOnShutdown()
Indicates, if the session is gracefully closed on shutdown of the runtime (JVM).- Returns:
- True, if the session is gracefully closed on shutdown of the runtime (JVM).
-
getXmlInputFactory
public final XMLInputFactory getXmlInputFactory()
Gets the XML input factory.- Returns:
- the XML input factory
-
getXmlOutputFactory
public final XMLOutputFactory getXmlOutputFactory()
Gets the XML output factory.- Returns:
- The XML output factory
-
-