Class XmppSessionConfiguration


  • public final class XmppSessionConfiguration
    extends Object
    A configuration for an XmppSession.

    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.

    See Also:
    XmppSession(String, XmppSessionConfiguration, ClientConnectionConfiguration...)
    • 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.
      • getDebugger

        public final Class<? extends XmppDebugger> getDebugger()
        Gets the current debugger for this session. If no debugger was set, the default debugger is the ConsoleDebugger.
        Returns:
        The debugger.
      • getDefaultResponseTimeout

        public final Duration getDefaultResponseTimeout()
        Gets the response timeout.
        Returns:
        The response timeout.
      • getCacheDirectory

        public final Path getCacheDirectory()
        Gets the caching directory for directory-based caches used for: By default this directory is called xmpp.rocks and is located in the operating system's application data folder:

        For Windows it is %APPDATA%, which usually is C:\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