Class DBusObjectManagerServer

All Implemented Interfaces:
DBusObjectManager, Proxy

@Generated("org.javagi.JavaGI") public class DBusObjectManagerServer extends GObject implements DBusObjectManager

GDBusObjectManagerServer is used to export DBusObject instances using the standardized org.freedesktop.DBus.ObjectManager interface. For example, remote D-Bus clients can get all objects and properties in a single call. Additionally, any change in the object hierarchy is broadcast using signals. This means that D-Bus clients can keep caches up to date by only listening to D-Bus signals.

The recommended path to export an object manager at is the path form of the well-known name of a D-Bus service, or below. For example, if a D-Bus service is available at the well-known name net.example.ExampleService1, the object manager should typically be exported at /net/example/ExampleService1, or below (to allow for multiple object managers in a service).

It is supported, but not recommended, to export an object manager at the root path, /.

See DBusObjectManagerClient for the client-side code that is intended to be used with GDBusObjectManagerServer or any D-Bus object implementing the org.freedesktop.DBus.ObjectManager interface.

Since:
2.30
  • Constructor Details

    • DBusObjectManagerServer

      public DBusObjectManagerServer(MemorySegment address)
      Create a DBusObjectManagerServer instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • DBusObjectManagerServer

      public DBusObjectManagerServer(String objectPath)

      Creates a new GDBusObjectManagerServer object.

      The returned server isn't yet exported on any connection. To do so, use g_dbus_object_manager_server_set_connection(). Normally you want to export all of your objects before doing so to avoid InterfacesAdded signals being emitted.

      Parameters:
      objectPath - The object path to export the manager object at.
      Since:
      2.30
    • DBusObjectManagerServer

      public DBusObjectManagerServer()
      Create a new DBusObjectManagerServer.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the DBusObjectManagerServer class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected DBusObjectManagerServer asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • export

      public void export(DBusObjectSkeleton object)

      Exports object on manager.

      If there is already a GDBusObject exported at the object path, then the old object is removed.

      The object path for object must be in the hierarchy rooted by the object path for manager.

      Note that this DBusObjectManagerServer will take a reference on object for as long as it is exported.

      Parameters:
      object - A GDBusObjectSkeleton.
      Since:
      2.30
    • exportUniquely

      public void exportUniquely(DBusObjectSkeleton object)
      Like g_dbus_object_manager_server_export() but appends a string of the form _N (with N being a natural number) to object's object path if an object with the given path already exists. As such, the GDBusObjectProxy:g-object-path property of object may be modified.
      Parameters:
      object - An object.
      Since:
      2.30
    • getConnection

      public @Nullable DBusConnection getConnection()
      Gets the GDBusConnection used by manager.
      Returns:
      A GDBusConnection object or null if this DBusObjectManagerServer isn't exported on a connection. The returned object should be freed with g_object_unref().
      Since:
      2.30
    • isExported

      public boolean isExported(DBusObjectSkeleton object)
      Returns whether object is currently exported on manager.
      Parameters:
      object - An object.
      Returns:
      true if object is exported
      Since:
      2.34
    • setConnection

      public void setConnection(@Nullable DBusConnection connection)
      Exports all objects managed by this DBusObjectManagerServer on connection. If connection is null, stops exporting objects.
      Parameters:
      connection - A GDBusConnection or null.
    • unexport

      public boolean unexport(String objectPath)

      If this DBusObjectManagerServer has an object at path, removes the object. Otherwise does nothing.

      Note that objectPath must be in the hierarchy rooted by the object path for manager.

      Parameters:
      objectPath - An object path.
      Returns:
      true if object at objectPath was removed, false otherwise.
      Since:
      2.30
    • builder

      A DBusObjectManagerServer.Builder object constructs a DBusObjectManagerServer with the specified properties. Use the various set...() methods to set properties, and finish construction with DBusObjectManagerServer.Builder.build().
      Returns:
      the builder object