Top Fields Constructors Methods
org.freedesktop.dbus.connections.config

public Class TransportConfigBuilder<X extends TransportConfigBuilder<?, R>, R>

extends Object
Class Inheritance
Imports
org.freedesktop.dbus.connections.BusAddress, org.freedesktop.dbus.connections.transports.AbstractTransport, org.freedesktop.dbus.messages.constants.Endian, org.freedesktop.dbus.spi.transport.ITransportProvider, java.nio.file.attribute.PosixFilePermission, java.util.Objects, .ServiceLoader, java.util.function.Consumer, .Supplier

Field Summary

Modifier and TypeField and Description
private TransportConfig
private final Supplier<R>
private final SaslConfigBuilder<R>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public R

Returns:

previous builder, maybe null
back
()

Return to the previous builder.

public TransportConfig

Returns:

config
build
()

Returns the transport config.

public SaslConfigBuilder<R>

Returns:

SaslConfigBuilder
configureSasl
()

Switch to the SaslConfigBuilder to configure the SASL authentication mechanism.

public BusAddress

Returns:

BusAddress, maybe null
getBusAddress
()

Returns the currently configured BusAddress.

pack-priv X

Returns:

concrete version of this
self
()

Return ourselves.

public X

Returns:

this
withAdditionalConfig
(String
key to use
_key
,
Object
value to use
_value
)

Adds an additional config key to the transport config.

public X

Returns:

this
withAfterBindCallback
(Consumer<AbstractTransport>
consumer to call, null to remove any callback
_callback
)

Set a callback which will be called after bindImpl() on a server connection was called.

public X

Returns:

this
withAutoConnect
(boolean
boolean
_connect
)

Instantly connect to DBus when build() is called.

public X

Returns:

this
withBusAddress
(BusAddress
address to use
_address
)

Set the BusAddress which should be used for the connection.

public X

Returns:

this
withConfig
(TransportConfig
configuration, never null
_config
)

Use the predefined TransportConfig.

public X

Returns:

this
withEndianess
(byte
Endian#BIG or 108
_endianess
)

Set the endianess for the connection Default is based on system endianess.

public X

Returns:

this
withListening
(boolean
true to be a listening connection
_listen
)

Use true to use the transport as listener (server).

public X

Returns:

this
withPreConnectCallback
(Consumer<AbstractTransport>
consumer to call, null to remove any callback
_callback
)

Set a callback which will be called right before the connection to the transport is established.

public X

Returns:

this
withRegisterSelf
(boolean
boolean
_register
)

Register the new connection on DBus using 'hello' message.

public X

Returns:

this
withRemoveAdditionalConfig
(String
key to remove
_key
)

Removes an additional config key to of transport config.

public X

Returns:

this
withServiceLoaderClassLoader
(ClassLoader
class loader
_ldr
)

Configure parent class loader used for ServiceLoader to find ITransportProvider implementations.

public X

Returns:

this
withServiceLoaderModuleLayer
(ModuleLayer
module layer
_layer
)

Configure ModuleLayer used for ServiceLoader to find ITransportProvider implementations.

public X

Returns:

this
withTimeout
(int
true to be a listening connection
_timeout
)

Setup a timeout for the transport.

public X

Returns:

this
withUnixSocketFileGroup
(String
group to set, if null is given JVM process group is used
_group
)

The group of the socket file if a unix socket is used and this is a server transport.

public X

Returns:

this
withUnixSocketFileOwner
(String
user to set, if null is given JVM process user is used
_user
)

The owner of the socket file if a unix socket is used and this is a server transport.

public X

Returns:

this
withUnixSocketFilePermissions
(PosixFilePermission...
permissions to set, if null is given default permissions will be used
_permissions
)

The permissions which will be set on socket file if a unix socket is used and this is a server transport.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private TransportConfig config
connectionBuilderback to summary
private final Supplier<R> connectionBuilder
saslConfigBuilderback to summary
private final SaslConfigBuilder<R> saslConfigBuilder

Constructor Detail

TransportConfigBuilderback to summary
public TransportConfigBuilder(Supplier<R> _sup)

Method Detail

backback to summary
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.

Returns:R

previous builder, maybe null

buildback to summary
public TransportConfig build()

Returns the transport config.

Returns:TransportConfig

config

configureSaslback to summary
public SaslConfigBuilder<R> configureSasl()

Switch to the SaslConfigBuilder to configure the SASL authentication mechanism.
Use SaslConfigBuilder#back() to return to this builder when finished.

Returns:SaslConfigBuilder<R>

SaslConfigBuilder

getBusAddressback to summary
public BusAddress getBusAddress()

Returns the currently configured BusAddress.

Returns:BusAddress

BusAddress, maybe null

selfback to summary
pack-priv X self()

Return ourselves.

Returns:X

concrete version of this

Annotations
@SuppressWarnings:unchecked
withAdditionalConfigback to summary
public X withAdditionalConfig(String _key, Object _value)

Adds an additional config key to the transport config.
Will overwrite value if key exists.

Parameters
_key:String

key to use

_value:Object

value to use

Returns:X

this

withAfterBindCallbackback to summary
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.

Parameters
_callback:Consumer<AbstractTransport>

consumer to call, null to remove any callback

Returns:X

this

Since
5.0.0 - 2023-10-20
withAutoConnectback to summary
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

Parameters
_connect:boolean

boolean

Returns:X

this

withBusAddressback to summary
public X withBusAddress(BusAddress _address)

Set the BusAddress which should be used for the connection.

Parameters
_address:BusAddress

address to use

Returns:X

this

withConfigback to summary
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.

Parameters
_config:TransportConfig

configuration, never null

Returns:X

this

withEndianessback to summary
public X withEndianess(byte _endianess)

Set the endianess for the connection Default is based on system endianess.

Parameters
_endianess:byte

Endian#BIG or 108

Returns:X

this

withListeningback to summary
public X withListening(boolean _listen)

Use true to use the transport as listener (server).

Parameters
_listen:boolean

true to be a listening connection

Returns:X

this

withPreConnectCallbackback to summary
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.

Parameters
_callback:Consumer<AbstractTransport>

consumer to call, null to remove any callback

Returns:X

this

withRegisterSelfback to summary
public X withRegisterSelf(boolean _register)

Register the new connection on DBus using 'hello' message. Default is true.

Parameters
_register:boolean

boolean

Returns:X

this

Since
5.0.0 - 2023-10-11
withRemoveAdditionalConfigback to summary
public X withRemoveAdditionalConfig(String _key)

Removes an additional config key to of transport config.
Will do nothing if key does not exist.

Parameters
_key:String

key to remove

Returns:X

this

withServiceLoaderClassLoaderback to summary
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().

Parameters
_ldr:ClassLoader

class loader

Returns:X

this

withServiceLoaderModuleLayerback to summary
public X withServiceLoaderModuleLayer(ModuleLayer _layer)

Configure ModuleLayer used for ServiceLoader to find ITransportProvider implementations.

Parameters
_layer:ModuleLayer

module layer

Returns:X

this

withTimeoutback to summary
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.

Parameters
_timeout:int

true to be a listening connection

Returns:X

this

withUnixSocketFileGroupback to summary
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

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!

Parameters
_group:String

group to set, if null is given JVM process group is used

Returns:X

this

withUnixSocketFileOwnerback to summary
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

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!

Parameters
_user:String

user to set, if null is given JVM process user is used

Returns:X

this

withUnixSocketFilePermissionsback to summary
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

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!

Parameters
_permissions:PosixFilePermission[]

permissions to set, if null is given default permissions will be used

Returns:X

this