Klasse EmbeddedDBusDaemon

java.lang.Object
org.freedesktop.dbus.bin.EmbeddedDBusDaemon
Alle implementierten Schnittstellen:
Closeable, AutoCloseable

public class EmbeddedDBusDaemon extends Object implements Closeable
Simple DBusDaemon implementation to use if no DBusDaemon is running on the OS level.
  • Konstruktordetails

  • Methodendetails

    • close

      public void close() throws IOException
      Shutdown the running DBusDaemon instance.
      Angegeben von:
      close in Schnittstelle AutoCloseable
      Angegeben von:
      close in Schnittstelle Closeable
      Löst aus:
      IOException
    • startInForeground

      public void startInForeground()
      Run the DBusDaemon in foreground.

      This is a blocking operation.

    • startInBackground

      public void startInBackground()
      Start the DBusDaemon in background and returns immediately.

      This method may return before the background thread is ready. To ensure the the background thread is running on return use startInBackgroundAndWait(long).

    • startInBackgroundAndWait

      public void startInBackgroundAndWait(long _maxWaitMillis) throws IllegalStateException
      Starts the DBusDaemon in background.

      Will wait up to the given period of milliseconds for the background thread to get ready.

      Parameter:
      _maxWaitMillis - maximum wait time in milliseconds
      Löst aus:
      IllegalStateException - when interrupted or wait for daemon timed out
    • startInBackgroundAndWait

      public void startInBackgroundAndWait() throws IllegalStateException
      Starts the DBusDaemon in background.

      Waits until the daemon is ready before return indefinitely. If given wait time exceeded, a RuntimeException is thrown.

      Löst aus:
      IllegalStateException - when interrupted while waiting for daemon to start
      Seit:
      5.0.0 - 2023-10-20
    • isRunning

      public boolean isRunning()
      Whether the DBusDaemon is still running.
      Gibt zurück:
      true if running, false otherwise
    • getSaslAuthMode

      public TransportBuilder.SaslAuthMode getSaslAuthMode()
      The currently configured TransportBuilder.SaslAuthMode. When null is returned, the TransportBuilder.SaslAuthMode of the transport provider is used.
      Gibt zurück:
      TransportBuilder.SaslAuthMode or null
    • setSaslAuthMode

      public void setSaslAuthMode(TransportBuilder.SaslAuthMode _saslAuthMode)
      Use this to override the default authentication mode which would be used by the transport based on the BusAddress.
      Parameter:
      _saslAuthMode - auth mode, null to use default
    • setUnixSocketOwner

      public void setUnixSocketOwner(String _owner)
      The file owner for the created unix socket.
      Ignored if TCP is used.

      Will only work if currently running JVM process user has suitable permissions to change the owner.
      Parameter:
      _owner - owner to set
    • setUnixSocketGroup

      public void setUnixSocketGroup(String _group)
      The file group for the created unix socket.
      Ignored if TCP is used.

      Will only work if currently running JVM process user has suitable permissions to change the group.
      Parameter:
      _group - group to set
    • setUnixSocketPermissions

      public void setUnixSocketPermissions(PosixFilePermission... _permissions)
      The file permissions for the created unix socket.
      Ignored if TCP is used or if the OS is Windows.

      Will only work if currently running JVM process user has suitable permissions to change the permissions.
      Parameter:
      _permissions - permissions to set
    • setServiceLoaderClassLoader

      public void setServiceLoaderClassLoader(ClassLoader _serviceLoaderClassLoader)
      ClassLoader to use for ServiceLoader to find ITransportProvider implementations.
      Parameter:
      _serviceLoaderClassLoader - class loader
    • setServiceLoaderModuleLayer

      public void setServiceLoaderModuleLayer(ModuleLayer _serviceLoaderModuleLayer)
      Module Layer to use for ServiceLoader to find ITransportProvider implementations.
      Parameter:
      _serviceLoaderModuleLayer - module layer
    • getConnectCallback

      public Consumer<AbstractTransport> getConnectCallback()
      Configured pre-connect callback.
      Gibt zurück:
      Consumer or null
    • setConnectCallback

      public void setConnectCallback(Consumer<AbstractTransport> _connectCallback)
      Callback which will be called by transport right before the socket is bound and connections will be accepted.
      Parameter:
      _connectCallback - callback or null to disable
    • getBindCallback

      public Consumer<AbstractTransport> getBindCallback()
      Configured bind callback.
      Gibt zurück:
      Consumer or null
    • setBindCallback

      public void setBindCallback(Consumer<AbstractTransport> _callback)
      Callback which will be called by transport right after the server socket was bound.
      Server will not yet accept connections at this point, but it started listening on the configured address.
      Parameter:
      _callback -