Klasse TransportConfigBuilder<X extends TransportConfigBuilder<?,R>,R>

java.lang.Object
org.freedesktop.dbus.connections.config.TransportConfigBuilder<X,R>

public class TransportConfigBuilder<X extends TransportConfigBuilder<?,R>,R> extends Object
  • Konstruktordetails

    • TransportConfigBuilder

      public TransportConfigBuilder(Supplier<R> _sup)
  • Methodendetails

    • withConfig

      public X withConfig(TransportConfig _config)
      Use the predefined TransportConfig.

      Using this will override any previous configuration and replaces the internal configuration object with the given instance.

      Parameter:
      _config - configuration, never null
      Gibt zurück:
      this
    • withBusAddress

      public X withBusAddress(BusAddress _address)
      Set the BusAddress which should be used for the connection.
      Parameter:
      _address - address to use
      Gibt zurück:
      this
    • getBusAddress

      public BusAddress getBusAddress()
      Returns the currently configured BusAddress.
      Gibt zurück:
      BusAddress, maybe null
    • withPreConnectCallback

      public X withPreConnectCallback(Consumer<AbstractTransport> _callback)
      Set a callback which will be called right before the connection to the transport is established.

      The given consumer will receive the created AbstractTransport object which is not yet connected. A callback should NEVER connect the transport, but is allowed to do further configuration if needed.

      Parameter:
      _callback - consumer to call, null to remove any callback
      Gibt zurück:
      this
    • withAfterBindCallback

      public X withAfterBindCallback(Consumer<AbstractTransport> _callback)
      Set a callback which will be called after bindImpl() on a server connection was called.
      This method is only called if the transport is configured as server connection.

      The given consumer will receive the created AbstractTransport object which is not yet accepting connections. A callback should NEVER call accept on the transport, but is allowed to do further configuration if needed.

      Parameter:
      _callback - consumer to call, null to remove any callback
      Gibt zurück:
      this
      Seit:
      5.0.0 - 2023-10-20
    • withAutoConnect

      public X withAutoConnect(boolean _connect)
      Instantly connect to DBus when build() is called.

      This option will be ignored when this is a listening (server) socket.

      default: true

      Parameter:
      _connect - boolean
      Gibt zurück:
      this
    • withRegisterSelf

      public X withRegisterSelf(boolean _register)
      Register the new connection on DBus using 'hello' message. Default is true.
      Parameter:
      _register - boolean
      Gibt zurück:
      this
      Seit:
      5.0.0 - 2023-10-11
    • configureSasl

      public SaslConfigBuilder<R> configureSasl()
      Switch to the SaslConfigBuilder to configure the SASL authentication mechanism.
      Use SaslConfigBuilder.back() to return to this builder when finished.
      Gibt zurück:
      SaslConfigBuilder
    • withListening

      public X withListening(boolean _listen)
      Use true to use the transport as listener (server).
      Parameter:
      _listen - true to be a listening connection
      Gibt zurück:
      this
    • withTimeout

      public X withTimeout(int _timeout)
      Setup a timeout for the transport.

      This option might not be used by every transport (e.g. unix sockets do not support a timeout). Timeout cannot be less than zero.

      Parameter:
      _timeout - true to be a listening connection
      Gibt zurück:
      this
    • withUnixSocketFileOwner

      public X withUnixSocketFileOwner(String _user)
      The owner of the socket file if a unix socket is used and this is a server transport.

      Default is the user of the running JVM process.

      Please note:
      The running process user has to have suitable permissions to change the owner of the file. Otherwise the file owner will not be changed!

      Parameter:
      _user - user to set, if null is given JVM process user is used
      Gibt zurück:
      this
    • withUnixSocketFileGroup

      public X withUnixSocketFileGroup(String _group)
      The group of the socket file if a unix socket is used and this is a server transport.

      Default is the group of the running JVM process.

      Please note:
      The running process user has to have suitable permissions to change the group of the file. Otherwise the file group will not be changed!

      Parameter:
      _group - group to set, if null is given JVM process group is used
      Gibt zurück:
      this
    • withUnixSocketFilePermissions

      public X withUnixSocketFilePermissions(PosixFilePermission... _permissions)
      The permissions which will be set on socket file if a unix socket is used and this is a server transport.

      This method does nothing when used on windows systems. Please note:
      The running process user has to have suitable permissions to change the permissions of the file. Otherwise the file permissions will not be changed!

      Parameter:
      _permissions - permissions to set, if null is given default permissions will be used
      Gibt zurück:
      this
    • withAdditionalConfig

      public X withAdditionalConfig(String _key, Object _value)
      Adds an additional config key to the transport config.
      Will overwrite value if key exists.
      Parameter:
      _key - key to use
      _value - value to use
      Gibt zurück:
      this
    • withServiceLoaderClassLoader

      public X withServiceLoaderClassLoader(ClassLoader _ldr)
      Configure parent class loader used for ServiceLoader to find ITransportProvider implementations.
      If withServiceLoaderModuleLayer(ModuleLayer) is also configured, ModuleLayer will take precedence.

      Defaults to TransportBuilder.class.getClassLoader().
      Parameter:
      _ldr - class loader
      Gibt zurück:
      this
    • withServiceLoaderModuleLayer

      public X withServiceLoaderModuleLayer(ModuleLayer _layer)
      Configure ModuleLayer used for ServiceLoader to find ITransportProvider implementations.
      Parameter:
      _layer - module layer
      Gibt zurück:
      this
    • withRemoveAdditionalConfig

      public X withRemoveAdditionalConfig(String _key)
      Removes an additional config key to of transport config.
      Will do nothing if key does not exist.
      Parameter:
      _key - key to remove
      Gibt zurück:
      this
    • withEndianess

      public X withEndianess(byte _endianess)
      Set the endianess for the connection Default is based on system endianess.
      Parameter:
      _endianess - Endian.BIG or 0x6c
      Gibt zurück:
      this
    • back

      public R back()
      Return to the previous builder.

      This allows you to return from the this builder to the builder which started this builder so you can continue using the previous builder.

      Gibt zurück:
      previous builder, maybe null
    • build

      public TransportConfig build()
      Returns the transport config.
      Gibt zurück:
      config