Class TransportConfigBuilder<X extends TransportConfigBuilder<?,R> , R>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionback()Return to the previous builder.build()Returns the transport config.Switch to theSaslConfigBuilderto configure the SASL authentication mechanism.
UseSaslConfigBuilder.back()to return to this builder when finished.Returns the currently configured BusAddress.withAdditionalConfig(String _key, Object _value) Adds an additional config key to the transport config.
Will overwrite value if key exists.withAfterBindCallback(Consumer<AbstractTransport> _callback) Set a callback which will be called afterbindImpl()on a server connection was called.
This method is only called if the transport is configured as server connection.withAutoConnect(boolean _connect) Instantly connect to DBus whenbuild()is called.withBusAddress(BusAddress _address) Set theBusAddresswhich should be used for the connection.withConfig(TransportConfig _config) Use the predefined TransportConfig.withEndianess(byte _endianess) Set the endianess for the connection Default is based on system endianess.withListening(boolean _listen) Use true to use the transport as listener (server).withPreConnectCallback(Consumer<AbstractTransport> _callback) Set a callback which will be called right before the connection to the transport is established.withRegisterSelf(boolean _register) Register the new connection on DBus using 'hello' message.Removes an additional config key to of transport config.
Will do nothing if key does not exist.Configure parent class loader used forServiceLoaderto findITransportProviderimplementations.
IfwithServiceLoaderModuleLayer(ModuleLayer)is also configured,ModuleLayerwill take precedence.withTimeout(int _timeout) Setup a timeout for the transport.withUnixSocketFileGroup(String _group) The group of the socket file if a unix socket is used and this is a server transport.withUnixSocketFileOwner(String _user) The owner of the socket file if a unix socket is used and this is a server transport.withUnixSocketFilePermissions(PosixFilePermission... _permissions) The permissions which will be set on socket file if a unix socket is used and this is a server transport.
-
Constructor Details
-
TransportConfigBuilder
-
-
Method Details
-
withConfig
Use the predefined TransportConfig.Using this will override any previous configuration and replaces the internal configuration object with the given instance.
- Parameters:
_config- configuration, never null- Returns:
- this
-
withBusAddress
Set theBusAddresswhich should be used for the connection.- Parameters:
_address- address to use- Returns:
- this
-
getBusAddress
Returns the currently configured BusAddress.- Returns:
- BusAddress, maybe null
-
withPreConnectCallback
Set a callback which will be called right before the connection to the transport is established.The given consumer will receive the created
AbstractTransportobject which is not yet connected. A callback should NEVER connect the transport, but is allowed to do further configuration if needed.- Parameters:
_callback- consumer to call, null to remove any callback- Returns:
- this
-
withAfterBindCallback
Set a callback which will be called afterbindImpl()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
AbstractTransportobject 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 to call, null to remove any callback- Returns:
- this
- Since:
- 5.0.0 - 2023-10-20
-
withAutoConnect
-
withRegisterSelf
Register the new connection on DBus using 'hello' message. Default is true.- Parameters:
_register- boolean- Returns:
- this
- Since:
- 5.0.0 - 2023-10-11
-
configureSasl
Switch to theSaslConfigBuilderto configure the SASL authentication mechanism.
UseSaslConfigBuilder.back()to return to this builder when finished.- Returns:
- SaslConfigBuilder
-
withListening
Use true to use the transport as listener (server).- Parameters:
_listen- true to be a listening connection- Returns:
- this
-
withTimeout
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- true to be a listening connection- Returns:
- this
-
withUnixSocketFileOwner
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!- Parameters:
_user- user to set, if null is given JVM process user is used- Returns:
- this
-
withUnixSocketFileGroup
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!- Parameters:
_group- group to set, if null is given JVM process group is used- Returns:
- this
-
withUnixSocketFilePermissions
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!- Parameters:
_permissions- permissions to set, if null is given default permissions will be used- Returns:
- this
-
withAdditionalConfig
-
withServiceLoaderClassLoader
Configure parent class loader used forServiceLoaderto findITransportProviderimplementations.
IfwithServiceLoaderModuleLayer(ModuleLayer)is also configured,ModuleLayerwill take precedence.
Defaults toTransportBuilder.class.getClassLoader().- Parameters:
_ldr- class loader- Returns:
- this
-
withServiceLoaderModuleLayer
- Parameters:
_layer- module layer- Returns:
- this
-
withRemoveAdditionalConfig
-
withEndianess
Set the endianess for the connection Default is based on system endianess.- Parameters:
_endianess-Endian.BIGor 0x6c- Returns:
- this
-
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:
- previous builder, maybe null
-
build
-