Class DBusInterfaceSkeleton

All Implemented Interfaces:
DBusInterface, Proxy
Direct Known Subclasses:
DBusInterfaceSkeleton.DBusInterfaceSkeleton$Impl

@Generated("org.javagi.JavaGI") public abstract class DBusInterfaceSkeleton extends GObject implements DBusInterface
Abstract base class for D-Bus interfaces on the service side.
Since:
2.30
  • Constructor Details

    • DBusInterfaceSkeleton

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

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

    • getType

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

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

      protected DBusInterfaceSkeleton 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 boolean export(DBusConnection connection, String objectPath) throws GErrorException

      Exports this DBusInterfaceSkeleton at objectPath on connection.

      This can be called multiple times to export the same this DBusInterfaceSkeleton onto multiple connections however the objectPath provided must be the same for all connections.

      Use g_dbus_interface_skeleton_unexport() to unexport the object.

      Parameters:
      connection - A GDBusConnection to export this DBusInterfaceSkeleton on.
      objectPath - The path to export the interface at.
      Returns:
      true if the interface was exported on connection, otherwise false with error set.
      Throws:
      GErrorException - see GError
      Since:
      2.30
    • flush

      public void flush()

      If this DBusInterfaceSkeleton has outstanding changes, request for these changes to be emitted immediately.

      For example, an exported D-Bus interface may queue up property changes and emit the org.freedesktop.DBus.Properties.PropertiesChanged signal later (e.g. in an idle handler). This technique is useful for collapsing multiple property changes into one.

      Since:
      2.30
    • getConnection

      public @Nullable DBusConnection getConnection()
      Gets the first connection that this DBusInterfaceSkeleton is exported on, if any.
      Returns:
      A GDBusConnection or null if this DBusInterfaceSkeleton is not exported anywhere. Do not free, the object belongs to interface.
      Since:
      2.30
    • getConnections

      public List<DBusConnection> getConnections()
      Gets a list of the connections that this DBusInterfaceSkeleton is exported on.
      Returns:
      A list of all the connections that this DBusInterfaceSkeleton is exported on. The returned list should be freed with g_list_free() after each element has been freed with g_object_unref().
      Since:
      2.32
    • getFlags

      public Set<DBusInterfaceSkeletonFlags> getFlags()
      Gets the GDBusInterfaceSkeletonFlags that describes what the behavior of this DBusInterfaceSkeleton
      Returns:
      One or more flags from the GDBusInterfaceSkeletonFlags enumeration.
      Since:
      2.30
    • getInfo

      public DBusInterfaceInfo getInfo()
      Gets D-Bus introspection information for the D-Bus interface implemented by interface.
      Specified by:
      getInfo in interface DBusInterface
      Returns:
      A GDBusInterfaceInfo (never null). Do not free.
      Since:
      2.30
    • getObjectPath

      public @Nullable String getObjectPath()
      Gets the object path that this DBusInterfaceSkeleton is exported on, if any.
      Returns:
      A string owned by this DBusInterfaceSkeleton or null if this DBusInterfaceSkeleton is not exported anywhere. Do not free, the string belongs to interface.
      Since:
      2.30
    • getProperties

      public Variant getProperties()
      Gets all D-Bus properties for interface.
      Returns:
      A GVariant of type 'a{sv}'. Free with g_variant_unref().
      Since:
      2.30
    • getVtable

      public DBusInterfaceVTable getVtable()
      Gets the interface vtable for the D-Bus interface implemented by interface. The returned function pointers should expect this DBusInterfaceSkeleton itself to be passed as userData.
      Returns:
      the vtable of the D-Bus interface implemented by the skeleton
      Since:
      2.30
    • hasConnection

      public boolean hasConnection(DBusConnection connection)
      Checks if this DBusInterfaceSkeleton is exported on connection.
      Parameters:
      connection - A GDBusConnection.
      Returns:
      true if this DBusInterfaceSkeleton is exported on connection, false otherwise.
      Since:
      2.32
    • setFlags

      public void setFlags(Set<DBusInterfaceSkeletonFlags> flags)
      Sets flags describing what the behavior of skeleton should be.
      Parameters:
      flags - Flags from the GDBusInterfaceSkeletonFlags enumeration.
      Since:
      2.30
    • setFlags

      public void setFlags(DBusInterfaceSkeletonFlags... flags)
      Sets flags describing what the behavior of skeleton should be.
      Parameters:
      flags - Flags from the GDBusInterfaceSkeletonFlags enumeration.
      Since:
      2.30
    • unexport

      public void unexport()

      Stops exporting this DBusInterfaceSkeleton on all connections it is exported on.

      To unexport this DBusInterfaceSkeleton from only a single connection, use g_dbus_interface_skeleton_unexport_from_connection()

      Since:
      2.30
    • unexportFromConnection

      public void unexportFromConnection(DBusConnection connection)

      Stops exporting this DBusInterfaceSkeleton on connection.

      To stop exporting on all connections the interface is exported on, use g_dbus_interface_skeleton_unexport().

      Parameters:
      connection - A GDBusConnection.
      Since:
      2.32
    • gAuthorizeMethod

      protected boolean gAuthorizeMethod(DBusMethodInvocation invocation)
      Signal class handler for the GDBusInterfaceSkeleton::g-authorize-method signal.
    • methodDispatch

      protected void methodDispatch(@Nullable DBusInterfaceMethodCallFunc methodCallFunc, DBusMethodInvocation invocation, Set<DBusInterfaceSkeletonFlags> flags, DBusObject object)
      Dispatches a method invocation. (Since: 2.88)
    • onGAuthorizeMethod

      Emitted when a method is invoked by a remote caller and used to determine if the method call is authorized.

      Note that this signal is emitted in a thread dedicated to handling the method call so handlers are allowed to perform blocking IO. This means that it is appropriate to call e.g. polkit_authority_check_authorization_sync() with the POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION flag set.

      If false is returned then no further handlers are run and the signal handler must take a reference to invocation and finish handling the call (e.g. return an error via g_dbus_method_invocation_return_error()).

      Otherwise, if true is returned, signal emission continues. If no handlers return false, then the method is dispatched. If interface_ has an enclosing GDBusObjectSkeleton, then the GDBusObjectSkeleton::authorize-method signal handlers run before the handlers for this signal.

      The default class handler just returns true.

      Please note that the common case is optimized: if no signals handlers are connected and the default class handler isn't overridden (for both interface_ and the enclosing GDBusObjectSkeleton, if any) and GDBusInterfaceSkeleton:g-flags does not have the DBusInterfaceSkeletonFlags.HANDLE_METHOD_INVOCATIONS_IN_THREAD flags set, no dedicated thread is ever used and the call will be handled in the same thread as the object that interface_ belongs to was exported in.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.30
      See Also:
    • emitGAuthorizeMethod

      public boolean emitGAuthorizeMethod(@Nullable DBusMethodInvocation invocation)
      Emits the "g-authorize-method" signal. See onGAuthorizeMethod(DBusInterfaceSkeleton.GAuthorizeMethodCallback).