Top Constructors Methods
org.freedesktop.dbus.utils

public final Class AddressBuilder

extends Object
Class Inheritance
Imports
org.freedesktop.dbus.config.DBusSysProps, org.freedesktop.dbus.connections.BusAddress, org.freedesktop.dbus.exceptions.AddressResolvingException, org.slf4j.LoggerFactory, java.io.File, java.net.InetAddress, .UnknownHostException, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.*

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

String
createMachineId
()

Creates a machine identifier by using the MD5 sum of the hostname.

private static File

Returns:

File with machine-id
determineMachineIdFile
(String
alternative location of dbus machine id file
_dbusMachineIdFile
)

Tries to find the DBus machine-id file in different locations.

public static String

Returns:

machine-id string, never null
getDbusMachineId
(String
alternative location of dbus machine id file, null if not needed
_dbusMachineIdFile
)

Extracts the machine-id usually found on Linux in various system directories, or generate a fake id for non-Linux platforms.

private static String

Returns:

String
getFakeDbusMachineId
()

Generates a fake machine-id when DBus is running on Windows.

public static BusAddress

Returns:

address
getSessionConnection
(String
alternative location of dbus machine id file, use null if not needed
_dbusMachineIdFile
)

Retrieves the connection address to connect to the DBus session-bus.

public static BusAddress

Returns:

String
getSystemConnection
()

Determine the address of the DBus system connection.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AddressBuilderback to summary
private AddressBuilder()

Method Detail

createMachineIdback to summary
public static String createMachineId()

Creates a machine identifier by using the MD5 sum of the hostname. If hostname could not be determined, a random string will be used.

Returns:String

String

determineMachineIdFileback to summary
private static File determineMachineIdFile(String _dbusMachineIdFile)

Tries to find the DBus machine-id file in different locations.

Parameters
_dbusMachineIdFile:String

alternative location of dbus machine id file

Returns:File

File with machine-id

getDbusMachineIdback to summary
public static String getDbusMachineId(String _dbusMachineIdFile)

Extracts the machine-id usually found on Linux in various system directories, or generate a fake id for non-Linux platforms.

Parameters
_dbusMachineIdFile:String

alternative location of dbus machine id file, null if not needed

Returns:String

machine-id string, never null

getFakeDbusMachineIdback to summary
private static String getFakeDbusMachineId()

Generates a fake machine-id when DBus is running on Windows.

Returns:String

String

getSessionConnectionback to summary
public static BusAddress getSessionConnection(String _dbusMachineIdFile)

Retrieves the connection address to connect to the DBus session-bus.
Will return TCP connection when no unix transport found and TCP is available.

Parameters
_dbusMachineIdFile:String

alternative location of dbus machine id file, use null if not needed

Returns:BusAddress

address

Exceptions
AddressResolvingException:
when no suitable address can be found for any available transport
getSystemConnectionback to summary
public static BusAddress getSystemConnection()

Determine the address of the DBus system connection.

Returns:BusAddress

String