Class AddressBuilder


  • public final class AddressBuilder
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DBUS_SESSION_BUS_ADDRESS
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constant has been moved to DBusSysProps.
      static java.lang.String DBUS_SYSTEM_BUS_ADDRESS
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constant has been moved to DBusSysProps.
      static java.lang.String DEFAULT_SYSTEM_BUS_ADDRESS
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constant has been moved to DBusSysProps.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AddressBuilder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.io.File determineMachineIdFile​(java.lang.String _dbusMachineIdFile)
      Tries to find the DBus machine-id file in different locations.
      static java.lang.String getDbusMachineId​(java.lang.String _dbusMachineIdFile)
      Extracts the machine-id usually found on Linux in various system directories, or generate a fake id for non-Linux platforms.
      private static java.lang.String getFakeDbusMachineId()
      Generates a fake machine-id when DBus is running on Windows.
      static BusAddress getSessionConnection​(java.lang.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.
      static BusAddress getSystemConnection()
      Determine the address of the DBus system connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DBUS_SYSTEM_BUS_ADDRESS

        @Deprecated(forRemoval=true,
                    since="v4.2.2 - 2023-01-20")
        public static final java.lang.String DBUS_SYSTEM_BUS_ADDRESS
        Deprecated, for removal: This API element is subject to removal in a future version.
        Constant has been moved to DBusSysProps.
        See Also:
        Constant Field Values
      • DEFAULT_SYSTEM_BUS_ADDRESS

        @Deprecated(forRemoval=true,
                    since="v4.2.2 - 2023-01-20")
        public static final java.lang.String DEFAULT_SYSTEM_BUS_ADDRESS
        Deprecated, for removal: This API element is subject to removal in a future version.
        Constant has been moved to DBusSysProps.
        See Also:
        Constant Field Values
      • DBUS_SESSION_BUS_ADDRESS

        @Deprecated(forRemoval=true,
                    since="v4.2.2 - 2023-01-20")
        public static final java.lang.String DBUS_SESSION_BUS_ADDRESS
        Deprecated, for removal: This API element is subject to removal in a future version.
        Constant has been moved to DBusSysProps.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AddressBuilder

        private AddressBuilder()
    • Method Detail

      • getSystemConnection

        public static BusAddress getSystemConnection()
        Determine the address of the DBus system connection.
        Returns:
        String
      • getSessionConnection

        public static BusAddress getSessionConnection​(java.lang.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 - alternative location of dbus machine id file, use null if not needed
        Returns:
        address
        Throws:
        AddressResolvingException - when no suitable address can be found for any available transport
      • getDbusMachineId

        public static java.lang.String getDbusMachineId​(java.lang.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 - alternative location of dbus machine id file, null if not needed
        Returns:
        machine-id string, never null
      • determineMachineIdFile

        private static java.io.File determineMachineIdFile​(java.lang.String _dbusMachineIdFile)
        Tries to find the DBus machine-id file in different locations.
        Parameters:
        _dbusMachineIdFile - alternative location of dbus machine id file
        Returns:
        File with machine-id
      • getFakeDbusMachineId

        private static java.lang.String getFakeDbusMachineId()
        Generates a fake machine-id when DBus is running on Windows.
        Returns:
        String