Top Description Inners Fields Constructors Methods
org.freedesktop.dbus.connections.transports

public final Class TransportBuilder

extends Object
Class Inheritance
Imports
org.freedesktop.dbus.connections.BusAddress, .SASL, org.freedesktop.dbus.connections.config.TransportConfig, .TransportConfigBuilder, org.freedesktop.dbus.exceptions.DBusException, .InvalidBusAddressException, .TransportConfigurationException, .TransportRegistrationException, org.freedesktop.dbus.spi.transport.ITransportProvider, org.slf4j.Logger, .LoggerFactory, java.io.IOException, java.nio.channels.SocketChannel, java.util.*, java.util.concurrent.ConcurrentHashMap

Builder to create transports of different types.
Author
hypfvieh
Since
v4.0.0 - 2021-09-17

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
TransportBuilder.SaslAuthMode

Represents supported SASL authentication modes.

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final Map<Object, Map<String, ITransportProvider>>
private final TransportConfigBuilder<TransportConfigBuilder<?, TransportBuilder>, TransportBuilder>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public AbstractTransport

Returns:

AbstractTransport instance
build
()

Create the transport with the previously provided configuration.

public TransportConfigBuilder<TransportConfigBuilder<?, TransportBuilder>, TransportBuilder>

Returns:

TransportConfigBuilder
configure
()

Returns the configuration builder to configure the transport.

public static TransportBuilder

Returns:

new TransportBuilder
create
(String
address, never null
_address
)

Creates a new TransportBuilder instance with the given address.

public static TransportBuilder

Returns:

new TransportBuilder
create
(TransportConfig
config, never null
_config
)

Creates a new TransportBuilder instance using the given configuration.

public static TransportBuilder

Returns:

new TransportBuilder
create
()

Creates a new TransportBuilder instance using a empty transport configuration.

public static TransportBuilder

Returns:

new TransportBuilder
create
(BusAddress
address, never null
_address
)

Creates a new TransportBuilder instance with the given address.

public static String

Returns:

String containing BusAddress or null
createDynamicSession
(String
bus type (e.g. UNIX or TCP), never null
_busType
,
boolean
true if a listening (server) address should be created, false otherwise
_listeningAddress
)

Creates a new dynamic bus address for the given bus type.

public static TransportBuilder
createWithDynamicSession(String
type of session (e.g. UNIX or TCP)
_transportType
)

Creates a new TransportBuilder with a dynamically created address.

pack-priv static void
public BusAddress

Returns:

BusAddress
getAddress
()

The currently configured BusAddress.

public static List<String>

Returns:

List, maybe empty
getRegisteredBusTypes
()

Returns a List of all bustypes supported in the current runtime.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
PROVIDERSback to summary
private static final Map<Object, Map<String, ITransportProvider>> PROVIDERS
transportConfigBuilderback to summary
private final TransportConfigBuilder<TransportConfigBuilder<?, TransportBuilder>, TransportBuilder> transportConfigBuilder

Constructor Detail

TransportBuilderback to summary
private TransportBuilder(TransportConfig _config)

Method Detail

buildback to summary
public AbstractTransport build() throws DBusException, IOException

Create the transport with the previously provided configuration.

If autoconnect is enabled and this is a client connection, the connection will be established automatically. Establishing the connection will be retried several times to allow connection in concurrent setups. The max retry attempts are calculated by using the configured connection timeout (default: 10000 millis) divided by 500. The minimum of retries is 1.

Without autoconnect, the connection will not be started and has to be started by calling connect() on the connection instance. In that case there are no automatic reconnection attempts.

Returns:AbstractTransport

AbstractTransport instance

Exceptions
DBusException:
when creating transport fails
IOException:
when autoconnect is true, connection is not a listening connection and connection to DBus failed
configureback to summary
public TransportConfigBuilder<TransportConfigBuilder<?, TransportBuilder>, TransportBuilder> configure()

Returns the configuration builder to configure the transport.

Returns:TransportConfigBuilder<TransportConfigBuilder<?, TransportBuilder>, TransportBuilder>

TransportConfigBuilder

createback to summary
public static TransportBuilder create(String _address) throws InvalidBusAddressException

Creates a new TransportBuilder instance with the given address.

Parameters
_address:String

address, never null

Returns:TransportBuilder

new TransportBuilder

Exceptions
InvalidBusAddressException:
if invalid address provided
createback to summary
public static TransportBuilder create(TransportConfig _config) throws InvalidBusAddressException

Creates a new TransportBuilder instance using the given configuration.

Parameters
_config:TransportConfig

config, never null

Returns:TransportBuilder

new TransportBuilder

Exceptions
InvalidBusAddressException:
if invalid address provided
createback to summary
public static TransportBuilder create()

Creates a new TransportBuilder instance using a empty transport configuration.

Returns:TransportBuilder

new TransportBuilder

createback to summary
public static TransportBuilder create(BusAddress _address)

Creates a new TransportBuilder instance with the given address.

Parameters
_address:BusAddress

address, never null

Returns:TransportBuilder

new TransportBuilder

Exceptions
DBusException:
if invalid address provided
createDynamicSessionback to summary
public static String createDynamicSession(String _busType, boolean _listeningAddress)

Creates a new dynamic bus address for the given bus type.

Parameters
_busType:String

bus type (e.g. UNIX or TCP), never null

_listeningAddress:boolean

true if a listening (server) address should be created, false otherwise

Returns:String

String containing BusAddress or null

createWithDynamicSessionback to summary
public static TransportBuilder createWithDynamicSession(String _transportType) throws DBusException

Creates a new TransportBuilder with a dynamically created address.

Parameters
_transportType:String

type of session (e.g. UNIX or TCP)

Returns:TransportBuilder

TransportBuilder

Exceptions
DBusException:
when invalid/unknown/unsupported transport type given
findTransportProviderback to summary
pack-priv static void findTransportProvider(ClassLoader _clzLoader, ModuleLayer _layer)
getAddressback to summary
public BusAddress getAddress()

The currently configured BusAddress.

Returns:BusAddress

BusAddress

getRegisteredBusTypesback to summary
public static List<String> getRegisteredBusTypes()

Returns a List of all bustypes supported in the current runtime.

Returns:List<String>

List, maybe empty

org.freedesktop.dbus.connections.transports back to summary

public final Enum TransportBuilder.SaslAuthMode

extends Enum<TransportBuilder.SaslAuthMode>
Class Inheritance

Represents supported SASL authentication modes.
Author
hypfvieh
Since
v4.0.0 - 2021-09-17

Field Summary

Modifier and TypeField and Description
public static final TransportBuilder.SaslAuthMode
AUTH_ANONYMOUS

No authentication (allow everyone).

public static final TransportBuilder.SaslAuthMode
AUTH_COOKIE

Authentication using SHA Cookie.

public static final TransportBuilder.SaslAuthMode
AUTH_EXTERNAL

External authentication (e.g. by user ID).

private final int

Constructor Summary

AccessConstructor and Description
private
SaslAuthMode(int _authMode)

Method Summary

Modifier and TypeMethod and Description
public int
public static TransportBuilder.SaslAuthMode
public static TransportBuilder.SaslAuthMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AUTH_ANONYMOUSback to summary
public static final TransportBuilder.SaslAuthMode AUTH_ANONYMOUS

No authentication (allow everyone).

AUTH_EXTERNALback to summary
public static final TransportBuilder.SaslAuthMode AUTH_EXTERNAL

External authentication (e.g. by user ID).

authModeback to summary
private final int authMode

Constructor Detail

SaslAuthModeback to summary
private SaslAuthMode(int _authMode)

Method Detail

getAuthModeback to summary
public int getAuthMode()
valueOfback to summary
public static TransportBuilder.SaslAuthMode valueOf(String name)
valuesback to summary
public static TransportBuilder.SaslAuthMode[] values()