Class TransportBuilder
- Since:
- v4.0.0 - 2021-09-17
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents supported SASL authentication modes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final Map<String, ITransportProvider> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create the transport with the previously provided configuration.Returns the configuration builder to configure the transport.static TransportBuildercreate()Creates a newTransportBuilderinstance using a empty transport configuration.static TransportBuilderCreates a newTransportBuilderinstance with the given address.static TransportBuildercreate(BusAddress _address) Creates a newTransportBuilderinstance with the given address.static TransportBuildercreate(TransportConfig _config) Creates a newTransportBuilderinstance using the given configuration.static StringcreateDynamicSession(String _busType, boolean _listeningAddress) Creates a new dynamic bus address for the given bus type.static TransportBuildercreateWithDynamicSession(String _transportType) Creates a newTransportBuilderwith a dynamically created address.The currently configured BusAddress.Returns aListof all bustypes supported in the current runtime.(package private) static Map<String, ITransportProvider> isListening(boolean _listen) Deprecated, for removal: This API element is subject to removal in a future version.listening(boolean _listen) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withAutoConnect(boolean _connect) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withSaslAuthMode(TransportBuilder.SaslAuthMode _authMode) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withTimeout(int _timeout) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withUnixSocketFileGroup(String _group) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withUnixSocketFileOwner(String _user) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()withUnixSocketFilePermissions(PosixFilePermission... _permissions) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
PROVIDERS
-
transportConfigBuilder
private TransportConfigBuilder<TransportConfigBuilder<?,TransportBuilder>, transportConfigBuilderTransportBuilder>
-
-
Constructor Details
-
TransportBuilder
- Throws:
DBusException
-
-
Method Details
-
getTransportProvider
-
create
Creates a newTransportBuilderinstance with the given address.- Parameters:
_address- address, never null- Returns:
- new
TransportBuilder - Throws:
DBusException- if invalid address provided
-
create
Creates a newTransportBuilderinstance using the given configuration.- Parameters:
_config- config, never null- Returns:
- new
TransportBuilder - Throws:
DBusException- if invalid address provided
-
create
Creates a newTransportBuilderinstance using a empty transport configuration.- Returns:
- new
TransportBuilder - Throws:
DBusException- if invalid address provided
-
create
Creates a newTransportBuilderinstance with the given address.- Parameters:
_address- address, never null- Returns:
- new
TransportBuilder - Throws:
DBusException- if invalid address provided
-
createWithDynamicSession
Creates a newTransportBuilderwith a dynamically created address.- Parameters:
_transportType- type of session (e.g. UNIX or TCP)- Returns:
TransportBuilder- Throws:
DBusException- when invalid/unknown/unsupported transport type given
-
withTimeout
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withTimeout(int _timeout) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()Set the connection timeout (usually only used for TCP based transports).- Parameters:
_timeout- timeout, if < 0 default timeout ofAbstractConnection.TCP_CONNECT_TIMEOUTwill be used
-
isListening
@Deprecated(forRemoval=true, since="4.2.0 - 2022-05-23") public TransportBuilder isListening(boolean _listen) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()Toggle the created transport to be a listening (server) or initiating (client) connection.Default is a client connection.
- Parameters:
_listen- true to create a listening transport (e.g. for server usage)- Returns:
- this
-
listening
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder listening(boolean _listen) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()Toggle the created transport to be a listening (server) or initiating (client) connection.Default is a client connection.
- Parameters:
_listen- true to create a listening transport (e.g. for server usage)
-
withAutoConnect
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withAutoConnect(boolean _connect) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()Instantly connect to DBus whenbuild()is called.default: true
- Parameters:
_connect- boolean- Returns:
- this
-
withSaslAuthMode
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withSaslAuthMode(TransportBuilder.SaslAuthMode _authMode) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()Set a different SASL authentication mode.Usually when a unixsocket based transport is used,
TransportBuilder.SaslAuthMode.AUTH_EXTERNALwill be used. For TCP based transportTransportBuilder.SaslAuthMode.AUTH_COOKIEwill be used.- Parameters:
_authMode- authmode to use, if null is given, default mode will be used- Returns:
- this
-
withUnixSocketFileOwner
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withUnixSocketFileOwner(String _user) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()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
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withUnixSocketFileGroup(String _group) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()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
@Deprecated(since="4.2.0 - 2022-07-21", forRemoval=true) public TransportBuilder withUnixSocketFilePermissions(PosixFilePermission... _permissions) Deprecated, for removal: This API element is subject to removal in a future version.please useconfigure()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
-
configure
public TransportConfigBuilder<TransportConfigBuilder<?,TransportBuilder>, configure()TransportBuilder> Returns the configuration builder to configure the transport.- Returns:
- TransportConfigBuilder
-
build
Create the transport with the previously provided configuration.- Returns:
AbstractTransportinstance- Throws:
DBusException- when creating transport failsIOException- when autoconnect is true and connection to DBus failed
-
getAddress
The currently configured BusAddress.- Returns:
BusAddress
-
getRegisteredBusTypes
Returns aListof all bustypes supported in the current runtime.- Returns:
List, maybe empty
-
createDynamicSession
Creates a new dynamic bus address for the given bus type.- Parameters:
_busType- bus type (e.g. UNIX or TCP), never null_listeningAddress- true if a listening (server) address should be created, false otherwise- Returns:
- String containing BusAddress or null
-
configure()